File size: 636 Bytes
b91e262 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | import type { Playwright } from '../../../lib/next-webdriver'
import { waitForDevToolsIndicator } from 'next-test-utils'
export async function getDevIndicatorPosition(browser: Playwright) {
// assert before eval() to prevent race condition
await waitForDevToolsIndicator(browser)
const style = await browser.eval(() => {
return (
[].slice
.call(document.querySelectorAll('nextjs-portal'))
.find((p) => p.shadowRoot.querySelector('[data-nextjs-toast]'))
// portal
?.shadowRoot?.querySelector('[data-nextjs-toast]')
?.getAttribute('style') || ''
)
})
return style || ''
}
|