Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,22 @@ mocha test/runner
Please try to add corresponding testcase to runner or unit.

## Running tests in Dockerized environment

Instead of manually running php, json_server and selenium for before tests you
can use `docker-compose` to run those automatically.
You can find `docker-compose.yml` file in `test` directory and run all commands
from this directory. Currently we provide following commands to run tests with
respective dependencies:

### Run unit tests
``` shell

```sh
docker-compose run --rm test-unit
```

### Run helper tests
``` shell

```sh
docker-compose run --rm test-helpers

# or pass path to helper test to run specific helper,
Expand All @@ -134,21 +137,25 @@ docker-compose run --rm test-helpers test/rest
```

### Run acceptance tests

To that we provide two separate services respectively for WebDriverIO and
Nightmare tests:
``` shell

```sh
docker-compose run --rm test-acceptance.webdriverio
docker-compose run --rm test-acceptance.nightmare
```

### Running against specific Node version

By default dockerized tests are run against node 6.9.5, you can run it against
specific version as long as there is Docker container available for such
version. To do that you need to build codecept's Docker image prior to running
tests and pass `NODE_VERSION` as build argument.

For example to prepare `test-helpers` containers based on node 8.7.0:
``` shell

```sh
docker-compose build --build-arg NODE_VERSION=8.7.0 test-helpers
```

Expand Down
2 changes: 1 addition & 1 deletion docs/acceptance.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ within({frame: [".content", "#editor"]}, () => {
I.see('Page');
});
```

---

### done()

CodeceptJS through helpers provides user friendly API to interact with a webpage. In this section we described using WebDriverIO helper which allows to control browser through Selenium WebDriver.

34 changes: 17 additions & 17 deletions docs/api/helper.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,63 @@

**Parameters**

- `config`
- `config`

## _after

Hook executed after each test

## _afterStep

Hook executed after each step

**Parameters**

- `step`

## _afterSuite

Hook executed after each suite

**Parameters**

- `suite`
- `suite`

## _before

Hook executed before each test.

## _beforeSuite
## _beforeStep

Hook executed before each step

**Parameters**

- `step`
- `step`

## _beforeSuite

Hook executed before each suite

**Parameters**

- `suite`

## _beforeSuite

Hook executed after each step

**Parameters**

- `step`
- `suite`

## _failed

Hook executed after each failed test

**Parameters**

- `test`
- `test`

## _finishTest

Hook executed after all tests are executed

**Parameters**

- `suite`
- `suite`

## _init

Expand All @@ -71,15 +71,15 @@ Executed in the very beginning of a test

**Parameters**

- `test`
- `test`

## debug

Print debug message to console (outputs only in debug mode)

**Parameters**

- `msg`
- `msg`

## helpers

Expand Down
2 changes: 1 addition & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ After running `codeceptjs init` it should be saved in test root.
Here is an overview of available options with their defaults:

* **tests**: `"./*_test.js"` - pattern to locate tests
* **include**: `{}` - actors and page objects to be registered in DI container and included in tests. Accepts objects and module `require ` paths
* **include**: `{}` - actors and page objects to be registered in DI container and included in tests. Accepts objects and module `require` paths
* **timeout**: `10000` - default tests timeout
* **output**: `"./output"` - where to store failure screenshots, etc
* **helpers**: `{}` - list of enabled helpers
Expand Down
1 change: 1 addition & 0 deletions docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ docker build -t codeception/codeceptjs .
```

### Debugging

To pass arguments to `codecept run` command inside docker image you can set
`CODECEPT_ARGS` environment variable. For example to run your tests with debug
and steps output:
Expand Down
3 changes: 1 addition & 2 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Installation

### Local
## Local

Use NPM install CodeceptJS:

Expand Down Expand Up @@ -38,7 +38,6 @@ To use it with Puppeteer install puppeteer package:
npm install puppeteer --save-dev
```


## Meta Packages

By default it doesn't install any backends like Webdriverio, Protractor, or Nightmare, so you need to install corresponding packages manually, or install one of the provided meta-packages:
Expand Down
2 changes: 1 addition & 1 deletion docs/pageobjects.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Scenario('login', (I, loginPage) => {
```

Also you can use `async/await` inside PageObject:

```js
'use strict';
let I;
Expand Down Expand Up @@ -109,7 +110,6 @@ Scenario('login2', async (I, loginPage, basePage) => {
});
```


Also you can use generators inside a PageObject:

```js
Expand Down
10 changes: 5 additions & 5 deletions docs/puppeteer.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ It operates over Google Chrome directly without requireing additional tools like

CodeceptJS uses Puppeteer to improve end to end testing experience.

1. No need to learn the syntax of a new tool, all drivers in CodeceptJS share the same API.
2. CodeceptJS can locate elements by XPath.
1. No need to learn the syntax of a new tool, all drivers in CodeceptJS share the same API.
2. CodeceptJS can locate elements by XPath.

Take a look at a sample test:

Expand All @@ -33,7 +33,6 @@ npm install -g codeceptjs-puppeteer
Or see [alternative installation options](http://codecept.io/installation/)
If you already have CodeceptJS project, just install `puppeteer` package and enable it in config.


And a basic project initialized

```sh
Expand Down Expand Up @@ -68,7 +67,7 @@ Sometimes test may run faster than application gets rendered. In this case it is

CodeceptJS test should be created with `gt` command:

```
```sh
codeceptjs gt
```

Expand Down Expand Up @@ -160,9 +159,10 @@ Puppeteer has a very [rich and flexible API](https://github.com/GoogleChrome/pup

Start with creating an `MyPuppeteer` helper using `generate:helper` or `gh` command:

```
```sh
codeceptjs gh
```

Then inside a Helper you can access `Puppeteer` helper of CodeceptJS.
Let's say you want to create `I.renderPageToPdf` action. In this case you need to call `pdf` method of `page` object

Expand Down
2 changes: 1 addition & 1 deletion lib/codecept.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Codecept {
constructor(config, opts) {
this.config = Config.create(config);
this.opts = opts;
this.testFiles = [];
this.testFiles = new Array(0);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/data/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class DataTable {
constructor(array) {
this.array = array;
this.rows = [];
this.rows = new Array(0);
}

add(array) {
Expand Down
34 changes: 18 additions & 16 deletions lib/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,63 +51,65 @@ class Helper {
* Hook provides a test details
* Executed in the very beginning of a test
*
* @param test
* @param {*} test
*/
_test() {
_test(test) {

}

/**
* Hook executed after each failed test
*
* @param test
* @param {*} test
*/
_failed() {
_failed(test) {

}

/**
* Hook executed before each step
*
* @param step
* @param {*} step
* @override
*
* _beforeStep()
*/
_beforeStep(step) {

}

/**
* Hook executed after each step
*
* @param step
* @param {*} step
* @override
*
* _afterStep()
*/
_afterStep(step) {

}

/**
* Hook executed before each suite
*
* @param suite
* @param {*} suite
*/
_beforeSuite() {
_beforeSuite(suite) {

}

/**
* Hook executed after each suite
*
* @param suite
* @param {*} suite
*/
_afterSuite() {
_afterSuite(suite) {

}

/**
* Hook executed after all tests are executed
*
* @param suite
* @param {*} suite
*/
_finishTest() {
_finishTest(suite) {

}

Expand Down
Loading