From: Eduardo San Martin Morote Date: Wed, 15 Apr 2020 14:37:57 +0000 (+0200) Subject: test: modify e2e tests to work on safari X-Git-Tag: v4.0.0-alpha.6~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2945e18526eb021b5dde107730e7ab7754fb005c;p=thirdparty%2Fvuejs%2Frouter.git test: modify e2e tests to work on safari --- diff --git a/e2e/encoding/index.html b/e2e/encoding/index.html index bacb08f7..be7a0f21 100644 --- a/e2e/encoding/index.html +++ b/e2e/encoding/index.html @@ -12,71 +12,6 @@ << Back to Homepage
-
-
- Name: -
{{ route.name }}
-
- -
- Params: -
{{ route.params }}
-
- -
- Query: -
{{ route.query }}
-
- -
- Hash: -
{{ route.hash }}
-
- -
- FullPath: -
{{ route.fullPath }}
-
- -
- path: -
{{ route.path }}
-
- -
- - - - -
+
diff --git a/e2e/encoding/index.ts b/e2e/encoding/index.ts index a442d06f..7d454e32 100644 --- a/e2e/encoding/index.ts +++ b/e2e/encoding/index.ts @@ -31,6 +31,75 @@ const app = createApp({ const route = useRoute() return { route } }, + + template: ` +
+
+ Name: +
{{ route.name }}
+
+ +
+ Params: +
{{ route.params }}
+
+ +
+ Query: +
{{ route.query }}
+
+ +
+ Hash: +
{{ route.hash }}
+
+ +
+ FullPath: +
{{ route.fullPath }}
+
+ +
+ path: +
{{ route.path }}
+
+ +
+ + + + +
+ `, }) app.use(router) diff --git a/e2e/hash/index.html b/e2e/hash/index.html index 6290ca22..4d3e4f15 100644 --- a/e2e/hash/index.html +++ b/e2e/hash/index.html @@ -12,45 +12,6 @@ << Back to Homepage
-
- - -

- path: {{ route.path }} -
- query.t: {{ route.query.t }} -
- hash: {{ route.hash }} -

- - -
+
diff --git a/e2e/hash/index.ts b/e2e/hash/index.ts index a64543dd..8de3d1ad 100644 --- a/e2e/hash/index.ts +++ b/e2e/hash/index.ts @@ -33,6 +33,49 @@ const app = createApp({ const route = useRoute() return { route } }, + + template: ` +
+ + +

+ path: {{ route.path }} +
+ query.t: {{ route.query.t }} +
+ hash: {{ route.hash }} +

+ + +
+ `, }) app.use(router) diff --git a/e2e/modal/index.html b/e2e/modal/index.html index 3a9434d9..e08a2bff 100644 --- a/e2e/modal/index.html +++ b/e2e/modal/index.html @@ -41,8 +41,6 @@ << Back to Homepage
-
- -
+
diff --git a/e2e/modal/index.ts b/e2e/modal/index.ts index 96e3fb8d..278343e4 100644 --- a/e2e/modal/index.ts +++ b/e2e/modal/index.ts @@ -141,6 +141,12 @@ const app = createApp({ return { route, ViewComponent, historyState, ...toRefs(route) } }, + + template: ` +
+ +
+ `, }) app.use(router) diff --git a/e2e/navigation-guards/index.html b/e2e/navigation-guards/index.html index 81847f62..b4911039 100644 --- a/e2e/navigation-guards/index.html +++ b/e2e/navigation-guards/index.html @@ -12,17 +12,6 @@ << Back to Homepage
-
- - - -
+
diff --git a/e2e/navigation-guards/index.ts b/e2e/navigation-guards/index.ts index 6fca240e..8cb0b9e6 100644 --- a/e2e/navigation-guards/index.ts +++ b/e2e/navigation-guards/index.ts @@ -39,7 +39,22 @@ const router = createRouter({ ], }) -const app = createApp({}) +const app = createApp({ + template: ` +
+ + + +
+ `, +}) app.use(router) window.vm = app.mount('#app') diff --git a/e2e/scroll-behavior/index.html b/e2e/scroll-behavior/index.html index 5bcc7f53..5c3c6b59 100644 --- a/e2e/scroll-behavior/index.html +++ b/e2e/scroll-behavior/index.html @@ -28,24 +28,6 @@ << Back to Homepage
-
-

Scroll Behavior

- - - - -
+
diff --git a/e2e/scroll-behavior/index.ts b/e2e/scroll-behavior/index.ts index ff5863ba..798ee603 100644 --- a/e2e/scroll-behavior/index.ts +++ b/e2e/scroll-behavior/index.ts @@ -78,6 +78,30 @@ const app = createApp({ setupWaiter: scrollWaiter.add, } }, + + template: ` +
+

Scroll Behavior

+ + + + + + +
+ `, }) app.use(router) diff --git a/e2e/scroll-behavior/scrollWaiter.ts b/e2e/scroll-behavior/scrollWaiter.ts index 056b42c0..c8d5e746 100644 --- a/e2e/scroll-behavior/scrollWaiter.ts +++ b/e2e/scroll-behavior/scrollWaiter.ts @@ -4,7 +4,7 @@ function createScrollWaiter() { function add() { promise = new Promise(r => { - resolve = resolve + resolve = r }) } diff --git a/e2e/specs/encoding.js b/e2e/specs/encoding.js index b6a6d1d3..2b1d134f 100644 --- a/e2e/specs/encoding.js +++ b/e2e/specs/encoding.js @@ -11,9 +11,8 @@ module.exports = { 'encodes values': function(browser) { browser .url(baseURL) - // TODO: move this test to a different spec .assert.urlEquals(baseURL + '/') - .waitForElementVisible('#app', 1000) + .waitForElementPresent('#app > *', 1000) .click('li:nth-child(3) a') .assert.urlEquals(baseURL + '/documents/%E2%82%ACuro') @@ -23,11 +22,18 @@ module.exports = { // check initial visit .url(baseURL + '/documents/%E2%82%ACuro') - .waitForElementVisible('#app', 1000) + .waitForElementPresent('#app > *', 1000) .assert.containsText('#fullPath', '/documents/%E2%82%ACuro') .assert.containsText('#path', '/documents/%E2%82%ACuro') .assert.containsText('#params', JSON.stringify({ id: '€uro' }, null, 2)) + // TODO: invalid in safari, tests on those where this is valid + // .url(baseURL + '/unicode/€uro') + // .waitForElementPresent('#app > *', 1000) + // navigation to unencoded value + // depending on the browser the value will be encoded or not + // .assert.containsText('#params', JSON.stringify({ id: '€uro' }, null, 2)) + .end() }, } diff --git a/e2e/specs/hash.js b/e2e/specs/hash.js index bb8c89e9..1cbd7038 100644 --- a/e2e/specs/hash.js +++ b/e2e/specs/hash.js @@ -11,7 +11,7 @@ module.exports = { 'navigating to links': function(browser) { browser .url(baseURL) - .waitForElementVisible('#app', 1000) + .waitForElementPresent('#app > *', 1000) .assert.attributeContains('li:nth-child(1) a', 'href', '/hash/#/') .assert.attributeContains('li:nth-child(2) a', 'href', '/hash/#/foo') .assert.attributeContains('li:nth-child(3) a', 'href', '/hash/#/bar') @@ -44,16 +44,18 @@ module.exports = { /** @type {import('nightwatch').NightwatchTest} */ 'encoding on initial navigation': function(browser) { browser - .url(baseURL + '/unicode/é') - // navigation to unencoded value - // depending on the browser the value will be encoded or not - .assert.containsText('#param', 'é') .url(baseURL + '/unicode/%C3%A9') // navigation to unencoded value .assert.urlEquals(baseURL + '/unicode/%C3%A9') .assert.containsText('#path', '/unicode/%C3%A9') .assert.containsText('#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', 'é') + .end() }, } diff --git a/e2e/specs/modal.js b/e2e/specs/modal.js index 6b21853b..76cac67a 100644 --- a/e2e/specs/modal.js +++ b/e2e/specs/modal.js @@ -11,7 +11,7 @@ module.exports = { 'changes the url': function(browser) { browser .url(baseURL) - .waitForElementVisible('#app', 1000) + .waitForElementPresent('#app > *', 1000) .assert.containsText('h1', 'Home') .assert.not.visible('dialog') @@ -27,7 +27,7 @@ module.exports = { 'can close and reopen the modal through history'(browser) { browser .url(baseURL) - .waitForElementVisible('#app', 1000) + .waitForElementPresent('#app > *', 1000) .assert.containsText('h1', 'Home') .click('li:nth-child(2) button') @@ -52,7 +52,7 @@ module.exports = { 'can keep the modal when reloading'(browser) { browser .url(baseURL) - .waitForElementVisible('#app', 1000) + .waitForElementPresent('#app > *', 1000) .assert.containsText('h1', 'Home') .click('li:nth-child(2) button') @@ -73,7 +73,7 @@ module.exports = { 'can pass through the modal and then back'(browser) { browser .url(baseURL) - .waitForElementVisible('#app', 1000) + .waitForElementPresent('#app > *', 1000) .assert.containsText('h1', 'Home') .assert.not.visible('dialog') @@ -132,7 +132,7 @@ module.exports = { 'can navigate away from the modal then come back'(browser) { browser .url(baseURL) - .waitForElementVisible('#app', 1000) + .waitForElementPresent('#app > *', 1000) .assert.containsText('h1', 'Home') .click('li:nth-child(2) button') diff --git a/e2e/specs/navigation-guards.js b/e2e/specs/navigation-guards.js index ae454c92..fd1bc346 100644 --- a/e2e/specs/navigation-guards.js +++ b/e2e/specs/navigation-guards.js @@ -10,7 +10,7 @@ module.exports = { browser .url(baseURL) .assert.urlEquals(baseURL + '/') - .waitForElementVisible('#app', 1000) + .waitForElementPresent('#app > *', 1000) .click('li:nth-child(2) a') .assert.urlEquals(baseURL + '/cant-leave') .assert.containsText('#tries', '0 times') diff --git a/e2e/specs/scroll-behavior.js b/e2e/specs/scroll-behavior.js index 167da492..20d98854 100644 --- a/e2e/specs/scroll-behavior.js +++ b/e2e/specs/scroll-behavior.js @@ -13,7 +13,7 @@ module.exports = { browser .url('http://localhost:8080/scroll-behavior/') - .waitForElementVisible('#app', 1000) + .waitForElementPresent('#app > *', 1000) .assert.count('li a', 6) .assert.containsText('.view', 'home') diff --git a/e2e/specs/transitions.js b/e2e/specs/transitions.js index 292a9500..1a9af54e 100644 --- a/e2e/specs/transitions.js +++ b/e2e/specs/transitions.js @@ -10,7 +10,7 @@ module.exports = { browser .url('http://localhost:8080/transitions/') - .waitForElementVisible('#app', 1000) + .waitForElementPresent('#app > *', 1000) .click('li:nth-child(2) a') .assert.cssClassPresent('.view.home', 'fade-leave-active') diff --git a/e2e/transitions/index.html b/e2e/transitions/index.html index b7bd5e43..c94babbd 100644 --- a/e2e/transitions/index.html +++ b/e2e/transitions/index.html @@ -39,19 +39,6 @@ << Back to Homepage
-
-

Transitions

- - - - - - -
+
diff --git a/e2e/transitions/index.ts b/e2e/transitions/index.ts index c87bafc2..1074dad0 100644 --- a/e2e/transitions/index.ts +++ b/e2e/transitions/index.ts @@ -68,6 +68,23 @@ const app = createApp({ route: useRoute(), } }, + + template: ` +
+

Transitions

+ + + + + + +
+ `, }) app.use(router)