Skip to content

Commit bcb1f38

Browse files
committed
refactor: Rename test config files from .js to .cjs
Renamed CommonJS config files in test/data/sandbox/configs/ to .cjs extension: - html-reporter-plugin configs (6 files) - timeout configs (4 files) - only config (1 file) Also updated test/runner/html-reporter-plugin_test.js to reference .cjs files. This fixes 'exports is not defined' errors when running tests with ESM enabled.
1 parent fdf4fab commit bcb1f38

14 files changed

+48
-148
lines changed

docs/plugins.md

Lines changed: 17 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ Consolidates JSON reports from multiple workers into a single HTML report
342342

343343
### Parameters
344344

345-
- `config`  
345+
* `config`  
346346

347347
## coverage
348348

@@ -488,72 +488,7 @@ Sample custom reporter for CodeceptJS.
488488
489489
### Parameters
490490
491-
- `config`  
492-
493-
## eachElement
494-
495-
Provides `eachElement` global function to iterate over found elements to perform actions on them.
496-
497-
`eachElement` takes following args:
498-
499-
- `purpose` - the goal of an action. A comment text that will be displayed in output.
500-
- `locator` - a CSS/XPath locator to match elements
501-
- `fn(element, index)` - **asynchronous** function which will be executed for each matched element.
502-
503-
Example of usage:
504-
505-
```js
506-
// this example works with Playwright and Puppeteer helper
507-
await eachElement('click all checkboxes', 'form input[type=checkbox]', async el => {
508-
await el.click()
509-
})
510-
```
511-
512-
Click odd elements:
513-
514-
```js
515-
// this example works with Playwright and Puppeteer helper
516-
await eachElement('click odd buttons', '.button-select', async (el, index) => {
517-
if (index % 2) await el.click()
518-
})
519-
```
520-
521-
Check all elements for visibility:
522-
523-
```js
524-
// this example works with Playwright and Puppeteer helper
525-
const assert = require('assert')
526-
await eachElement('check all items are visible', '.item', async el => {
527-
assert(await el.isVisible())
528-
})
529-
```
530-
531-
This method works with WebDriver, Playwright, Puppeteer, Appium helpers.
532-
533-
Function parameter `el` represents a matched element.
534-
Depending on a helper API of `el` can be different. Refer to API of corresponding browser testing engine for a complete API list:
535-
536-
- [Playwright ElementHandle][4]
537-
- [Puppeteer][5]
538-
- [webdriverio element][6]
539-
540-
#### Configuration
541-
542-
- `registerGlobal` - to register `eachElement` function globally, true by default
543-
544-
If `registerGlobal` is false you can use eachElement from the plugin:
545-
546-
```js
547-
const eachElement = codeceptjs.container.plugins('eachElement')
548-
```
549-
550-
### Parameters
551-
552-
- `purpose` **[string][7]** 
553-
- `locator` **CodeceptJS.LocatorOrString** 
554-
- `fn` **[Function][8]** 
555-
556-
Returns **([Promise][9]\<any> | [undefined][10])**&#x20;
491+
* `config` &#x20;
557492
558493
## enhancedRetryFailedStep
559494
@@ -564,47 +499,7 @@ to avoid conflicts and provide predictable behavior.
564499
565500
### Parameters
566501
567-
- `config` &#x20;
568-
569-
## fakerTransform
570-
571-
Use the `@faker-js/faker` package to generate fake data inside examples on your gherkin tests
572-
573-
#### Usage
574-
575-
To start please install `@faker-js/faker` package
576-
577-
npm install -D @faker-js/faker
578-
579-
<!---->
580-
581-
yarn add -D @faker-js/faker
582-
583-
Add this plugin to config file:
584-
585-
```js
586-
plugins: {
587-
fakerTransform: {
588-
enabled: true
589-
}
590-
}
591-
```
592-
593-
Add the faker API using a mustache string format inside examples tables in your gherkin scenario outline
594-
595-
```feature
596-
Scenario Outline: ...
597-
Given ...
598-
When ...
599-
Then ...
600-
Examples:
601-
| productName | customer | email | anythingMore |
602-
| {{commerce.product}} | Dr. {{name.findName}} | {{internet.email}} | staticData |
603-
```
604-
605-
### Parameters
606-
607-
- `config` &#x20;
502+
* `config` &#x20;
608503
609504
## heal
610505
@@ -634,10 +529,10 @@ HTML Reporter Plugin for CodeceptJS
634529
635530
Generates comprehensive HTML reports showing:
636531
637-
- Test statistics
638-
- Feature/Scenario details
639-
- Individual step results
640-
- Test artifacts (screenshots, etc.)
532+
* Test statistics
533+
* Feature/Scenario details
534+
* Individual step results
535+
* Test artifacts (screenshots, etc.)
641536
642537
## Configuration
643538
@@ -664,7 +559,7 @@ Generates comprehensive HTML reports showing:
664559
665560
### Parameters
666561
667-
- `config` &#x20;
562+
* `config` &#x20;
668563
669564
## pageInfo
670565
@@ -710,6 +605,10 @@ Enable it manually on each run via `-p` option:
710605
711606
npx codeceptjs run -p pauseOnFail
712607
608+
## reportData
609+
610+
TypeScript: Explicitly type reportData arrays as any\[] to avoid 'never' errors
611+
713612
## retryFailedStep
714613
715614
Retries each failed step in a test.
@@ -783,7 +682,7 @@ Safely serialize data to JSON, handling circular references
783682
784683
### Parameters
785684
786-
- `data` &#x20;
685+
* `data` &#x20;
787686
788687
## screenshotOnFail
789688
@@ -874,9 +773,10 @@ Run tests with plugin enabled:
874773
875774
* `overrideStepLimits` - whether to use timeouts set in plugin config to override step timeouts set in code with I.limitTime(x).action(...), default false
876775
877-
- `noTimeoutSteps` - an array of steps with no timeout. Default:
878-
- `amOnPage`
879-
- `wait*`
776+
* `noTimeoutSteps` - an array of steps with no timeout. Default:
777+
778+
* `amOnPage`
779+
* `wait*`
880780
881781
you could set your own noTimeoutSteps which would replace the default one.
882782

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
"@testomatio/reporter": "^2.3.1",
144144
"@types/chai": "5.2.2",
145145
"@types/inquirer": "9.0.9",
146-
"@types/node": "^24.6.2",
146+
"@types/node": "^24.9.2",
147147
"@wdio/sauce-service": "9.12.5",
148148
"@wdio/selenium-standalone-service": "8.15.0",
149149
"@wdio/utils": "9.19.2",

test/data/sandbox/configs/html-reporter-plugin/codecept-bdd.conf.js renamed to test/data/sandbox/configs/html-reporter-plugin/codecept-bdd.conf.cjs

File renamed without changes.

test/data/sandbox/configs/html-reporter-plugin/codecept-with-history.conf.js renamed to test/data/sandbox/configs/html-reporter-plugin/codecept-with-history.conf.cjs

File renamed without changes.

test/data/sandbox/configs/html-reporter-plugin/codecept-with-retries.conf.js renamed to test/data/sandbox/configs/html-reporter-plugin/codecept-with-retries.conf.cjs

File renamed without changes.

test/data/sandbox/configs/html-reporter-plugin/codecept-with-stats.conf.js renamed to test/data/sandbox/configs/html-reporter-plugin/codecept-with-stats.conf.cjs

File renamed without changes.

test/data/sandbox/configs/html-reporter-plugin/codecept-workers.conf.js renamed to test/data/sandbox/configs/html-reporter-plugin/codecept-workers.conf.cjs

File renamed without changes.

test/data/sandbox/configs/html-reporter-plugin/codecept.conf.js renamed to test/data/sandbox/configs/html-reporter-plugin/codecept.conf.cjs

File renamed without changes.
File renamed without changes.

test/data/sandbox/configs/timeouts/codecept.beforeSuiteTimeout.conf.js renamed to test/data/sandbox/configs/timeouts/codecept.beforeSuiteTimeout.conf.cjs

File renamed without changes.

0 commit comments

Comments
 (0)