-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb6c026
commit 8d452cc
Showing
5 changed files
with
104 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
import {test as baseTest} from '@playwright/test'; | ||
|
||
const canyonOutputDirPath = path.join(process.cwd(), '.canyon_output'); | ||
|
||
export const test = baseTest.extend({ | ||
context: async ({context}, use) => { | ||
await context.addInitScript(() => | ||
window.addEventListener('beforeunload', () => | ||
(window as any).collectIstanbulCoverage((window as any).__coverage__, (window as any).__canyon__) | ||
), | ||
); | ||
await fs.promises.mkdir(canyonOutputDirPath, {recursive: true}); | ||
await context.exposeFunction('collectIstanbulCoverage', (coverageJSON, canyonJSON) => { | ||
if (coverageJSON) { | ||
fs.writeFileSync(path.join(canyonOutputDirPath, `${new Date().valueOf()}.json`), JSON.stringify({ | ||
...(canyonJSON||{}), | ||
coverage: coverageJSON | ||
})); | ||
} | ||
}); | ||
await use(context); | ||
for (const page of context.pages()) { | ||
await page.evaluate(() => (window as any).collectIstanbulCoverage((window as any).__coverage__, (window as any).__canyon__)) | ||
} | ||
} | ||
}); | ||
|
||
export const expect = test.expect; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { test, expect } from './baseFixtures'; | ||
|
||
test('has title', async ({ page }) => { | ||
await page.goto('http://localhost:3000/login'); | ||
expect(await page.title()).toBe('Rsbuild App'); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.