Skip to content

Commit 1c8318f

Browse files
committed
fix: help_test.js
1 parent 7cb26c7 commit 1c8318f

File tree

2 files changed

+45
-41
lines changed

2 files changed

+45
-41
lines changed

docs/plugins.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ Provides `eachElement` global function to iterate over found elements to perform
551551
552552
`eachElement` takes following args:
553553
554-
- `purpose` - the goal of an action. A comment text that will be displayed in output.
554+
- `purpose` - the goal of an action. A comment text that will be displayed in output.output.
555555
- `locator` - a CSS/XPath locator to match elements
556556
- `fn(element, index)` - **asynchronous** function which will be executed for each matched element.
557557
@@ -650,11 +650,9 @@ Scenario Outline: ...
650650
651651
## heal
652652
653-
Self-healing tests with OpenAI.
653+
Self-healing tests with AI.
654654
655-
This plugin is experimental and requires OpenAI API key.
656-
657-
To use it you need to set OPENAI_API_KEY env variable and enable plugin inside the config.
655+
Read more about heaking in [Self-Healing Tests][10]
658656
659657
```js
660658
plugins: {
@@ -674,7 +672,7 @@ More config options are available:
674672
675673
## pauseOnFail
676674
677-
Automatically launches [interactive pause][10] when a test fails.
675+
Automatically launches [interactive pause][11] when a test fails.
678676
679677
Useful for debugging flaky tests on local environment.
680678
Add this plugin to config file:
@@ -857,14 +855,14 @@ Possible config options:
857855
858856
## selenoid
859857
860-
[Selenoid][11] plugin automatically starts browsers and video recording.
858+
[Selenoid][12] plugin automatically starts browsers and video recording.
861859
Works with WebDriver helper.
862860
863861
### Prerequisite
864862
865863
This plugin **requires Docker** to be installed.
866864
867-
> If you have issues starting Selenoid with this plugin consider using the official [Configuration Manager][12] tool from Selenoid
865+
> If you have issues starting Selenoid with this plugin consider using the official [Configuration Manager][13] tool from Selenoid
868866
869867
### Usage
870868
@@ -893,7 +891,7 @@ plugins: {
893891
}
894892
```
895893
896-
When `autoCreate` is enabled it will pull the [latest Selenoid from DockerHub][13] and start Selenoid automatically.
894+
When `autoCreate` is enabled it will pull the [latest Selenoid from DockerHub][14] and start Selenoid automatically.
897895
It will also create `browsers.json` file required by Selenoid.
898896
899897
In automatic mode the latest version of browser will be used for tests. It is recommended to specify exact version of each browser inside `browsers.json` file.
@@ -905,10 +903,10 @@ In automatic mode the latest version of browser will be used for tests. It is re
905903
While this plugin can create containers for you for better control it is recommended to create and launch containers manually.
906904
This is especially useful for Continous Integration server as you can configure scaling for Selenoid containers.
907905
908-
> Use [Selenoid Configuration Manager][12] to create and start containers semi-automatically.
906+
> Use [Selenoid Configuration Manager][13] to create and start containers semi-automatically.
909907
910908
1. Create `browsers.json` file in the same directory `codecept.conf.js` is located
911-
[Refer to Selenoid documentation][14] to know more about browsers.json.
909+
[Refer to Selenoid documentation][15] to know more about browsers.json.
912910
913911
_Sample browsers.json_
914912
@@ -933,7 +931,7 @@ _Sample browsers.json_
933931
934932
2. Create Selenoid container
935933
936-
Run the following command to create a container. To know more [refer here][15]
934+
Run the following command to create a container. To know more [refer here][16]
937935
938936
```bash
939937
docker create \
@@ -966,15 +964,15 @@ When `allure` plugin is enabled a video is attached to report automatically.
966964
| enableVideo | Enable video recording and use `video` folder of output (default: false) |
967965
| enableLog | Enable log recording and use `logs` folder of output (default: false) |
968966
| deletePassed | Delete video and logs of passed tests (default : true) |
969-
| additionalParams | example: `additionalParams: '--env TEST=test'` [Refer here][16] to know more |
967+
| additionalParams | example: `additionalParams: '--env TEST=test'` [Refer here][17] to know more |
970968
971969
### Parameters
972970
973971
- `config`
974972
975973
## stepByStepReport
976974
977-
![step-by-step-report][17]
975+
![step-by-step-report][18]
978976
979977
Generates step by step report for a test.
980978
After each step in a test a screenshot is created. After test executed screenshots are combined into slideshow.
@@ -1155,7 +1153,7 @@ This plugin allows to run webdriverio services like:
11551153
- browserstack
11561154
- appium
11571155
1158-
A complete list of all available services can be found on [webdriverio website][18].
1156+
A complete list of all available services can be found on [webdriverio website][19].
11591157
11601158
#### Setup
11611159
@@ -1167,7 +1165,7 @@ See examples below:
11671165
11681166
#### Selenium Standalone Service
11691167
1170-
Install `@wdio/selenium-standalone-service` package, as [described here][19].
1168+
Install `@wdio/selenium-standalone-service` package, as [described here][20].
11711169
It is important to make sure it is compatible with current webdriverio version.
11721170
11731171
Enable `wdio` plugin in plugins list and add `selenium-standalone` service:
@@ -1184,7 +1182,7 @@ plugins: {
11841182
11851183
#### Sauce Service
11861184
1187-
Install `@wdio/sauce-service` package, as [described here][20].
1185+
Install `@wdio/sauce-service` package, as [described here][21].
11881186
It is important to make sure it is compatible with current webdriverio version.
11891187
11901188
Enable `wdio` plugin in plugins list and add `sauce` service:
@@ -1232,24 +1230,26 @@ In the same manner additional services from webdriverio can be installed, enable
12321230
12331231
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined
12341232
1235-
[10]: /basics/#pause
1233+
[10]: https://codecept.io/heal/
1234+
1235+
[11]: /basics/#pause
12361236
1237-
[11]: https://aerokube.com/selenoid/
1237+
[12]: https://aerokube.com/selenoid/
12381238
1239-
[12]: https://aerokube.com/cm/latest/
1239+
[13]: https://aerokube.com/cm/latest/
12401240
1241-
[13]: https://hub.docker.com/u/selenoid
1241+
[14]: https://hub.docker.com/u/selenoid
12421242
1243-
[14]: https://aerokube.com/selenoid/latest/#_prepare_configuration
1243+
[15]: https://aerokube.com/selenoid/latest/#_prepare_configuration
12441244
1245-
[15]: https://aerokube.com/selenoid/latest/#_option_2_start_selenoid_container
1245+
[16]: https://aerokube.com/selenoid/latest/#_option_2_start_selenoid_container
12461246
1247-
[16]: https://docs.docker.com/engine/reference/commandline/create/
1247+
[17]: https://docs.docker.com/engine/reference/commandline/create/
12481248
1249-
[17]: https://codecept.io/img/codeceptjs-slideshow.gif
1249+
[18]: https://codecept.io/img/codeceptjs-slideshow.gif
12501250
1251-
[18]: https://webdriver.io
1251+
[19]: https://webdriver.io
12521252
1253-
[19]: https://webdriver.io/docs/selenium-standalone-service.html
1253+
[20]: https://webdriver.io/docs/selenium-standalone-service.html
12541254
1255-
[20]: https://webdriver.io/docs/sauce-service.html
1255+
[21]: https://webdriver.io/docs/sauce-service.html

test/runner/help_test.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,39 @@
1-
const assert = require('assert');
2-
const path = require('path');
3-
const exec = require('child_process').exec;
1+
import assert from 'assert';
2+
import { expect } from 'chai';
3+
import path, { dirname } from 'path';
4+
import { exec } from 'child_process';
5+
import { fileURLToPath } from 'url';
46

5-
const runner = path.join(__dirname, '/../../bin/codecept.js');
7+
const __dirname = dirname(fileURLToPath(import.meta.url));
8+
9+
const runner = path.join(__dirname, '../../bin/codecept.js');
610

711
describe('help option', () => {
812
it('should print help message with --help option', (done) => {
913
exec(`${runner} --help`, (err, stdout) => {
10-
stdout.should.include('Usage:');
11-
stdout.should.include('Options:');
12-
stdout.should.include('Commands:');
14+
expect(stdout).to.include('Usage:');
15+
expect(stdout).to.include('Options:');
16+
expect(stdout).to.include('Commands:');
1317
assert(!err);
1418
done();
1519
});
1620
});
1721

1822
it('should print help message with -h option', (done) => {
1923
exec(`${runner} -h`, (err, stdout) => {
20-
stdout.should.include('Usage:');
21-
stdout.should.include('Options:');
22-
stdout.should.include('Commands:');
24+
expect(stdout).to.include('Usage:');
25+
expect(stdout).to.include('Options:');
26+
expect(stdout).to.include('Commands:');
2327
assert(!err);
2428
done();
2529
});
2630
});
2731

2832
it('should print help message with no option', (done) => {
2933
exec(`${runner}`, (err, stdout) => {
30-
stdout.should.include('Usage:');
31-
stdout.should.include('Options:');
32-
stdout.should.include('Commands:');
34+
expect(stdout).to.include('Usage:');
35+
expect(stdout).to.include('Options:');
36+
expect(stdout).to.include('Commands:');
3337
assert(!err);
3438
done();
3539
});

0 commit comments

Comments
 (0)