Skip to content

Commit 89e572b

Browse files
authored
Update query/hash test for safari (#38889)
1 parent 02c78a5 commit 89e572b

File tree

1 file changed

+34
-29
lines changed

1 file changed

+34
-29
lines changed

test/integration/production/test/index.test.js

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -88,36 +88,41 @@ describe('Production Usage', () => {
8888
await browser.waitForElementByCss('.about-page')
8989
})
9090

91-
it.each([
92-
{ hash: '#hello?' },
93-
{ hash: '#?' },
94-
{ hash: '##' },
95-
{ hash: '##?' },
96-
{ hash: '##hello?' },
97-
{ hash: '##hello' },
98-
{ hash: '#hello?world' },
99-
{ search: '?hello=world', hash: '#a', query: { hello: 'world' } },
100-
{ search: '?hello', hash: '#a', query: { hello: '' } },
101-
{ search: '?hello=', hash: '#a', query: { hello: '' } },
102-
])(
103-
'should handle query/hash correctly during query updating $hash $search',
104-
async ({ hash, search, query }) => {
105-
const browser = await webdriver(appPort, `/${search || ''}${hash || ''}`)
91+
if (process.env.BROWSER_NAME !== 'safari') {
92+
it.each([
93+
{ hash: '#hello?' },
94+
{ hash: '#?' },
95+
{ hash: '##' },
96+
{ hash: '##?' },
97+
{ hash: '##hello?' },
98+
{ hash: '##hello' },
99+
{ hash: '#hello?world' },
100+
{ search: '?hello=world', hash: '#a', query: { hello: 'world' } },
101+
{ search: '?hello', hash: '#a', query: { hello: '' } },
102+
{ search: '?hello=', hash: '#a', query: { hello: '' } },
103+
])(
104+
'should handle query/hash correctly during query updating $hash $search',
105+
async ({ hash, search, query }) => {
106+
const browser = await webdriver(
107+
appPort,
108+
`/${search || ''}${hash || ''}`
109+
)
106110

107-
await check(
108-
() =>
109-
browser.eval('window.next.router.isReady ? "ready" : "not ready"'),
110-
'ready'
111-
)
112-
expect(await browser.eval('window.location.pathname')).toBe('/')
113-
expect(await browser.eval('window.location.hash')).toBe(hash || '')
114-
expect(await browser.eval('window.location.search')).toBe(search || '')
115-
expect(await browser.eval('next.router.pathname')).toBe('/')
116-
expect(
117-
JSON.parse(await browser.eval('JSON.stringify(next.router.query)'))
118-
).toEqual(query || {})
119-
}
120-
)
111+
await check(
112+
() =>
113+
browser.eval('window.next.router.isReady ? "ready" : "not ready"'),
114+
'ready'
115+
)
116+
expect(await browser.eval('window.location.pathname')).toBe('/')
117+
expect(await browser.eval('window.location.hash')).toBe(hash || '')
118+
expect(await browser.eval('window.location.search')).toBe(search || '')
119+
expect(await browser.eval('next.router.pathname')).toBe('/')
120+
expect(
121+
JSON.parse(await browser.eval('JSON.stringify(next.router.query)'))
122+
).toEqual(query || {})
123+
}
124+
)
125+
}
121126

122127
it('should not show target deprecation warning', () => {
123128
expect(output).not.toContain(

0 commit comments

Comments
 (0)