Skip to content

Commit

Permalink
Recorder range error (#3057)
Browse files Browse the repository at this point in the history
* updated docs

* optimized memory usage for non-DEBUG mode
  • Loading branch information
DavertMik committed Oct 1, 2021
1 parent 763c221 commit eb5de50
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 34 deletions.
33 changes: 9 additions & 24 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,19 @@ node bin/codecept.js run -c examples

Depending on a type of a change you should do the following.

## Debugging

To see recorder queue in logs enable NodeJS debug output by passing `DEBUG=codeceptjs:*` env variable:

```
DEBUG=codeceptjs:* npx codeceptjs run
```

## Helpers

Please keep in mind that CodeceptJS have **unified API** for Playwright, WebDriverIO, Appium, Protractor, Nightmare, Puppeteer, TestCafe. Tests written using those helpers should be compatible at syntax level. However, some of helpers may contain unique methods. That happens. If, for instance, WebDriverIO has method XXX and Nightmare doesn't, you can implement XXX inside Nightmare using the same method signature.

### Updating a WebDriver | Nightmare
### Updating Playwright | Puppeteer | WebDriver | Nightmare

*Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required! Do **not edit** `docs/helpers/`, those files are generated from docblocks in corresponding helpers! *

Expand Down Expand Up @@ -70,18 +78,6 @@ Then is should be accessible at:
http://localhost:8000/form/myexample
```

### Updating Protractor

*Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required! Do **not edit** `docs/helpers/`, those files are generated from docblocks in corresponding helpers! *

Protractor helper is based on [Protractor library](http://www.protractortest.org)

In case you do Protractor-specific change, please add a test:To run the test suite you need:

* selenium server + chromedriver

Demo application is located at: [http://davertmik.github.io/angular-demo-app](http://davertmik.github.io/angular-demo-app)

### Updating REST | ApiDataFactory

*Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required!*
Expand Down Expand Up @@ -220,14 +216,6 @@ We're currently using bunch of CI services to build and test codecept in
different environments. Here's short summary of what are differences between
separate services

#### TravisCI
Travis CI uses runs tests against Node 8 and Node 9. In total it uses 8 jobs to
build each helper against both Node versions. For every job it runs unit tests
first, then `ApiDataFactory` and `REST` tests present in `test/rest` directory.
Finally if those pass we run specific helper tests found in `test/helper`
directory. It doesn't run acceptance tests.
Config is present in `.travis.yml` file.

#### CircleCI
Here we use CodeceptJS docker image to build and execute tests inside it. We
start with building Docker container based on Dockerfile present in main project
Expand All @@ -236,6 +224,3 @@ directory. Then we run (in this order) unit tests, all helpers present in
passed so far it executes acceptance tests. For easier maintenance and local
debugging CircleCI uses `docker-compose.yml` file from `test` directory.
You can find Circle config in `.circleci` directory.

#### Semaphore
Currently Semaphore runs only Appium helper tests.
28 changes: 21 additions & 7 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,12 @@ Run single test with steps printed
npx codeceptjs run github_test.js --steps
```

Run single test in debug mode
Run single test in debug mode (see more in [debugging](#Debugging) section)

```sh
npx codeceptjs run github_test.js --debug
```

Run test with internal logs printed (global promises, and events).

```sh
npx codeceptjs run github_test.js --verbose
```

Select config file manually (`-c` or `--config` option)

```sh
Expand All @@ -80,6 +74,26 @@ npx codeceptjs run --reporter xunit

Use any of [Mocha reporters](https://github.com/mochajs/mocha/tree/master/lib/reporters) used.

#### Debugging

Run single test in debug mode

```sh
npx codeceptjs run --debug
```

Run test with internal logs printed.

```sh
npx codeceptjs run --verbose
```

Display complete debug output including scheduled promises

```
DEBUG=codeceptjs:* npx codeceptjs run
```

## Run Workers

Run tests in parallel threads.
Expand Down
8 changes: 5 additions & 3 deletions lib/recorder.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ const promiseRetry = require('promise-retry');

const { log } = require('./output');

const MAX_TASKS = 100;

let promise;
let running = false;
let errFn;
Expand Down Expand Up @@ -172,7 +174,7 @@ module.exports = {
return;
}
tasks.push(taskName);
debug(`${currentQueue()}Queued | ${taskName}`);
if (process.env.DEBUG) debug(`${currentQueue()}Queued | ${taskName}`);

return promise = Promise.resolve(promise).then((res) => {
const retryOpts = this.retries.slice(-1).pop();
Expand Down Expand Up @@ -296,7 +298,7 @@ module.exports = {
* @inner
*/
stop() {
debug(this.toString());
if (process.env.DEBUG) debug(this.toString());
log(`${currentQueue()}Stopping recording promises`);
running = false;
},
Expand All @@ -318,7 +320,7 @@ module.exports = {
* @inner
*/
scheduled() {
return tasks.join('\n');
return tasks.slice(-MAX_TASKS).join('\n');
},

/**
Expand Down

0 comments on commit eb5de50

Please sign in to comment.