]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
test: migrate hash test
authorEduardo San Martin Morote <posva13@gmail.com>
Thu, 9 Jun 2022 13:47:16 +0000 (15:47 +0200)
committerEduardo San Martin Morote <posva@users.noreply.github.com>
Thu, 30 Jun 2022 07:59:00 +0000 (09:59 +0200)
packages/router/e2e/hash/index.html [moved from packages/router/old-e2e/hash/index.html with 100% similarity]
packages/router/e2e/hash/index.ts [moved from packages/router/old-e2e/hash/index.ts with 95% similarity]
packages/router/e2e/specs/hash.js [moved from packages/router/old-e2e/specs/hash.js with 83% similarity]

similarity index 95%
rename from packages/router/old-e2e/hash/index.ts
rename to packages/router/e2e/hash/index.ts
index 2fdd8c674b99512e0ded63314fe7b1247c2cb784..eb7e81f885a4bc34cc64ad2dce2667c0c8452227 100644 (file)
@@ -1,6 +1,10 @@
 import '../global.css'
-import { createRouter, useRoute, createWebHashHistory } from '../../src'
-import { RouteComponent } from '../../src/types'
+import {
+  createRouter,
+  useRoute,
+  createWebHashHistory,
+  RouteComponent,
+} from 'vue-router'
 import { createApp } from 'vue'
 
 const Home: RouteComponent = {
similarity index 83%
rename from packages/router/old-e2e/specs/hash.js
rename to packages/router/e2e/specs/hash.js
index 5256a5a2246378425ab40950070d9a42dbafffb0..423a8440d03c6dc45b02d30c7917a9343e0eb164 100644 (file)
@@ -1,12 +1,9 @@
-const bsStatus = require('../browserstack-send-status')
-
 const baseURL = 'http://localhost:3000/hash/#'
 
 module.exports = {
-  ...bsStatus(),
-
   '@tags': ['hash', 'encoding'],
 
+  /** @type {import('nightwatch').NightwatchTest} */
   'navigating to links': function (browser) {
     browser
       .url(baseURL)
@@ -18,27 +15,27 @@ module.exports = {
       .assert.attributeContains('li:nth-child(6) a', 'href', '#/unicode/%C3%A9')
       .click('li:nth-child(3) a')
       .assert.urlEquals(baseURL + '/bar')
-      .assert.containsText('.view', 'Bar')
+      .assert.textContains('.view', 'Bar')
       .click('li:nth-child(2) a')
       .assert.urlEquals(baseURL + '/foo')
       .click('li:nth-child(4) a')
       .assert.urlEquals(baseURL + '/n/%C3%A9')
-      .assert.containsText('#path', '/n/%C3%A9')
+      .assert.textContains('#path', '/n/%C3%A9')
 
       // the correctly encoded version
       .click('li:nth-child(6) a')
       .assert.urlEquals(baseURL + '/unicode/%C3%A9')
-      .assert.containsText('#path', '/unicode/%C3%A9')
-      .assert.containsText('#param', 'é')
+      .assert.textContains('#path', '/unicode/%C3%A9')
+      .assert.textContains('#param', 'é')
       // the unencoded version, no check for the url because changes based on browser
       .click('li:nth-child(5) a')
-      .assert.containsText('#param', 'é')
+      .assert.textContains('#param', 'é')
 
       // regular links should not break navigation
       .click('li:nth-child(10) a')
       .assert.urlEquals(baseURL + '/foo')
-      .assert.containsText('#path', '/foo')
-      .assert.containsText('.view', 'Foo')
+      .assert.textContains('#path', '/foo')
+      .assert.textContains('.view', 'Foo')
 
       .end()
   },
@@ -77,14 +74,14 @@ module.exports = {
       .url(baseURL + '/unicode/%C3%A9')
       // navigation to unencoded value
       .assert.urlEquals(baseURL + '/unicode/%C3%A9')
-      .assert.containsText('#path', '/unicode/%C3%A9')
-      .assert.containsText('#param', 'é')
+      .assert.textContains('#path', '/unicode/%C3%A9')
+      .assert.textContains('#param', 'é')
 
       // TODO: invalid in safari, tests on those where this is valid
       // .url(baseURL + '/unicode/é')
       // navigation to unencoded value
       // depending on the browser the value will be encoded or not
-      // .assert.containsText('#param', 'é')
+      // .assert.textContains('#param', 'é')
 
       .end()
   },
@@ -94,12 +91,12 @@ module.exports = {
     browser
       .url(baseURL + '/')
       .waitForElementPresent('#app > *', 1000)
-      .assert.containsText('.view', 'home')
+      .assert.textContains('.view', 'home')
 
       .execute(function () {
         window.location.hash = '#/redirect'
       })
-      .assert.containsText('.view', 'Foo')
+      .assert.textContains('.view', 'Foo')
       .assert.urlEquals(baseURL + '/foo')
 
       .end()