Skip to content

Commit 4f3bbbd

Browse files
committed
version release prepared
1 parent 7b2d123 commit 4f3bbbd

12 files changed

+170
-186
lines changed

.hound.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
eslint:
2+
enabled: true
3+
config_file: .eslintrc.json

CHANGELOG.md

+22-1
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,40 @@
66
```js
77
// retry action once on failure
88
I.retry().see('Hello');
9+
910
// retry action 3 times on failure
1011
I.retry(3).see('Hello');
12+
1113
// retry action 3 times waiting for 0.1 second before next try
1214
I.retry({ retries: 3, minTimeout: 100 }).see('Hello');
15+
1316
// retry action 3 times waiting no more than 3 seconds for last retry
1417
I.retry({ retries: 3, maxTimeout: 3000 }).see('Hello');
15-
//
18+
19+
// retry 2 times if error with message 'Node not visible' happens
1620
I.retry({
1721
retries: 2,
1822
when: err => err.message === 'Node not visible'
1923
}).seeElement('#user');
2024
```
2125

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

2445
* Removed `yarn` call in package.json

docs/helpers/Nightmare.md

+27-16
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ I.amOnPage('/login'); // opens a login page
6666
**Parameters**
6767

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

660660
- `text`
661661

662+
## seeNumberOfElements
663+
664+
asserts that an element appears a given number of times in the DOM
665+
Element is located by label or name or CSS or XPath.
666+
667+
```js
668+
I.seeNumberOfElements('#submitBtn', 1);
669+
```
670+
671+
**Parameters**
672+
673+
- `selector`
674+
- `num`
675+
662676
## selectOption
663677

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

726740
- `sec`
727741

742+
## waitForDetached
743+
744+
Waits for an element to become not attached to the DOM on a page (by default waits for 1sec).
745+
Element can be located by CSS or XPath.
746+
747+
I.waitForDetached('#popup');
748+
749+
**Parameters**
750+
751+
- `locator` element located by CSS|XPath|strict locator
752+
- `sec` time seconds to wait, 1 by default
753+
728754
## waitForElement
729755

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

781807
- `locator` element located by CSS|XPath|strict locator
782808
- `sec` time seconds to wait, 1 by default
783-
784-
## waitUntilExists
785-
786-
Waits for element not to be present on page (by default waits for 1sec).
787-
Element can be located by CSS or XPath.
788-
789-
```js
790-
I.waitUntilExists('.btn.continue');
791-
I.waitUntilExists('.btn.continue', 5); // wait for 5 secs
792-
```
793-
794-
**Parameters**
795-
796-
- `locator` element located by CSS|XPath|strict locator
797-
- `sec` time seconds to wait, 1 by default

docs/helpers/Protractor.md

+27-33
Original file line numberDiff line numberDiff line change
@@ -474,17 +474,22 @@ assert(cookie.value, '123456');
474474
475475
- `name` Returns cookie in JSON [format](https://code.google.com/p/selenium/wiki/JsonWireProtocol#Cookie_JSON_Object).
476476
477-
## grabSource
477+
## grabNumberOfOpenTabs
478478
479-
Checks that the current page contains the given string in its raw source code.
479+
Grab number of open tabs
480480
481481
```js
482-
I.seeInSource('<h1>Green eggs &amp; ham</h1>');
482+
I.grabNumberOfOpenTabs();
483483
```
484484
485-
**Parameters**
485+
## grabSource
486486
487-
- `text`
487+
Retrieves page source and returns it to test.
488+
Resumes test execution, so should be used inside an async function.
489+
490+
```js
491+
let pageSource = await I.grabSource();
492+
```
488493
489494
## grabTextFrom
490495
@@ -571,7 +576,7 @@ I.openNewTab();
571576
## pressKey
572577
573578
Presses a key on a focused element.
574-
Speical keys like 'Enter', 'Control', [etc](https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value)
579+
Special keys like 'Enter', 'Control', [etc](https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value)
575580
will be replaced with corresponding unicode.
576581
If modifier key is used (Control, Command, Alt, Shift) in array, it will be released afterwards.
577582
@@ -874,44 +879,48 @@ I.wait(2); // wait 2 secs
874879

875880
Waits for element to become clickable for number of seconds.
876881

882+
```js
883+
I.waitForClickable('#link');
884+
```
885+
877886
**Parameters**
878887

879888
- `locator`
880889
- `sec` (optional, default `null`)
881890

882-
## waitForElement
891+
## waitForDetached
883892

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

887-
```js
888-
I.waitForElement('.btn.continue');
889-
I.waitForElement('.btn.continue', 5); // wait for 5 secs
890-
```
896+
I.waitForDetached('#popup');
891897

892898
**Parameters**
893899

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

897-
## waitForInvisible
903+
## waitForElement
898904

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

902-
I.waitForInvisible('#popup');
908+
```js
909+
I.waitForElement('.btn.continue');
910+
I.waitForElement('.btn.continue', 5); // wait for 5 secs
911+
```
903912

904913
**Parameters**
905914

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

909-
## waitForStalenessOf
918+
## waitForInvisible
910919

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

914-
I.waitForStalenessOf('#popup');
923+
I.waitForInvisible('#popup');
915924

916925
**Parameters**
917926

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

947956
- `locator` element located by CSS|XPath|strict locator
948957
- `sec` time seconds to wait, 1 by default
949-
950-
## waitUntilExists
951-
952-
Waits for element not to be present on page (by default waits for 1sec).
953-
Element can be located by CSS or XPath.
954-
955-
```js
956-
I.waitUntilExists('.btn.continue');
957-
I.waitUntilExists('.btn.continue', 5); // wait for 5 secs
958-
```
959-
960-
**Parameters**
961-
962-
- `locator` element located by CSS|XPath|strict locator
963-
- `sec` time seconds to wait, 1 by default

docs/helpers/Puppeteer.md

+34-27
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@ Requires `puppeteer` package to be installed.
1010

1111
This helper should be configured in codecept.json
1212

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

2227
```js
@@ -479,7 +484,7 @@ let hint = yield I.grabAttributeFrom('#tooltip', 'title');
479484
Get JS log from browser.
480485
481486
```js
482-
let logs = yield I.grabBrowserLogs();
487+
let logs = await I.grabBrowserLogs();
483488
console.log(JSON.stringify(logs))
484489
```
485490
@@ -524,6 +529,14 @@ let postHTML = yield I.grabHTMLFrom('#post');
524529
525530
- `locator`
526531
532+
## grabNumberOfOpenTabs
533+
534+
Grab number of open tabs
535+
536+
```js
537+
I.grabNumberOfOpenTabs();
538+
```
539+
527540
## grabNumberOfVisibleElements
528541
529542
Grab number of visible elements by locator
@@ -546,16 +559,13 @@ await I.grabPopupText();
546559
547560
## grabSource
548561
549-
Checks that the current page contains the given string in its raw source code.
562+
Retrieves page source and returns it to test.
563+
Resumes test execution, so should be used inside an async function.
550564
551565
```js
552-
I.seeInSource('<h1>Green eggs &amp; ham</h1>');
566+
let pageSource = await I.grabSource();
553567
```
554568
555-
**Parameters**
556-
557-
- `text`
558-
559569
## grabTextFrom
560570
561571
Retrieves a text from an element located by CSS or XPath and returns it to test.
@@ -632,7 +642,7 @@ I.openNewTab();
632642
## pressKey
633643
634644
Presses a key on a focused element.
635-
Speical keys like 'Enter', 'Control', [etc](https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value)
645+
Special keys like 'Enter', 'Control', [etc](https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value)
636646
will be replaced with corresponding unicode.
637647
If modifier key is used (Control, Command, Alt, Shift) in array, it will be released afterwards.
638648
@@ -1026,6 +1036,18 @@ I.wait(2); // wait 2 secs
10261036

10271037
- `sec`
10281038

1039+
## waitForDetached
1040+
1041+
Waits for an element to become not attached to the DOM on a page (by default waits for 1sec).
1042+
Element can be located by CSS or XPath.
1043+
1044+
I.waitForDetached('#popup');
1045+
1046+
**Parameters**
1047+
1048+
- `locator` element located by CSS|XPath|strict locator
1049+
- `sec` time seconds to wait, 1 by default
1050+
10291051
## waitForElement
10301052

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

1125-
## waitUntilExists
1126-
1127-
Waits for element not to be present on page (by default waits for 1sec).
1128-
Element can be located by CSS or XPath.
1129-
1130-
```js
1131-
I.waitUntilExists('.btn.continue');
1132-
I.waitUntilExists('.btn.continue', 5); // wait for 5 secs
1133-
```
1134-
1135-
**Parameters**
1136-
1137-
- `locator` element located by CSS|XPath|strict locator
1138-
- `sec` time seconds to wait, 1 by default
1139-
11401147
## waitUrlEquals
11411148

11421149
Waits for the entire URL to match the expected

0 commit comments

Comments
 (0)