未验证 提交 1de5d78f 编写于 作者: J JJ Kasper 提交者: GitHub

Update i18n test (#20548)

This tweaks the new i18n query history test to address intermittent failures in CI

x-ref: https://github.com/vercel/next.js/pull/19197#issuecomment-751845314
x-ref: https://github.com/vercel/next.js/pull/19135#issuecomment-751822153
x-ref: https://github.com/vercel/next.js/pull/20379#issuecomment-751821500
上级 1203b908
...@@ -37,20 +37,29 @@ export function runTests(ctx) { ...@@ -37,20 +37,29 @@ export function runTests(ctx) {
window.next.router.asPath, window.next.router.asPath,
{ locale: 'nl' } { 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( window.next.router.push(
'/gssp?page=1' '/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()) assert.deepEqual(props, {
expect(props).toEqual({ locale: 'nl',
locale: 'nl', locales,
locales, defaultLocale: 'en-US',
defaultLocale: 'en-US', query: { page: '1' },
query: { page: '1' }, })
}) return 'success'
}, 'success')
await browser await browser
.back() .back()
...@@ -65,6 +74,7 @@ export function runTests(ctx) { ...@@ -65,6 +74,7 @@ export function runTests(ctx) {
defaultLocale: 'en-US', defaultLocale: 'en-US',
query: { page: '1' }, query: { page: '1' },
}) })
expect(await browser.eval('window.beforeNav')).toBe(1)
}) })
if (!ctx.isDev) { if (!ctx.isDev) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册