Skip to content
This repository was archived by the owner on Jan 15, 2024. It is now read-only.

Commit af2b40a

Browse files
committed
add SCREEN_SHOT env variable
1 parent 609328a commit af2b40a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
/test/mocha/results/
88
/test/nightwatch/results/
99
/test/webdriverio/results/
10+
/test/e2e/*

test/playwright/helper/mochaHooks.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ exports.mochaHooks = {
1616
const exampleFilePath = this.currentTest.parent.title.split(':')[1]
1717
return await global.page.goto(`${process.env.LAUNCH_URL}/examples/${exampleFilePath}`)
1818
},
19-
// async afterEach () {
20-
// return await global.page.screenshot({ fullPage: false, path: 'test/e2e/screenshots/' + this.currentTest.fullTitle() + '.png' })
21-
// },
19+
async afterEach () {
20+
if (process.env.SCREEN_SHOT) {
21+
const [browserType, exampleFilePath] = this.currentTest.parent.title.split(':')
22+
return await global.page.screenshot({ fullPage: false, path: 'test/playwright/screenshots/' + browserType + '/' + exampleFilePath + '.png' })
23+
}
24+
},
2225
async afterAll () {
2326
return await global.browser.close()
2427
}

0 commit comments

Comments
 (0)