Skip to content

Commit 3c1a572

Browse files
committed
Merge branch '4.x' of https://github.com/codeceptjs/CodeceptJS into fix/esm-test-loading
2 parents 3cd9092 + 684d0ef commit 3c1a572

22 files changed

Lines changed: 273 additions & 44 deletions

File tree

.github/workflows/docker.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
echo "VERSION=$VERSION" >> $GITHUB_ENV
3030
echo "version=$VERSION" >> $GITHUB_OUTPUT
3131
32+
- name: Set up QEMU
33+
uses: docker/setup-qemu-action@v3
34+
3235
- name: Set up Docker Buildx
3336
uses: docker/setup-buildx-action@v4
3437

@@ -51,6 +54,7 @@ jobs:
5154
with:
5255
context: .
5356
push: true
57+
platforms: linux/amd64,linux/arm64
5458
tags: |
5559
${{ env.DOCKER_REPO }}:latest
5660
${{ env.DOCKER_REPO }}:${{ env.VERSION }}

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Vendored third-party bundles used by rich-text editor test fixtures
2+
test/data/app/js/

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Download Playwright and its dependencies
2-
FROM mcr.microsoft.com/playwright:v1.55.0-noble
2+
FROM mcr.microsoft.com/playwright:v1.61.0-noble
33

44
# Set non-interactive mode for apt operations
55
ENV DEBIAN_FRONTEND=noninteractive

docs/playwright.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,25 @@ Make sure `Playwright` helper is enabled in `codecept.conf.js` config:
6363
> Turn off the `show` option if you want to run test in headless mode.
6464
> If you don't specify the browser here, `chromium` will be used. Possible browsers are: `chromium`, `firefox` and `webkit`
6565
66+
To point `firefox` at a custom build instead of the bundled one, pass `executablePath` under the
67+
`firefox` key:
68+
69+
```js
70+
helpers: {
71+
Playwright: {
72+
url: "http://localhost",
73+
browser: 'firefox',
74+
firefox: {
75+
executablePath: '/path/to/firefox'
76+
}
77+
}
78+
}
79+
```
80+
81+
Useful with a build like [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
82+
patched at the source level for a realistic fingerprint, for sites that detect the default Chromium
83+
path.
84+
6685
Playwright uses different strategies to detect if a page is loaded. In configuration use `waitForNavigation` option for that:
6786

6887
When to consider navigation succeeded, defaults to `load`. Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either:

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const compat = new FlatCompat({
1414

1515
export default [
1616
{
17-
ignores: ['test/data/output', 'lib/css2xpath/*'],
17+
ignores: ['test/data/output', 'test/data/app/js/*', 'lib/css2xpath/*'],
1818
},
1919
{
2020
languageOptions: {

lib/data/context.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,13 @@ function isTableDataRow(row) {
8282
return has.call(row, 'data') && has.call(row, 'skip')
8383
}
8484

85+
function isDataTable(dataTable) {
86+
if (dataTable instanceof DataTable) return true
87+
return Boolean(dataTable) && Array.isArray(dataTable.array) && Array.isArray(dataTable.rows) && typeof dataTable.add === 'function'
88+
}
89+
8590
function detectDataType(dataTable) {
86-
if (dataTable instanceof DataTable) {
91+
if (isDataTable(dataTable)) {
8792
return dataTable.rows
8893
}
8994

lib/globals.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@ export async function initCodeceptGlobals(dir, config, container) {
3030
// pause/inject/share stay global even under noGlobals — they're the everyday
3131
// debugging/wiring entry points and have no useful import alternative for
3232
// page-object code that runs before the container is available.
33-
global.pause = async (...args) => {
34-
const pauseModule = await import('./pause.js')
35-
return (pauseModule.default || pauseModule)(...args)
36-
}
33+
const pauseModule = await import('./pause.js')
34+
global.pause = pauseModule.default || pauseModule
3735
global.inject = () => container.support()
3836
global.share = container.share
3937

lib/helper/GraphQL.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,6 @@ class GraphQL extends Helper {
5353
this.axios.defaults.headers = this.options.defaultHeaders
5454
}
5555

56-
static _checkRequirements() {
57-
try {
58-
require('axios')
59-
} catch (e) {
60-
return ['axios']
61-
}
62-
}
63-
6456
static _config() {
6557
return [
6658
{

lib/helper/GraphQLDataFactory.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,6 @@ class GraphQLDataFactory extends Helper {
174174
Object.keys(this.factories).forEach(f => (this.created[f] = []))
175175
}
176176

177-
static _checkRequirements() {
178-
try {
179-
require('axios')
180-
require('rosie')
181-
} catch (e) {
182-
return ['axios', 'rosie']
183-
}
184-
}
185-
186177
_after() {
187178
if (!this.config.cleanup) {
188179
return Promise.resolve()

lib/mocha/loadTests.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import gherkinParser, { loadTranslations } from './gherkin.js'
44
import output from '../output.js'
55
import { resolveImportModulePath } from '../utils.js'
66

7-
export default async function loadTests(mocha) {
7+
let reloadId = 0
8+
9+
export default async function loadTests(mocha, options = {}) {
810
mocha.lazyLoadFiles(true)
911

1012
const featureFiles = mocha.files.filter(file => file.match(/\.feature$/))
@@ -19,9 +21,14 @@ export default async function loadTests(mocha) {
1921

2022
for (const file of testFiles) {
2123
const resolvedPath = resolveImportModulePath(fsPath.resolve(file))
24+
const moduleUrl = new URL(resolvedPath)
25+
if (options.reload) {
26+
moduleUrl.searchParams.set('codeceptjsReload', String(++reloadId))
27+
}
28+
2229
mocha.suite.emit('pre-require', global, file, mocha)
2330
try {
24-
const module = await import(resolvedPath)
31+
const module = await import(moduleUrl.href)
2532
mocha.suite.emit('require', module, file, mocha)
2633
} catch (err) {
2734
throw enrichLoaderError(err, file)

0 commit comments

Comments
 (0)