Skip to content

Commit

Permalink
version release prepared
Browse files Browse the repository at this point in the history
  • Loading branch information
DavertMik committed Feb 17, 2018
1 parent 7b2d123 commit 4f3bbbd
Show file tree
Hide file tree
Showing 12 changed files with 170 additions and 186 deletions.
3 changes: 3 additions & 0 deletions .hound.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
eslint:
enabled: true
config_file: .eslintrc.json
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,40 @@
```js
// retry action once on failure
I.retry().see('Hello');

// retry action 3 times on failure
I.retry(3).see('Hello');

// retry action 3 times waiting for 0.1 second before next try
I.retry({ retries: 3, minTimeout: 100 }).see('Hello');

// retry action 3 times waiting no more than 3 seconds for last retry
I.retry({ retries: 3, maxTimeout: 3000 }).see('Hello');
//

// retry 2 times if error with message 'Node not visible' happens
I.retry({
retries: 2,
when: err => err.message === 'Node not visible'
}).seeElement('#user');
```

* `Scenario().injectDependencies` added to dynamically add objects into DI container by @Apshenkin. See [Dependency Injection section in PageObjects](https://codecept.io/pageobjects/#dependency-injection).
* Fixed using async/await functions inside `within`
* [WebDriverIO][Protractor][Puppeteer][Nightmare] **`waitUntilExists` deprecated** in favor of `waitForElement`
* [WebDriverIO][Protractor] **`waitForStalenessOf` deprecated** in favor of `waitForDetached`
* [WebDriverIO][Protractor][Puppeteer][Nightmare] `waitForDetached` added
* [Nightmare] Added `I.seeNumberOfElements()` by @pmoncadaisla
* [Nightmare] Load blank page when starting nightmare so that the .evaluate function will work if _failed/saveScreenshot is triggered by @reubenmiller
* Fixed using plain arrays for data driven tests by @reubenmiller
* [Puppeteer] Use default tab instead of opening a new tab when starting the browser by @reubenmiller
* [Puppeteer] Added `grabNumberOfTabs` function by @reubenmiller
* [Puppeteer] Add ability to set user-agent by @abidhahmed
* [Puppeteer] Add keepCookies and keepBrowserState @abidhahmed
* [Puppeteer] Clear value attribute instead of innerhtml for TEXTAREA by @reubenmiller
* [REST] fixed sending string payload by @Spartans2017
* Fixed unhandled rejection in async/await tests by @APshenkin


## 1.1.4

* Removed `yarn` call in package.json
Expand Down
43 changes: 27 additions & 16 deletions docs/helpers/Nightmare.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ I.amOnPage('/login'); // opens a login page
**Parameters**

- `url` url path or global urlIn a second argument a list of request headers can be passed:```js
I.amOnPage('/auth', [{'x-my-custom-header': 'some value'}])
I.amOnPage('/auth', { 'x-my-custom-header': 'some value' })
```
- `headers` (optional, default `null`)
Expand Down Expand Up @@ -659,6 +659,20 @@ Checks that title contains text.

- `text`

## seeNumberOfElements

asserts that an element appears a given number of times in the DOM
Element is located by label or name or CSS or XPath.

```js
I.seeNumberOfElements('#submitBtn', 1);
```

**Parameters**

- `selector`
- `num`

## selectOption

Selects an option in a drop-down select.
Expand Down Expand Up @@ -725,6 +739,18 @@ I.wait(2); // wait 2 secs

- `sec`

## waitForDetached

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.waitForDetached('#popup');

**Parameters**

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

## waitForElement

Waits for element to be present on page (by default waits for 1sec).
Expand Down Expand Up @@ -780,18 +806,3 @@ Element can be located by CSS or XPath.

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

## waitUntilExists

Waits for element not to be present on page (by default waits for 1sec).
Element can be located by CSS or XPath.

```js
I.waitUntilExists('.btn.continue');
I.waitUntilExists('.btn.continue', 5); // wait for 5 secs
```

**Parameters**

- `locator` element located by CSS|XPath|strict locator
- `sec` time seconds to wait, 1 by default
60 changes: 27 additions & 33 deletions docs/helpers/Protractor.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,17 +474,22 @@ assert(cookie.value, '123456');
- `name` Returns cookie in JSON [format](https://code.google.com/p/selenium/wiki/JsonWireProtocol#Cookie_JSON_Object).
## grabSource
## grabNumberOfOpenTabs
Checks that the current page contains the given string in its raw source code.
Grab number of open tabs
```js
I.seeInSource('<h1>Green eggs &amp; ham</h1>');
I.grabNumberOfOpenTabs();
```
**Parameters**
## grabSource
- `text`
Retrieves page source and returns it to test.
Resumes test execution, so should be used inside an async function.
```js
let pageSource = await I.grabSource();
```
## grabTextFrom
Expand Down Expand Up @@ -571,7 +576,7 @@ I.openNewTab();
## pressKey
Presses a key on a focused element.
Speical keys like 'Enter', 'Control', [etc](https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value)
Special keys like 'Enter', 'Control', [etc](https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value)
will be replaced with corresponding unicode.
If modifier key is used (Control, Command, Alt, Shift) in array, it will be released afterwards.
Expand Down Expand Up @@ -874,44 +879,48 @@ I.wait(2); // wait 2 secs

Waits for element to become clickable for number of seconds.

```js
I.waitForClickable('#link');
```

**Parameters**

- `locator`
- `sec` (optional, default `null`)

## waitForElement
## waitForDetached

Waits for element to be present on page (by default waits for 1sec).
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.

```js
I.waitForElement('.btn.continue');
I.waitForElement('.btn.continue', 5); // wait for 5 secs
```
I.waitForDetached('#popup');

**Parameters**

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

## waitForInvisible
## waitForElement

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

I.waitForInvisible('#popup');
```js
I.waitForElement('.btn.continue');
I.waitForElement('.btn.continue', 5); // wait for 5 secs
```

**Parameters**

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

## waitForStalenessOf
## waitForInvisible

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

I.waitForStalenessOf('#popup');
I.waitForInvisible('#popup');

**Parameters**

Expand Down Expand Up @@ -946,18 +955,3 @@ Element can be located by CSS or XPath.

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

## waitUntilExists

Waits for element not to be present on page (by default waits for 1sec).
Element can be located by CSS or XPath.

```js
I.waitUntilExists('.btn.continue');
I.waitUntilExists('.btn.continue', 5); // wait for 5 secs
```

**Parameters**

- `locator` element located by CSS|XPath|strict locator
- `sec` time seconds to wait, 1 by default
61 changes: 34 additions & 27 deletions docs/helpers/Puppeteer.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@ Requires `puppeteer` package to be installed.

This helper should be configured in codecept.json

- `url` - base url of website to be tested
- `show` (optional, default: false) - show Google Chrome window for debug.
- `disableScreenshots` (optional, default: false) - don't save screenshot on failure.
- `uniqueScreenshotNames` (optional, default: false) - option to prevent screenshot override if you have scenarios with the same name in different suites.
- `url`: base url of website to be tested
- `show`: (optional, default: false) - show Google Chrome window for debug.
- `restart`: (optional, default: true) - restart browser between tests.
- `disableScreenshots`: (optional, default: false) - don't save screenshot on failure.
- `uniqueScreenshotNames`: (optional, default: false) - option to prevent screenshot override if you have scenarios with the same name in different suites.
- `keepBrowserState`: (optional, default: false) - keep browser state between tests when `restart` is set to false.
- `keepCookies`: (optional, default: false) - keep cookies between tests when `restart` is set to false.
- `waitForAction`: (optional) how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
- `waitForTimeout`: (optional) default wait* timeout in ms. Default: 1000.
- `windowSize`: (optional) default window size. Set a dimension like `640x480`.
- `userAgent`: (optional) user-agent string.
- `manualStart`: (optional, default: false) - do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
- `chrome`: (optional) pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). Example

```js
Expand Down Expand Up @@ -479,7 +484,7 @@ let hint = yield I.grabAttributeFrom('#tooltip', 'title');
Get JS log from browser.
```js
let logs = yield I.grabBrowserLogs();
let logs = await I.grabBrowserLogs();
console.log(JSON.stringify(logs))
```
Expand Down Expand Up @@ -524,6 +529,14 @@ let postHTML = yield I.grabHTMLFrom('#post');
- `locator`
## grabNumberOfOpenTabs
Grab number of open tabs
```js
I.grabNumberOfOpenTabs();
```
## grabNumberOfVisibleElements
Grab number of visible elements by locator
Expand All @@ -546,16 +559,13 @@ await I.grabPopupText();
## grabSource
Checks that the current page contains the given string in its raw source code.
Retrieves page source and returns it to test.
Resumes test execution, so should be used inside an async function.
```js
I.seeInSource('<h1>Green eggs &amp; ham</h1>');
let pageSource = await I.grabSource();
```
**Parameters**
- `text`
## grabTextFrom
Retrieves a text from an element located by CSS or XPath and returns it to test.
Expand Down Expand Up @@ -632,7 +642,7 @@ I.openNewTab();
## pressKey
Presses a key on a focused element.
Speical keys like 'Enter', 'Control', [etc](https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value)
Special keys like 'Enter', 'Control', [etc](https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value)
will be replaced with corresponding unicode.
If modifier key is used (Control, Command, Alt, Shift) in array, it will be released afterwards.
Expand Down Expand Up @@ -1026,6 +1036,18 @@ I.wait(2); // wait 2 secs

- `sec`

## waitForDetached

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.waitForDetached('#popup');

**Parameters**

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

## waitForElement

Waits for element to be present on page (by default waits for 1sec).
Expand Down Expand Up @@ -1122,21 +1144,6 @@ I.waitUntil(() => window.requests == 0, 5);
- `fn`
- `sec` time seconds to wait, 1 by default

## waitUntilExists

Waits for element not to be present on page (by default waits for 1sec).
Element can be located by CSS or XPath.

```js
I.waitUntilExists('.btn.continue');
I.waitUntilExists('.btn.continue', 5); // wait for 5 secs
```

**Parameters**

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

## waitUrlEquals

Waits for the entire URL to match the expected
Expand Down
Loading

0 comments on commit 4f3bbbd

Please sign in to comment.