Skip to content

Commit

Permalink
Update flakey styled-components test (#44613)
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk authored Jan 5, 2023
1 parent 5f2c9d0 commit d40daaa
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions test/development/basic/styled-components-disabled.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { join } from 'path'
import webdriver from 'next-webdriver'
import { createNext, FileRef } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import { fetchViaHTTP } from 'next-test-utils'
import { check, fetchViaHTTP } from 'next-test-utils'

describe.each([
['dev', false],
Expand Down Expand Up @@ -46,21 +46,11 @@ describe.each([
// Compile /_error
await fetchViaHTTP(next.url, '/404')

try {
// Try 4 times to be sure there is no mismatch
expect(await matchLogs$(browser)).toBe(false)
await check(async () => {
await browser.refresh()
expect(await matchLogs$(browser)).toBe(false)
await browser.refresh()
expect(await matchLogs$(browser)).toBe(false)
await browser.refresh()
expect(await matchLogs$(browser)).toBe(false)
throw new Error('did not find mismatch')
} catch (err) {
// Verify that it really has the logs
// eslint-disable-next-line jest/no-try-expect
expect(await matchLogs$(browser)).toBe(true)
}
const foundLog = await matchLogs$(browser)
return foundLog ? 'success' : await browser.log('browser')
}, 'success')
} finally {
if (browser) {
await browser.close()
Expand Down

0 comments on commit d40daaa

Please sign in to comment.