Skip to content

Commit

Permalink
test(utils): update error overlay lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj committed Sep 18, 2023
1 parent 36e12a7 commit 1cd739b
Showing 1 changed file with 9 additions and 22 deletions.
31 changes: 9 additions & 22 deletions test/lib/next-test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -781,28 +781,15 @@ export async function hasRedbox(browser: BrowserInterface, expected = true) {
export async function getRedboxHeader(browser: BrowserInterface) {
return retry(
() => {
if (shouldRunTurboDevTest()) {
return evaluate(browser, () => {
const portal = [].slice
.call(document.querySelectorAll('nextjs-portal'))
.find((p) =>
p.shadowRoot.querySelector('[data-nextjs-turbo-dialog-body]')
)
const root = portal?.shadowRoot
return root?.querySelector('[data-nextjs-turbo-dialog-body]')
?.innerText
})
} else {
return evaluate(browser, () => {
const portal = [].slice
.call(document.querySelectorAll('nextjs-portal'))
.find((p) =>
p.shadowRoot.querySelector('[data-nextjs-dialog-header]')
)
const root = portal?.shadowRoot
return root?.querySelector('[data-nextjs-dialog-header]')?.innerText
})
}
return evaluate(browser, () => {
const portal = [].slice
.call(document.querySelectorAll('nextjs-portal'))
.find((p) =>
p.shadowRoot.querySelector('[data-nextjs-dialog-header]')
)
const root = portal?.shadowRoot
return root?.querySelector('[data-nextjs-dialog-header]')?.innerText
})
},
10000,
500,
Expand Down

0 comments on commit 1cd739b

Please sign in to comment.