Unverified Commit bcf4802b authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Update some flaking tests for edge compiler and rsc (#38344)

parent 764f7d42
...@@ -25,15 +25,25 @@ describe('Edge compiler module exports preference', () => { ...@@ -25,15 +25,25 @@ describe('Edge compiler module exports preference', () => {
}) })
} }
`, `,
'node_modules/my-lib/package.json': JSON.stringify({ 'my-lib/package.json': JSON.stringify({
name: 'my-lib', name: 'my-lib',
version: '1.0.0', version: '1.0.0',
main: 'index.js', main: 'index.js',
browser: 'browser.js', browser: 'browser.js',
}), }),
'node_modules/my-lib/index.js': `module.exports = "Node.js"`, 'my-lib/index.js': `module.exports = "Node.js"`,
'node_modules/my-lib/browser.js': `module.exports = "Browser"`, 'my-lib/browser.js': `module.exports = "Browser"`,
}, },
packageJson: {
scripts: {
setup: `cp -r ./my-lib ./node_modules`,
build: 'yarn setup && next build',
dev: 'yarn setup && next dev',
start: 'next start',
},
},
startCommand: (global as any).isNextDev ? 'yarn dev' : 'yarn start',
buildCommand: 'yarn build',
dependencies: {}, dependencies: {},
}) })
}) })
......
...@@ -236,10 +236,13 @@ export default function (context, { runtime, env }) { ...@@ -236,10 +236,13 @@ export default function (context, { runtime, env }) {
expect(hasFlightRequest).toBe(false) expect(hasFlightRequest).toBe(false)
} }
await browser.elementByCss(selector).click() await browser.elementByCss(selector).click()
// wait for re-hydration // wait for re-hydration
await new Promise((res) => setTimeout(res, 1000))
if (env === 'dev') { if (env === 'dev') {
expect(hasFlightRequest).toBe(true) await check(
() => (hasFlightRequest ? 'success' : hasFlightRequest),
'success'
)
} }
const refreshText = await browser.elementByCss(selector).text() const refreshText = await browser.elementByCss(selector).text()
expect(refreshText).toBe('next link') expect(refreshText).toBe('next link')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment