Skip to content

Commit 37adcba

Browse files
authored
Release 2.4.2 (#2162)
* prepared 2.4.2 release * fixed test * updates to docs
1 parent b97a98a commit 37adcba

File tree

10 files changed

+399
-235
lines changed

10 files changed

+399
-235
lines changed

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
## 2.4.2
2+
3+
* **Interactive pause improvements** by @koushikmohan1996
4+
* allows using in page objects and variables: `pause({ loginPage, a })`
5+
* enables custom commands inside pause with `=>` prefix: `=> loginPage.open()`
6+
* [Selenoid plugin](/plugins#selenoid) added by by @koushikmohan1996
7+
* uses Selenoid to launch browsers inside Docker containers
8+
* automatically **records videos** and attaches them to allure reports
9+
* can delete videos for successful tests
10+
* can automatically pull in and start Selenoid containers
11+
* works with WebDriver helper
12+
* Avoid failiure report on successful retry in worker by @koushikmohan1996
13+
* Added translation ability to Scenario, Feature and other context methods by @koushikmohan1996
14+
* 📢 Please help us translate context methods to your language! See [italian translation](https://github.com/Codeception/CodeceptJS/blob/master/translations/it-IT.js#L3) as an example and send [patches to vocabularies](https://github.com/Codeception/CodeceptJS/tree/master/translations).
15+
* allurePlugin: Added `say` comments to allure reports by @PeterNgTr.
16+
* Fixed no custom output folder created when executed with run-worker. Fix by @PeterNgTr
17+
* [Puppeteer] Fixed error description for context element not found. See #2065. Fix by @PeterNgTr
18+
19+
120
## 2.4.1
221

322
* [Hotfix] - Add missing lib that prevents codeceptjs from initializing.

docs/plugins.md

Lines changed: 135 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -531,9 +531,124 @@ Possible config options:
531531
532532
- `config`
533533
534+
## selenoid
535+
536+
[Selenoid][8] plugin automatically starts browsers and video recording.
537+
Works with WebDriver helper.
538+
539+
### Prerequisite
540+
541+
This plugin **requires Docker** to be installed.
542+
543+
> If you have issues starting Selenoid with this plugin consider using official [Configuration Manager][9] tool from Selenoid
544+
545+
### Usage
546+
547+
Selenoid plugin can be started in two ways:
548+
549+
1. **Automatic** - this plugin will create and manage selenoid container for you.
550+
2. **Manual** - you create the conatainer and configure it with a plugin (recommended).
551+
552+
#### Automatic
553+
554+
If you are new to Selenoid and you want plug and play setup use automatic mode.
555+
556+
Add plugin configuration in `codecept.conf.js`:
557+
558+
```js
559+
plugins: {
560+
selenoid: {
561+
enabled: true,
562+
deletePassed: true,
563+
autoCreate: true,
564+
autoStart: true,
565+
sessionTimeout: '30m',
566+
enableVideo: true,
567+
enableLog: true,
568+
},
569+
}
570+
```
571+
572+
When `autoCreate` is enabled it will pull the [latest Selenoid from DockerHub][10] and start Selenoid automatically.
573+
It will also create `browsers.json` file required by Selenoid.
574+
575+
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.
576+
577+
> **If you are using Windows machine or if `autoCreate` does not work properly, create container manually**
578+
579+
#### Manual
580+
581+
While this plugin can create containers for you for better control it is recommended to create and launch containers manually.
582+
This is especially useful for Continous Integration server as you can configure scaling for Selenoid containers.
583+
584+
> Use [Selenoid Configuration Manager][9] to create and start containers semi-automatically.
585+
586+
1. Create `browsers.json` file in the same directory `codecept.conf.js` is located
587+
[Refer to Selenoid documentation][11] to know more about browsers.json.
588+
589+
_Sample browsers.json_
590+
591+
```js
592+
{
593+
"chrome": {
594+
"default": "latest",
595+
"versions": {
596+
"latest": {
597+
"image": "selenoid/chrome:latest",
598+
"port": "4444",
599+
"path": "/"
600+
}
601+
}
602+
}
603+
}
604+
```
605+
606+
> It is recommended to use specific versions of browsers in `browsers.json` instead of latest. This will prevent tests fail when browsers will be updated.
607+
608+
2. Create Selenoid container
609+
610+
Run the following command to create a container. To know more [refer here][12]
611+
612+
```bash
613+
docker create \
614+
--name selenoid \
615+
-p 4444:4444 \
616+
-v /var/run/docker.sock:/var/run/docker.sock \
617+
-v `pwd`/:/etc/selenoid/:ro \
618+
-v `pwd`/output/video/:/opt/selenoid/video/ \
619+
-e OVERRIDE_VIDEO_OUTPUT_DIR=`pwd`/output/video/ \
620+
aerokube/selenoid:latest-release
621+
```
622+
623+
### Video Recording
624+
625+
This plugin allows to record and save video per each executed tests.
626+
627+
When `enableVideo` is `true` this plugin saves video in `output/videos` directory with each test by name
628+
To save space videos for all succesful tests are deleted. This can be changed by `deletePassed` option.
629+
630+
When `allure` plugin is enabled a video is attached to report automatically.
631+
632+
### Options:
633+
634+
| Param | Description |
635+
| ---------------- | ------------------------------------------------------------------------------ |
636+
| name | Name of the container (default : selenoid) |
637+
| port | Port of selenium server (default : 4444) |
638+
| autoCreate | Will automatically create container (Linux only) (default : true) |
639+
| autoStart | If disabled start the container manually before running tests (default : true) |
640+
| enableVideo | Enable video recording and use `video` folder of output (default: false) |
641+
| enableLog | Enable log recording and use `logs` folder of output (default: false) |
642+
| deletePassed | Delete video and logs of passed tests (default : true) |
643+
| additionalParams | example: `additionalParams: '--env TEST=test'` [Refer here][13] to know more |
644+
645+
### Parameters
646+
647+
- `config`
648+
534649
## stepByStepReport
535650
536-
![step-by-step-report][8]
651+
![step-by-step-report][14]
537652
538653
Generates step by step report for a test.
539654
After each step in a test a screenshot is created. After test executed screenshots are combined into slideshow.
@@ -578,7 +693,7 @@ This plugin allows to run webdriverio services like:
578693
- browserstack
579694
- appium
580695
581-
A complete list of all available services can be found on [webdriverio website][9].
696+
A complete list of all available services can be found on [webdriverio website][15].
582697
583698
###### Setup
584699
@@ -590,7 +705,7 @@ See examples below:
590705
591706
###### Selenium Standalone Service
592707
593-
Install `@wdio/selenium-standalone-service` package, as [described here][10].
708+
Install `@wdio/selenium-standalone-service` package, as [described here][16].
594709
It is important to make sure it is compatible with current webdriverio version.
595710
596711
Enable `wdio` plugin in plugins list and add `selenium-standalone` service:
@@ -609,7 +724,7 @@ Please note, this service can be used with Protractor helper as well!
609724
610725
##### Sauce Service
611726
612-
Install `@wdio/sauce-service` package, as [described here][11].
727+
Install `@wdio/sauce-service` package, as [described here][17].
613728
It is important to make sure it is compatible with current webdriverio version.
614729
615730
Enable `wdio` plugin in plugins list and add `sauce` service:
@@ -653,10 +768,22 @@ In the same manner additional services from webdriverio can be installed, enable
653768
654769
[7]: https://github.com/gotwarlost/istanbul
655770
656-
[8]: https://codecept.io/img/codeceptjs-slideshow.gif
771+
[8]: https://aerokube.com/selenoid/
772+
773+
[9]: https://aerokube.com/cm/latest/
774+
775+
[10]: https://hub.docker.com/u/selenoid
776+
777+
[11]: https://aerokube.com/selenoid/latest/#_prepare_configuration
778+
779+
[12]: https://aerokube.com/selenoid/latest/#_option_2_start_selenoid_container
780+
781+
[13]: https://docs.docker.com/engine/reference/commandline/create/
782+
783+
[14]: https://codecept.io/img/codeceptjs-slideshow.gif
657784
658-
[9]: https://webdriver.io
785+
[15]: https://webdriver.io
659786
660-
[10]: https://webdriver.io/docs/selenium-standalone-service.html
787+
[16]: https://webdriver.io/docs/selenium-standalone-service.html
661788
662-
[11]: https://webdriver.io/docs/sauce-service.html
789+
[17]: https://webdriver.io/docs/sauce-service.html

docs/puppeteer.md

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -247,51 +247,6 @@ npx codeceptjs def
247247
Mocking rules will be kept while a test is running. To stop mocking use `I.stopMocking()` command
248248

249249

250-
## Cloud Browsers
251-
252-
Puppeteer browser can be executed locally or remotely.
253-
If you want to run your tests in parallel you may face problem of maintaining infrastructure for Puppeteer tests.
254-
255-
That's why we recommend using [Aerokube Browsers](https://browsers.aerokube.com) as a fast cloud provider for browsers. At this moment, this is the only cloud provider that can launch multiple puppeteer sessions for you.
256-
257-
To start with Aerokube Browsers you need to register at [Aerokube Browsers](https://browsers.aerokube.com) and obtain a private key. Then install `aerokube-plugin`:
258-
259-
```
260-
npm i @codeceptjs/aerokube-plugin --save-dev
261-
```
262-
263-
And add this plugin to a config. Please provide Aerokube credentials in configuration:
264-
265-
```js
266-
// codecept.conf.js config
267-
exports.config = {
268-
helpers: {
269-
Puppeteer: {
270-
// regular Puppeteer config goes here
271-
// no need to change anything here
272-
}
273-
},
274-
// ....
275-
plugins: {
276-
aerokube: {
277-
// uncomment next line to permanently enable this plugin
278-
// enabled: true,
279-
require: '@codeceptjs/aerokube-plugin',
280-
user: '<username from aerokube>',
281-
password: '<password from aerokube>',
282-
}
283-
}
284-
}
285-
```
286-
287-
To launch tests and use Aerokube Browsers enable `aerokube` plugin from a command line:
288-
289-
```
290-
npx codeceptjs run --plugins aerokube
291-
```
292-
293-
> ℹ When running a browser from Aerokube it can't access your local environment or private networks. Consider using [Selenoid or Moon](https://aerokube.com) to set up a private browsers cloud.
294-
295250
## Extending
296251

297252
Puppeteer has a very [rich and flexible API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md). Sure, you can extend your test suites to use the methods listed there. CodeceptJS already prepares some objects for you and you can use them from your you helpers.

0 commit comments

Comments
 (0)