File tree Expand file tree Collapse file tree 3 files changed +31
-10
lines changed Expand file tree Collapse file tree 3 files changed +31
-10
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,20 @@ export default function (config) {
96
96
}
97
97
output . plugin ( 'screenshotOnFail' , 'Test failed, try to save a screenshot' )
98
98
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
+
99
113
try {
100
114
if ( options . reportDir ) {
101
115
fileName = path . join ( options . reportDir , fileName )
Original file line number Diff line number Diff line change 1
1
import assert from 'assert'
2
2
import { devices } from 'playwright'
3
+ import { within } from 'codeceptjs/effects'
3
4
4
5
const { event } = codeceptjs
5
6
Original file line number Diff line number Diff line change 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'
2
5
3
6
const expect = chai . expect
4
7
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' )
14
20
15
21
const siteUrl = TestHelper . siteUrl ( )
16
22
let wd
You can’t perform that action at this time.
0 commit comments