Skip to content

Commit

Permalink
Update i18n test (#20548)
Browse files Browse the repository at this point in the history
This tweaks the new i18n query history test to address intermittent failures in CI

x-ref: #19197 (comment)
x-ref: #19135 (comment)
x-ref: #20379 (comment)
  • Loading branch information
ijjk authored Dec 28, 2020
1 parent 1203b90 commit 1de5d78
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions test/integration/i18n-support/test/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,29 @@ export function runTests(ctx) {
window.next.router.asPath,
{ locale: 'nl' }
)
})()`)

await check(() => browser.elementByCss('#router-locale').text(), 'nl')
expect(await browser.eval('window.beforeNav')).toBe(1)

await browser.eval(`(function() {
window.next.router.push(
'/gssp?page=1'
)
})()`)

await browser.waitForElementByCss('#gssp')
await check(async () => {
const html = await browser.eval('document.documentElement.innerHTML')
const props = JSON.parse(cheerio.load(html)('#props').text())

const props = JSON.parse(await browser.elementByCss('#props').text())
expect(props).toEqual({
locale: 'nl',
locales,
defaultLocale: 'en-US',
query: { page: '1' },
})
assert.deepEqual(props, {
locale: 'nl',
locales,
defaultLocale: 'en-US',
query: { page: '1' },
})
return 'success'
}, 'success')

await browser
.back()
Expand All @@ -65,6 +74,7 @@ export function runTests(ctx) {
defaultLocale: 'en-US',
query: { page: '1' },
})
expect(await browser.eval('window.beforeNav')).toBe(1)
})

if (!ctx.isDev) {
Expand Down

0 comments on commit 1de5d78

Please sign in to comment.