Skip to content

Commit 8707915

Browse files
committed
resolve the path in filename
1 parent baa87d0 commit 8707915

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

test/helper/webapi.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,8 @@ module.exports.tests = function () {
872872
describe('#saveScreenshot', () => {
873873
beforeEach(() => {
874874
global.output_dir = path.join(global.codecept_dir, 'output')
875+
// workaround so that we don't need to create an empty custom dir upfront
876+
global.custom_dir = global.output_dir
875877
})
876878

877879
it('should create a screenshot file in output dir', async () => {
@@ -887,21 +889,13 @@ module.exports.tests = function () {
887889
await I.saveScreenshot(`screenshot_full_${+sec}.png`, true)
888890
assert.ok(fileExists(path.join(global.output_dir, `screenshot_full_${+sec}.png`)), null, 'file does not exists')
889891
})
890-
})
891-
892-
describe('#saveScreenshotToPath', () => {
893-
beforeEach(() => {
894-
global.output_dir = path.join(global.codecept_dir, 'output')
895-
// workaround so that we don't need to create an empty custom dir upfront
896-
global.custom_dir = global.output_dir
897-
})
898892

899893
it('should create a screenshot file in custom dir', async () => {
900894
if (isHelper('TestCafe')) return
901895

902896
const sec = new Date().getUTCMilliseconds()
903897
await I.amOnPage('/')
904-
await I.saveScreenshotToPath(global.custom_dir, `screenshot_${sec}.png`)
898+
await I.saveScreenshot(path.resolve(global.custom_dir, `screenshot_${sec}.png`))
905899
assert.ok(fileExists(path.join(global.custom_dir, `screenshot_${sec}.png`)), null, 'file does not exists')
906900
})
907901
})

0 commit comments

Comments
 (0)