-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
e92dadd
commit fe12de6
Showing
9 changed files
with
1,051 additions
and
29 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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
/node_modules | ||
/dist | ||
/.nyc_output | ||
/coverage | ||
.DS_Store | ||
.hass/config/www/keep-texts-in-tabs.js | ||
/test-results/ | ||
|
This file was deleted.
Oops, something went wrong.
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,31 @@ | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
import * as crypto from 'crypto'; | ||
import { test as baseTest } from '@playwright/test'; | ||
|
||
const istanbulCLIOutput = path.join(process.cwd(), '.nyc_output'); | ||
|
||
export function generateUUID(): string { | ||
return crypto.randomBytes(16).toString('hex'); | ||
} | ||
|
||
export const test = baseTest.extend({ | ||
context: async ({ context }, use) => { | ||
await context.addInitScript(() => | ||
window.addEventListener('beforeunload', () => | ||
(window as any).collectIstanbulCoverage(JSON.stringify((window as any).__coverage__)) | ||
), | ||
); | ||
await fs.promises.mkdir(istanbulCLIOutput, { recursive: true }); | ||
await context.exposeFunction('collectIstanbulCoverage', (coverageJSON: string) => { | ||
if (coverageJSON) | ||
fs.writeFileSync(path.join(istanbulCLIOutput, `playwright_coverage_${generateUUID()}.json`), coverageJSON); | ||
}); | ||
await use(context); | ||
for (const page of context.pages()) { | ||
await page.evaluate(() => (window as any).collectIstanbulCoverage(JSON.stringify((window as any).__coverage__))) | ||
} | ||
} | ||
}); | ||
|
||
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
Oops, something went wrong.