Skip to content

Commit

Permalink
test(utils): support turbopack-based overlay error text lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj committed Mar 1, 2023
1 parent 5d48d7e commit 0bc69bf
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions test/lib/next-test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,16 +669,27 @@ export async function hasRedbox(browser, expected = true) {

export async function getRedboxHeader(browser) {
return retry(
() =>
evaluate(browser, () => {
() => {
if (shouldRunTurboDevTest()) {
const portal = [].slice
.call(document.querySelectorAll('nextjs-portal'))
.find((p) =>
p.shadowRoot.querySelector('[data-nextjs-dialog-header]')
p.shadowRoot.querySelector('[data-nextjs-turbo-dialog-body]')
)
const root = portal.shadowRoot
return root.querySelector('[data-nextjs-dialog-header]').innerText
}),
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
})
}
},
10000,
500,
'getRedboxHeader'
Expand Down

0 comments on commit 0bc69bf

Please sign in to comment.