Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update i18n test #20548

Merged
merged 2 commits into from
Dec 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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