Update flakey app HMR tests (#43253)
We shouldn't be using arbitrary `waitFor()` and instead should use our `check` util for these tests. follow-up to https://github.com/vercel/next.js/pull/43247 x-ref: https://github.com/vercel/next.js/actions/runs/3525838483/jobs/5913081280
This commit is contained in:
parent
fa5dcbd7fa
commit
4239a669aa
1 changed files with 29 additions and 26 deletions
|
@ -1602,13 +1602,13 @@ describe('app dir', () => {
|
||||||
await next.patchFile(filePath, origContent.replace('red', 'blue'))
|
await next.patchFile(filePath, origContent.replace('red', 'blue'))
|
||||||
|
|
||||||
// Wait for HMR to trigger
|
// Wait for HMR to trigger
|
||||||
await new Promise((resolve) => setTimeout(resolve, 2000))
|
await check(
|
||||||
|
() =>
|
||||||
expect(
|
browser.eval(
|
||||||
await browser.eval(
|
|
||||||
`window.getComputedStyle(document.querySelector('h1')).color`
|
`window.getComputedStyle(document.querySelector('h1')).color`
|
||||||
|
),
|
||||||
|
'rgb(0, 0, 255)'
|
||||||
)
|
)
|
||||||
).toBe('rgb(0, 0, 255)')
|
|
||||||
} finally {
|
} finally {
|
||||||
await next.patchFile(filePath, origContent)
|
await next.patchFile(filePath, origContent)
|
||||||
}
|
}
|
||||||
|
@ -1629,14 +1629,13 @@ describe('app dir', () => {
|
||||||
try {
|
try {
|
||||||
await next.patchFile(filePath, origContent.replace('red', 'blue'))
|
await next.patchFile(filePath, origContent.replace('red', 'blue'))
|
||||||
|
|
||||||
// Wait for HMR to trigger
|
await check(
|
||||||
await new Promise((resolve) => setTimeout(resolve, 2000))
|
() =>
|
||||||
|
browser.eval(
|
||||||
expect(
|
|
||||||
await browser.eval(
|
|
||||||
`window.getComputedStyle(document.querySelector('h1')).color`
|
`window.getComputedStyle(document.querySelector('h1')).color`
|
||||||
|
),
|
||||||
|
'rgb(0, 0, 255)'
|
||||||
)
|
)
|
||||||
).toBe('rgb(0, 0, 255)')
|
|
||||||
} finally {
|
} finally {
|
||||||
await next.patchFile(filePath, origContent)
|
await next.patchFile(filePath, origContent)
|
||||||
}
|
}
|
||||||
|
@ -1836,19 +1835,23 @@ describe('app dir', () => {
|
||||||
describe('client pages', () => {
|
describe('client pages', () => {
|
||||||
it('should support global sass/scss inside client pages', async () => {
|
it('should support global sass/scss inside client pages', async () => {
|
||||||
const browser = await webdriver(next.url, '/css/sass-client/inner')
|
const browser = await webdriver(next.url, '/css/sass-client/inner')
|
||||||
await waitFor(5000)
|
|
||||||
// .sass
|
// .sass
|
||||||
expect(
|
await check(
|
||||||
await browser.eval(
|
() =>
|
||||||
|
browser.eval(
|
||||||
`window.getComputedStyle(document.querySelector('#sass-client-page')).color`
|
`window.getComputedStyle(document.querySelector('#sass-client-page')).color`
|
||||||
|
),
|
||||||
|
'rgb(245, 222, 179)'
|
||||||
)
|
)
|
||||||
).toBe('rgb(245, 222, 179)')
|
|
||||||
// .scss
|
// .scss
|
||||||
expect(
|
await check(
|
||||||
await browser.eval(
|
() =>
|
||||||
|
browser.eval(
|
||||||
`window.getComputedStyle(document.querySelector('#scss-client-page')).color`
|
`window.getComputedStyle(document.querySelector('#scss-client-page')).color`
|
||||||
|
),
|
||||||
|
'rgb(255, 99, 71)'
|
||||||
)
|
)
|
||||||
).toBe('rgb(255, 99, 71)')
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should support sass/scss modules inside client pages', async () => {
|
it('should support sass/scss modules inside client pages', async () => {
|
||||||
|
|
Loading…
Reference in a new issue