Skip to content

Commit fd2c74a

Browse files
author
DavertMik
committed
fixed minot tests issues
1 parent b06c613 commit fd2c74a

File tree

3 files changed

+31
-10
lines changed

3 files changed

+31
-10
lines changed

lib/plugin/screenshotOnFail.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,20 @@ export default function (config) {
9696
}
9797
output.plugin('screenshotOnFail', 'Test failed, try to save a screenshot')
9898

99+
// Re-check helpers at runtime in case they weren't ready during plugin init
100+
const runtimeHelpers = Container.helpers()
101+
let runtimeHelper = null
102+
for (const helperName of supportedHelpers) {
103+
if (Object.keys(runtimeHelpers).indexOf(helperName) > -1) {
104+
runtimeHelper = runtimeHelpers[helperName]
105+
break
106+
}
107+
}
108+
109+
if (runtimeHelper && typeof runtimeHelper.saveScreenshot === 'function') {
110+
helper = runtimeHelper
111+
}
112+
99113
try {
100114
if (options.reportDir) {
101115
fileName = path.join(options.reportDir, fileName)

test/acceptance/session_test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import assert from 'assert'
22
import { devices } from 'playwright'
3+
import { within } from 'codeceptjs/effects'
34

45
const { event } = codeceptjs
56

test/helper/WebDriver_test.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
const chai = require('chai')
1+
import chai from 'chai'
2+
import path from 'path'
3+
import fs from 'fs'
4+
import { fileURLToPath } from 'url'
25

36
const expect = chai.expect
47
const assert = chai.assert
5-
const path = require('path')
6-
const fs = require('fs')
7-
8-
const TestHelper = require('../support/TestHelper')
9-
const WebDriver = require('../../lib/helper/WebDriver')
10-
const AssertionFailedError = require('../../lib/assert/error')
11-
const webApiTests = require('./webapi')
12-
const Secret = require('../../lib/secret')
13-
global.codeceptjs = require('../../lib')
8+
const __filename = fileURLToPath(import.meta.url)
9+
const __dirname = path.dirname(__filename)
10+
11+
import TestHelper from '../support/TestHelper.js'
12+
import WebDriver from '../../lib/helper/WebDriver.js'
13+
import AssertionFailedError from '../../lib/assert/error.js'
14+
import * as webApiTests from './webapi.js'
15+
import { secret as Secret } from '../../lib/secret.js'
16+
import * as codeceptjs from '../../lib/index.js'
17+
global.codeceptjs = codeceptjs
18+
19+
const dataFile = path.join(__dirname, '/../data/app/db')
1420

1521
const siteUrl = TestHelper.siteUrl()
1622
let wd

0 commit comments

Comments
 (0)