From: Eduardo San Martin Morote Date: Thu, 9 Jun 2022 13:47:16 +0000 (+0200) Subject: test: migrate hash test X-Git-Tag: v4.1.0~51 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=70b3408906fb201438de5da1b86508f4814771c9;p=thirdparty%2Fvuejs%2Frouter.git test: migrate hash test --- diff --git a/packages/router/old-e2e/hash/index.html b/packages/router/e2e/hash/index.html similarity index 100% rename from packages/router/old-e2e/hash/index.html rename to packages/router/e2e/hash/index.html diff --git a/packages/router/old-e2e/hash/index.ts b/packages/router/e2e/hash/index.ts similarity index 95% rename from packages/router/old-e2e/hash/index.ts rename to packages/router/e2e/hash/index.ts index 2fdd8c67..eb7e81f8 100644 --- a/packages/router/old-e2e/hash/index.ts +++ b/packages/router/e2e/hash/index.ts @@ -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 = { diff --git a/packages/router/old-e2e/specs/hash.js b/packages/router/e2e/specs/hash.js similarity index 83% rename from packages/router/old-e2e/specs/hash.js rename to packages/router/e2e/specs/hash.js index 5256a5a2..423a8440 100644 --- a/packages/router/old-e2e/specs/hash.js +++ b/packages/router/e2e/specs/hash.js @@ -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()