Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
DavertMik committed Nov 15, 2016
1 parent d704ef7 commit 34e701f
Show file tree
Hide file tree
Showing 4 changed files with 196 additions and 2 deletions.
32 changes: 32 additions & 0 deletions docs/helpers/Nightmare.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,19 @@ Provided function should execute a passed callback (as first argument) to signal
**Parameters**

- `fn`
- `args` Examples for Vue.js.
In order to make components completely rendered we are waiting for [nextTick](https://vuejs.org/v2/api/#Vue-nextTick).```js
I.executeAsyncScript(function(done) {
Vue.nextTick(done); // waiting for next tick
})
```By passing value to `done()` function you can return values.
Additional arguments can be passed as well, while `done` function is always last parameter in arguments list.```js
let val = yield I.executeAsyncScript(function(url, done) {
// in browser context
$.ajax(url, { success: (data) => done(data); }
}, 'http://ajax.callback.url/');
```Wrapper for asynchronous [evaluate](https://github.com/segmentio/nightmare#evaluatefn-arg1-arg2).
Unlike NightmareJS implementation calling `done` will return its first argument.
## executeScript
Expand All @@ -278,6 +291,25 @@ Pass arguments to function as additional parameters.
Will return execution result to a test.
In this case you should use generator and yield to receive results.
Example with jQuery DatePicker:
```js
// change date of jQuery DatePicker
I.executeScript(function() {
// now we are inside browser context
$('date')).datetimepicker('setDate', new Date());
});
```

Can return values. Don't forget to use `yield` to get them.

```js
let date = yield I.executeScript(function(el) {
// only basic types can be returned
return $(el)).datetimepicker('getDate').toString();
}, '#date'); // passing selector
```

**Parameters**

- `fn`
Expand Down
55 changes: 53 additions & 2 deletions docs/helpers/Protractor.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,30 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
- `locator` element located by CSS|XPath|strict locator
- `sec` time seconds to wait, 1 by default

## waitForInvisible

Waits for an element to become invisible on a page (by default waits for 1sec).
Element can be located by CSS or XPath.

I.waitForInvisible('#popup');

**Parameters**

- `locator` element located by CSS|XPath|strict locator
- `sec` time seconds to wait, 1 by default

## waitForStalenessOf

Waits for an element to become not attached to the DOM on a page (by default waits for 1sec).
Element can be located by CSS or XPath.

I.waitForStalenessOf('#popup');

**Parameters**

- `locator` element located by CSS|XPath|strict locator
- `sec` time seconds to wait, 1 by default

## waitForText

Waits for a text to appear (by default waits for 1sec).
Expand Down Expand Up @@ -354,6 +378,18 @@ Provided function should execute a passed callback (as first argument) to signal
**Parameters**

- `fn`
- `args` Examples for Vue.js.
In order to make components completely rendered we are waiting for [nextTick](https://vuejs.org/v2/api/#Vue-nextTick).```js
I.executeAsyncScript(function(done) {
Vue.nextTick(done); // waiting for next tick
})
```By passing value to `done()` function you can return values.
Additional arguments can be passed as well, while `done` function is always last parameter in arguments list.```js
let val = yield I.executeAsyncScript(function(url, done) {
// in browser context
$.ajax(url, { success: (data) => done(data); }
}, 'http://ajax.callback.url/');
```
## executeScript
Expand All @@ -362,9 +398,24 @@ Pass arguments to function as additional parameters.
Will return execution result to a test.
In this case you should use generator and yield to receive results.
**Parameters**
Example with jQuery DatePicker:
- `fn`
```js
// change date of jQuery DatePicker
I.executeScript(function() {
// now we are inside browser context
$('date')).datetimepicker('setDate', new Date());
});
```

Can return values. Don't forget to use `yield` to get them.

```js
let date = yield I.executeScript(function(el) {
// only basic types can be returned
return $(el)).datetimepicker('getDate').toString();
}, '#date'); // passing selector
```

## fillField

Expand Down
56 changes: 56 additions & 0 deletions docs/helpers/SeleniumWebdriver.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ This helper should be configured in codecept.json
- `restart` - restart browser between tests (default: true), if set to false cookies will be cleaned but browser window will be kept.
- `seleniumAddress` - Selenium address to connect (default: <http://localhost:4444/wd/hub>)
- `waitForTimeout`: (optional) sets default wait time in _ms_ for all `wait*` functions. 1000 by default;
- `scriptTimeout`: (optional) sets default timeout for scripts in `executeAsync`. 1000 by default.
- `manualStart` (optional, default: false) - do not start browser before a test, start it manually inside a helper with `this.helpers["WebDriverIO"]._startBrowser()`
- `capabilities`: {} - list of [Desired Capabilities](https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities)

Expand Down Expand Up @@ -274,6 +275,18 @@ Provided function should execute a passed callback (as first argument) to signal
**Parameters**

- `fn`
- `args` Examples for Vue.js.
In order to make components completely rendered we are waiting for [nextTick](https://vuejs.org/v2/api/#Vue-nextTick).```js
I.executeAsyncScript(function(done) {
Vue.nextTick(done); // waiting for next tick
})
```By passing value to `done()` function you can return values.
Additional arguments can be passed as well, while `done` function is always last parameter in arguments list.```js
let val = yield I.executeAsyncScript(function(url, done) {
// in browser context
$.ajax(url, { success: (data) => done(data); }
}, 'http://ajax.callback.url/');
```
## executeScript
Expand All @@ -282,6 +295,25 @@ Pass arguments to function as additional parameters.
Will return execution result to a test.
In this case you should use generator and yield to receive results.
Example with jQuery DatePicker:
```js
// change date of jQuery DatePicker
I.executeScript(function() {
// now we are inside browser context
$('date')).datetimepicker('setDate', new Date());
});
```

Can return values. Don't forget to use `yield` to get them.

```js
let date = yield I.executeScript(function(el) {
// only basic types can be returned
return $(el)).datetimepicker('getDate').toString();
}, '#date'); // passing selector
```

**Parameters**

- `fn`
Expand Down Expand Up @@ -622,6 +654,30 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
- `locator` element located by CSS|XPath|strict locator
- `sec` time seconds to wait, 1 by default

## waitForInvisible

Waits for an element to become invisible on a page (by default waits for 1sec).
Element can be located by CSS or XPath.

I.waitForInvisible('#popup');

**Parameters**

- `locator` element located by CSS|XPath|strict locator
- `sec` time seconds to wait, 1 by default

## waitForStalenessOf

Waits for an element to become not attached to the DOM on a page (by default waits for 1sec).
Element can be located by CSS or XPath.

I.waitForStalenessOf('#popup');

**Parameters**

- `locator` element located by CSS|XPath|strict locator
- `sec` time seconds to wait, 1 by default

## waitForText

Waits for a text to appear (by default waits for 1sec).
Expand Down
55 changes: 55 additions & 0 deletions docs/helpers/WebDriverIO.md
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,18 @@ Provided function should execute a passed callback (as first argument) to signal
**Parameters**

- `fn`
- `args` Examples for Vue.js.
In order to make components completely rendered we are waiting for [nextTick](https://vuejs.org/v2/api/#Vue-nextTick).```js
I.executeAsyncScript(function(done) {
Vue.nextTick(done); // waiting for next tick
})
```By passing value to `done()` function you can return values.
Additional arguments can be passed as well, while `done` function is always last parameter in arguments list.```js
let val = yield I.executeAsyncScript(function(url, done) {
// in browser context
$.ajax(url, { success: (data) => done(data); }
}, 'http://ajax.callback.url/');
```
## executeScript
Expand All @@ -494,6 +506,25 @@ Pass arguments to function as additional parameters.
Will return execution result to a test.
In this case you should use generator and yield to receive results.
Example with jQuery DatePicker:
```js
// change date of jQuery DatePicker
I.executeScript(function() {
// now we are inside browser context
$('date')).datetimepicker('setDate', new Date());
});
```

Can return values. Don't forget to use `yield` to get them.

```js
let date = yield I.executeScript(function(el) {
// only basic types can be returned
return $(el)).datetimepicker('getDate').toString();
}, '#date'); // passing selector
```

**Parameters**

- `fn`
Expand Down Expand Up @@ -915,6 +946,30 @@ Element can be located by CSS or XPath.
- `locator` element located by CSS|XPath|strict locator
- `sec` time seconds to wait, 1 by default

## waitForInvisible

Waits for an element to become invisible on a page (by default waits for 1sec).
Element can be located by CSS or XPath.

I.waitForInvisible('#popup');

**Parameters**

- `locator` element located by CSS|XPath|strict locator
- `sec` time seconds to wait, 1 by default

## waitForStalenessOf

Waits for an element to become not attached to the DOM on a page (by default waits for 1sec).
Element can be located by CSS or XPath.

I.waitForStalenessOf('#popup');

**Parameters**

- `locator` element located by CSS|XPath|strict locator
- `sec` time seconds to wait, 1 by default

## waitForText

Waits for a text to appear (by default waits for 1sec).
Expand Down

0 comments on commit 34e701f

Please sign in to comment.