Open lf94 opened 2 months ago
I'm going to give this a quick try, but I don't think this is something we can test, once it opens an external browser it's out of our hands.
I didn't have any luck, in case it's useful here's the code I tried
test(
'external links',
{ tag: '@electron' },
async ({ browserName }, testInfo) => {
test.skip(
browserName === 'webkit',
'Skip on Safari because `window.tearDown` does not work'
)
const { electronApp, page } = await setupElectron({
testInfo,
folderSetupFn: async (dir) => {
await fsp.mkdir(`${dir}/router-template-slate`, { recursive: true })
await fsp.copyFile(
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl',
`${dir}/router-template-slate/main.kcl`
)
},
})
await page.goto('http://localhost:3000/')
await page.setViewportSize({ width: 1200, height: 500 })
page.on('console', console.log)
await expect(page.getByTestId('user-sidebar-toggle')).toBeVisible()
await page.getByTestId('user-sidebar-toggle').click()
// await page.getByText('Request a feature').click()
const [newPage] = await Promise.all([
page.waitForEvent('popup'),
page.getByText('Request a feature').click()
])
await newPage.waitForLoadState()
// can I verify it open it in the the default browser?
// await page.waitForTimeout(5000)
await electronApp.close()
}
)
Maybe @ryanrosello-og will have an idea?
I'll have to try this locally and see the error being logged
When an external link is clicked it should start the system browser and not another electron window.
The test can click one of the following to test this:
This test may be unnecessary because the "failure" state looks like an electron window opening instead with the content, which isn't so bad. There are a lot of links in the application and it'd be high cost to maintain a test suite just for those alone.
@Irev-Dev or @jessfraz feel free to close