Skip to content

Commit 00c8675

Browse files
authored
fix(playwright): no async save video page (#4472)
* fix: no async saveVideoForPage * fix: no async saveVideoForPage * fix: code
1 parent 4618564 commit 00c8675

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/helper/Playwright.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -2396,9 +2396,9 @@ class Playwright extends Helper {
23962396
}
23972397

23982398
if (this.options.recordVideo && this.page && this.page.video()) {
2399-
test.artifacts.video = await saveVideoForPage(this.page, `${test.title}.failed`)
2399+
test.artifacts.video = saveVideoForPage(this.page, `${test.title}.failed`)
24002400
for (const sessionName in this.sessionPages) {
2401-
test.artifacts[`video_${sessionName}`] = await saveVideoForPage(
2401+
test.artifacts[`video_${sessionName}`] = saveVideoForPage(
24022402
this.sessionPages[sessionName],
24032403
`${test.title}_${sessionName}.failed`,
24042404
)
@@ -2424,9 +2424,9 @@ class Playwright extends Helper {
24242424
async _passed(test) {
24252425
if (this.options.recordVideo && this.page && this.page.video()) {
24262426
if (this.options.keepVideoForPassedTests) {
2427-
test.artifacts.video = await saveVideoForPage(this.page, `${test.title}.passed`)
2427+
test.artifacts.video = saveVideoForPage(this.page, `${test.title}.passed`)
24282428
for (const sessionName of Object.keys(this.sessionPages)) {
2429-
test.artifacts[`video_${sessionName}`] = await saveVideoForPage(
2429+
test.artifacts[`video_${sessionName}`] = saveVideoForPage(
24302430
this.sessionPages[sessionName],
24312431
`${test.title}_${sessionName}.passed`,
24322432
)
@@ -3917,7 +3917,7 @@ async function refreshContextSession() {
39173917
}
39183918
}
39193919

3920-
async function saveVideoForPage(page, name) {
3920+
function saveVideoForPage(page, name) {
39213921
if (!page.video()) return null
39223922
const fileName = `${`${global.output_dir}${pathSeparator}videos${pathSeparator}${uuidv4()}_${clearString(name)}`.slice(0, 245)}.webm`
39233923
page
@@ -3928,11 +3928,10 @@ async function saveVideoForPage(page, name) {
39283928
page
39293929
.video()
39303930
.delete()
3931-
.catch((e) => {})
3931+
.catch(() => {})
39323932
})
39333933
return fileName
39343934
}
3935-
39363935
async function saveTraceForContext(context, name) {
39373936
if (!context) return
39383937
if (!context.tracing) return

0 commit comments

Comments
 (0)