Skip to content

Commit

Permalink
Ensure we only start next test until current one is cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Jul 19, 2024
1 parent 81b0e0f commit e04b0d1
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions test/development/app-hmr/hmr.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ describe(`app-dir-hmr`, () => {
})

it('should update server components after navigating to a page with a different runtime', async () => {
const envContent = await next.readFile(envFile)

const browser = await next.browser('/env/node')
await browser.loadPage(`${next.url}/env/edge`)
await browser.eval('window.__TEST_NO_RELOAD = true')
Expand Down Expand Up @@ -134,12 +132,15 @@ describe(`app-dir-hmr`, () => {
])
}
} finally {
await next.patchFile(envFile, envContent)
// TOOD: use sandbox instead
await next.patchFile(envFile, 'MY_DEVICE="mac"')
await retry(async () => {
expect(await browser.elementByCss('p').text()).toBe('mac')
})
}
})

it('should update server components pages when env files is changed (nodejs)', async () => {
const envContent = await next.readFile(envFile)
const browser = await next.browser('/env/node')
expect(await browser.elementByCss('p').text()).toBe('mac')
await next.patchFile(envFile, 'MY_DEVICE="ipad"')
Expand Down Expand Up @@ -182,12 +183,15 @@ describe(`app-dir-hmr`, () => {
)
}
} finally {
await next.patchFile(envFile, envContent)
// TOOD: use sandbox instead
await next.patchFile(envFile, 'MY_DEVICE="mac"')
await retry(async () => {
expect(await browser.elementByCss('p').text()).toBe('mac')
})
}
})

it('should update server components pages when env files is changed (edge)', async () => {
const envContent = await next.readFile(envFile)
const browser = await next.browser('/env/edge')
expect(await browser.elementByCss('p').text()).toBe('mac')
await next.patchFile(envFile, 'MY_DEVICE="ipad"')
Expand Down Expand Up @@ -230,7 +234,11 @@ describe(`app-dir-hmr`, () => {
)
}
} finally {
await next.patchFile(envFile, envContent)
// TOOD: use sandbox instead
await next.patchFile(envFile, 'MY_DEVICE="mac"')
await retry(async () => {
expect(await browser.elementByCss('p').text()).toBe('mac')
})
}
})

Expand Down

0 comments on commit e04b0d1

Please sign in to comment.