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) {
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 )
Original file line number Diff line number Diff line change 11import assert from 'assert'
22import { devices } from 'playwright'
3+ import { within } from 'codeceptjs/effects'
34
45const { event } = codeceptjs
56
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'
25
36const expect = chai . expect
47const 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
1521const siteUrl = TestHelper . siteUrl ( )
1622let wd
You can’t perform that action at this time.
0 commit comments