Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Hannes Bornö committed Jan 23, 2023
1 parent da49b50 commit b2596ca
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions test/e2e/app-dir/rsc-errors/rsc-errors.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
import {
check,
evaluate,
getRedboxHeader,
getRedboxSource,
hasRedbox,
retry,
} from 'next-test-utils'
import { createNextDescribe } from 'e2e-utils'

export async function clickEditorLinks(browser) {
return retry(
() =>
evaluate(browser, () => {
const portal = [].slice
.call(document.querySelectorAll('nextjs-portal'))
.find((p) =>
p.shadowRoot.querySelector('[data-nextjs-dialog-header]')
)
const root = portal.shadowRoot
const links = root.querySelectorAll('[data-with-open-in-editor-link]')
for (const link of links) {
link.click()
}
}),
10000,
500,
'clickEditorLinks'
)
}

if (!(globalThis as any).isNextDev) {
it('should skip tests for next-start', () => {})
} else {
Expand Down Expand Up @@ -153,10 +176,6 @@ if (!(globalThis as any).isNextDev) {
})

it('should be possible to open the import trace files in your editor', async () => {
// TODO: investigate previous error not being cleared properly
await next.stop()
await next.start()

const componentFile = 'app/editor-links/component.js'

let editorRequestsCount = 0
Expand All @@ -179,14 +198,8 @@ if (!(globalThis as any).isNextDev) {
)
)

await browser.waitForElementByCss('[data-with-open-in-editor-link]')

const collapsedFrameworkGroups = await browser.elementsByCss(
'[data-with-open-in-editor-link]'
)
for (const collapsedFrameworkButton of collapsedFrameworkGroups) {
await collapsedFrameworkButton.click()
}
expect(await hasRedbox(browser, true)).toBe(true)
await clickEditorLinks(browser)

await check(() => editorRequestsCount, /2/)

Expand Down

0 comments on commit b2596ca

Please sign in to comment.