From 89e572b12ba369845fa6289535b068ceb27002a0 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Thu, 21 Jul 2022 16:09:43 -0500 Subject: [PATCH] Update query/hash test for safari (#38889) --- .../integration/production/test/index.test.js | 63 ++++++++++--------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/test/integration/production/test/index.test.js b/test/integration/production/test/index.test.js index 99c068df8862..d17ebed09b77 100644 --- a/test/integration/production/test/index.test.js +++ b/test/integration/production/test/index.test.js @@ -88,36 +88,41 @@ describe('Production Usage', () => { await browser.waitForElementByCss('.about-page') }) - it.each([ - { hash: '#hello?' }, - { hash: '#?' }, - { hash: '##' }, - { hash: '##?' }, - { hash: '##hello?' }, - { hash: '##hello' }, - { hash: '#hello?world' }, - { search: '?hello=world', hash: '#a', query: { hello: 'world' } }, - { search: '?hello', hash: '#a', query: { hello: '' } }, - { search: '?hello=', hash: '#a', query: { hello: '' } }, - ])( - 'should handle query/hash correctly during query updating $hash $search', - async ({ hash, search, query }) => { - const browser = await webdriver(appPort, `/${search || ''}${hash || ''}`) + if (process.env.BROWSER_NAME !== 'safari') { + it.each([ + { hash: '#hello?' }, + { hash: '#?' }, + { hash: '##' }, + { hash: '##?' }, + { hash: '##hello?' }, + { hash: '##hello' }, + { hash: '#hello?world' }, + { search: '?hello=world', hash: '#a', query: { hello: 'world' } }, + { search: '?hello', hash: '#a', query: { hello: '' } }, + { search: '?hello=', hash: '#a', query: { hello: '' } }, + ])( + 'should handle query/hash correctly during query updating $hash $search', + async ({ hash, search, query }) => { + const browser = await webdriver( + appPort, + `/${search || ''}${hash || ''}` + ) - await check( - () => - browser.eval('window.next.router.isReady ? "ready" : "not ready"'), - 'ready' - ) - expect(await browser.eval('window.location.pathname')).toBe('/') - expect(await browser.eval('window.location.hash')).toBe(hash || '') - expect(await browser.eval('window.location.search')).toBe(search || '') - expect(await browser.eval('next.router.pathname')).toBe('/') - expect( - JSON.parse(await browser.eval('JSON.stringify(next.router.query)')) - ).toEqual(query || {}) - } - ) + await check( + () => + browser.eval('window.next.router.isReady ? "ready" : "not ready"'), + 'ready' + ) + expect(await browser.eval('window.location.pathname')).toBe('/') + expect(await browser.eval('window.location.hash')).toBe(hash || '') + expect(await browser.eval('window.location.search')).toBe(search || '') + expect(await browser.eval('next.router.pathname')).toBe('/') + expect( + JSON.parse(await browser.eval('JSON.stringify(next.router.query)')) + ).toEqual(query || {}) + } + ) + } it('should not show target deprecation warning', () => { expect(output).not.toContain(