codeceptjs 2.1.3 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +125 -37
- package/README.md +15 -22
- package/bin/codecept.js +4 -1
- package/docs/acceptance.md +44 -1
- package/docs/advanced.md +1 -1
- package/docs/angular.md +6 -9
- package/docs/basics.md +388 -75
- package/docs/bdd.md +4 -3
- package/docs/best.md +1 -1
- package/docs/books.md +31 -0
- package/docs/build/Appium.js +215 -176
- package/docs/build/Nightmare.js +618 -489
- package/docs/build/Polly.js +189 -0
- package/docs/build/Protractor.js +747 -608
- package/docs/build/Puppeteer.js +914 -633
- package/docs/build/REST.js +1 -1
- package/docs/build/TestCafe.js +1835 -0
- package/docs/build/WebDriver.js +861 -805
- package/docs/build/WebDriverIO.js +616 -617
- package/docs/changelog.md +410 -316
- package/docs/commands.md +6 -6
- package/docs/community-helpers.md +2 -0
- package/docs/detox.md +235 -0
- package/docs/examples.md +23 -0
- package/docs/helpers/ApiDataFactory.md +11 -10
- package/docs/helpers/Appium.md +130 -61
- package/docs/helpers/Detox.md +579 -0
- package/docs/helpers/FileSystem.md +2 -1
- package/docs/helpers/Mochawesome.md +1 -0
- package/docs/helpers/Nightmare.md +348 -128
- package/docs/helpers/Polly.md +85 -0
- package/docs/helpers/Protractor.md +451 -184
- package/docs/helpers/Puppeteer-firefox.md +55 -0
- package/docs/helpers/Puppeteer.md +619 -183
- package/docs/helpers/REST.md +17 -16
- package/docs/helpers/SeleniumWebdriver.md +9 -8
- package/docs/helpers/TestCafe.md +1168 -0
- package/docs/helpers/WebDriver.md +600 -291
- package/docs/helpers/WebDriverIO.md +393 -278
- package/docs/helpers.md +37 -18
- package/docs/locators.md +2 -0
- package/docs/mobile-react-native-locators.md +64 -0
- package/docs/mobile.md +5 -0
- package/docs/plugins.md +54 -13
- package/docs/puppeteer.md +74 -26
- package/docs/quickstart.md +47 -12
- package/docs/react.md +67 -0
- package/docs/reports.md +1 -1
- package/docs/{webapi/_keys.mustache → shared/keys.mustache} +0 -0
- package/docs/shared/react.mustache +1 -0
- package/docs/testcafe.md +157 -0
- package/docs/videos.md +19 -0
- package/docs/webapi/amOnPage.mustache +1 -1
- package/docs/webapi/appendField.mustache +2 -2
- package/docs/webapi/attachFile.mustache +2 -2
- package/docs/webapi/checkOption.mustache +2 -2
- package/docs/webapi/clearCookie.mustache +1 -1
- package/docs/webapi/clearField.mustache +1 -1
- package/docs/webapi/click.mustache +2 -2
- package/docs/webapi/clickLink.mustache +3 -3
- package/docs/webapi/dontSee.mustache +6 -3
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +7 -1
- package/docs/webapi/dontSeeCookie.mustache +5 -1
- package/docs/webapi/dontSeeCurrentUrlEquals.mustache +6 -1
- package/docs/webapi/dontSeeElement.mustache +5 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +5 -1
- package/docs/webapi/dontSeeInCurrentUrl.mustache +1 -1
- package/docs/webapi/dontSeeInField.mustache +7 -2
- package/docs/webapi/dontSeeInSource.mustache +5 -1
- package/docs/webapi/dontSeeInTitle.mustache +5 -1
- package/docs/webapi/doubleClick.mustache +2 -2
- package/docs/webapi/downloadFile.mustache +2 -2
- package/docs/webapi/dragAndDrop.mustache +2 -2
- package/docs/webapi/dragSlider.mustache +2 -2
- package/docs/webapi/executeAsyncScript.mustache +1 -1
- package/docs/webapi/executeScript.mustache +1 -1
- package/docs/webapi/fillField.mustache +2 -2
- package/docs/webapi/grabAttributeFrom.mustache +3 -2
- package/docs/webapi/grabBrowserLogs.mustache +3 -1
- package/docs/webapi/grabCookie.mustache +2 -1
- package/docs/webapi/grabCssPropertyFrom.mustache +3 -2
- package/docs/webapi/grabCurrentUrl.mustache +3 -1
- package/docs/webapi/grabDataFromPerformanceTiming.mustache +19 -0
- package/docs/webapi/grabHTMLFrom.mustache +2 -1
- package/docs/webapi/grabNumberOfOpenTabs.mustache +4 -2
- package/docs/webapi/grabNumberOfVisibleElements.mustache +3 -2
- package/docs/webapi/grabPageScrollPosition.mustache +3 -1
- package/docs/webapi/grabSource.mustache +3 -1
- package/docs/webapi/grabTextFrom.mustache +2 -1
- package/docs/webapi/grabTitle.mustache +3 -1
- package/docs/webapi/grabValueFrom.mustache +2 -1
- package/docs/webapi/moveCursorTo.mustache +3 -3
- package/docs/webapi/pressKey.mustache +1 -1
- package/docs/webapi/resizeWindow.mustache +2 -2
- package/docs/webapi/rightClick.mustache +2 -2
- package/docs/webapi/saveScreenshot.mustache +3 -3
- package/docs/webapi/say.mustache +2 -2
- package/docs/webapi/scrollPageToBottom.mustache +1 -1
- package/docs/webapi/scrollPageToTop.mustache +1 -1
- package/docs/webapi/scrollTo.mustache +3 -3
- package/docs/webapi/see.mustache +2 -2
- package/docs/webapi/seeAttributesOnElements.mustache +3 -3
- package/docs/webapi/seeCheckboxIsChecked.mustache +2 -1
- package/docs/webapi/seeCookie.mustache +1 -1
- package/docs/webapi/seeCssPropertiesOnElements.mustache +2 -2
- package/docs/webapi/seeCurrentUrlEquals.mustache +1 -1
- package/docs/webapi/seeElement.mustache +1 -1
- package/docs/webapi/seeElementInDOM.mustache +1 -1
- package/docs/webapi/seeInCurrentUrl.mustache +1 -1
- package/docs/webapi/seeInField.mustache +2 -2
- package/docs/webapi/seeInSource.mustache +1 -1
- package/docs/webapi/seeInTitle.mustache +5 -1
- package/docs/webapi/seeNumberOfElements.mustache +10 -0
- package/docs/webapi/seeNumberOfVisibleElements.mustache +2 -2
- package/docs/webapi/selectOption.mustache +2 -2
- package/docs/webapi/setCookie.mustache +1 -1
- package/docs/webapi/switchTo.mustache +6 -1
- package/docs/webapi/uncheckOption.mustache +2 -2
- package/docs/webapi/wait.mustache +1 -2
- package/docs/webapi/waitForDetached.mustache +3 -3
- package/docs/webapi/waitForElement.mustache +2 -2
- package/docs/webapi/waitForEnabled.mustache +1 -1
- package/docs/webapi/waitForFunction.mustache +3 -3
- package/docs/webapi/waitForInvisible.mustache +3 -3
- package/docs/webapi/waitForText.mustache +3 -3
- package/docs/webapi/waitForValue.mustache +3 -3
- package/docs/webapi/waitForVisible.mustache +3 -3
- package/docs/webapi/waitInUrl.mustache +2 -2
- package/docs/webapi/waitNumberOfVisibleElements.mustache +3 -3
- package/docs/webapi/waitToHide.mustache +3 -3
- package/docs/webapi/waitUntil.mustache +3 -3
- package/docs/webapi/waitUrlEquals.mustache +2 -2
- package/docs/webdriver.md +453 -0
- package/lib/codecept.js +11 -9
- package/lib/command/definitions.js +183 -30
- package/lib/command/gherkin/snippets.js +29 -9
- package/lib/command/init.js +31 -9
- package/lib/command/run-multiple.js +46 -59
- package/lib/command/utils.js +1 -1
- package/lib/container.js +30 -4
- package/lib/data/dataScenarioConfig.js +18 -0
- package/lib/helper/Appium.js +24 -24
- package/lib/helper/Nightmare.js +81 -84
- package/lib/helper/Polly.js +189 -0
- package/lib/helper/Protractor.js +96 -86
- package/lib/helper/Puppeteer.js +238 -113
- package/lib/helper/REST.js +1 -1
- package/lib/helper/TestCafe.js +1257 -0
- package/lib/helper/WebDriver.js +217 -277
- package/lib/helper/WebDriverIO.js +75 -75
- package/lib/helper/clientscripts/nightmare.js +8 -0
- package/lib/helper/extras/React.js +55 -0
- package/lib/helper/testcafe/testControllerHolder.js +42 -0
- package/lib/helper/testcafe/testcafe-utils.js +63 -0
- package/lib/history.js +39 -0
- package/lib/hooks.js +25 -1
- package/lib/interfaces/gherkin.js +17 -1
- package/lib/interfaces/scenarioConfig.js +2 -2
- package/lib/listener/config.js +3 -3
- package/lib/locator.js +6 -0
- package/lib/pause.js +22 -1
- package/lib/plugin/allure.js +63 -0
- package/lib/plugin/autoLogin.js +65 -16
- package/lib/plugin/puppeteerCoverage.js +6 -1
- package/lib/plugin/stepByStepReport.js +4 -3
- package/lib/scenario.js +23 -17
- package/lib/step.js +5 -2
- package/lib/ui.js +1 -1
- package/lib/utils.js +70 -20
- package/package.json +20 -19
- package/translations/de-DE.js +69 -0
- package/translations/index.js +1 -0
- package/docs/video.md +0 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,95 @@
|
|
|
1
|
+
## 2.2.1
|
|
2
|
+
|
|
3
|
+
* [WebDriver] A [dedicated guide](https://codecept.io/webdriver) written.
|
|
4
|
+
* [TestCade] A [dedicated guide](https://codecept.io/testcafe) written.
|
|
5
|
+
* [Puppeteer] A [chapter on mocking](https://codecept.io/puppeteer#mocking-requests) written
|
|
6
|
+
* [Puppeteer][Nightmare][TestCafe] Window mode is enabled by default on `codeceptjs init`.
|
|
7
|
+
* [TestCafe] Actions implemented by @hubidu
|
|
8
|
+
* `grabPageScrollPosition`
|
|
9
|
+
* `scrollPageToTop`
|
|
10
|
+
* `scrollPageToBottom`
|
|
11
|
+
* `scrollTo`
|
|
12
|
+
* `switchTo`
|
|
13
|
+
* Intellisense improvements. Renamed `tsconfig.json` to `jsconfig.json` on init. Fixed autocompletion for Visual Studio Code.
|
|
14
|
+
* [Polly] Take configuration values from Puppeteer. Fix #1766 by @VikalpP
|
|
15
|
+
* [Polly] Add preconditions to check for puppeteer page availability by @VikalpP. Fixes #1767
|
|
16
|
+
* [WebDriver] Use filename for `uploadFile` by @VikalpP. See #1797
|
|
17
|
+
* [Puppeteer] Configure speed of input with `pressKeyDelay` option. By @hubidu
|
|
18
|
+
* Fixed recursive loading of support objects by @davertmik.
|
|
19
|
+
* Fixed support object definitions in steps.d.ts by @johnyb. Fixes #1795
|
|
20
|
+
* Fixed `Data().Scenario().injectDependencies()` is not a function by @andrerleao
|
|
21
|
+
* Fixed crash when using xScenario & Scenario.skip with tag by @VikalpP. Fixes #1751
|
|
22
|
+
* Dynamic configuration of helpers can be performed with async function. See #1786 by @cviejo
|
|
23
|
+
* Added TS definitions for internal objects by @Vorobeyko
|
|
24
|
+
* BDD improvements:
|
|
25
|
+
* Fix for snippets command with a .feature file that has special characters by @asselin
|
|
26
|
+
* Fix `--path` option on `gherkin:snippets` command by @asselin. See #1790
|
|
27
|
+
* Added `--feature` option to `gherkin:snippets` to enable creating snippets for a subset of .feature files. See #1803 by @asselin.
|
|
28
|
+
* Fixed: dynamic configs not reset after test. Fixes #1776 by @cviejo.
|
|
29
|
+
|
|
30
|
+
## 2.2.0
|
|
31
|
+
|
|
32
|
+
* **EXPERIMENTAL** [**TestCafe** helper](https://codecept.io/helpers/TestCafe) introduced. TestCafe allows to run cross-browser tests it its own very fast engine. Supports all browsers including mobile. Thanks to @hubidu for implementation! Please test it and send us feedback.
|
|
33
|
+
* [Puppeteer] Mocking requests enabled by introducing [Polly.js helper](https://codecept.io/helpers/Polly). Thanks @VikalpP
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
// use Polly & Puppeteer helpers
|
|
37
|
+
I.mockRequest('GET', '/api/users', 200);
|
|
38
|
+
I.mockRequest('POST', '/users', { user: { name: 'fake' }});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
* **EXPERIMENTAL** [Puppeteer] [Firefox support](https://codecept.io/helpers/Puppeteer-firefox) introduced by @ngadiyak, see #1740
|
|
42
|
+
* [stepByStepReportPlugin] use md5 hash to generate reports into unique folder. Fix #1744 by @chimurai
|
|
43
|
+
* Interactive pause improvements:
|
|
44
|
+
* print result of `grab` commands
|
|
45
|
+
* print message for successful assertions
|
|
46
|
+
* `run-multiple` (parallel execution) improvements:
|
|
47
|
+
* `bootstrapAll` must be called before creating chunks. #1741 by @Vorobeyko
|
|
48
|
+
* Bugfix: If value in config has falsy value then multiple config does not overwrite original value. #1756 by @LukoyanovE
|
|
49
|
+
* Fixed hooks broken in 2.1.5 by @Vorobeyko
|
|
50
|
+
* Fix references to support objects when using Dependency Injection. Fix by @johnyb. See #1701
|
|
51
|
+
* Fix dynamic config applied for multiple helpers by @VikalpP #1743
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## 2.1.5
|
|
55
|
+
|
|
56
|
+
* **EXPERIMENTAL** [Wix Detox support](https://github.com/Codeception/detox-helper) introduced as standalone helper. Provides a faster alternative to Appium for mobile testing.
|
|
57
|
+
* Saving successful commands inside interactive pause into `_output/cli-history` file. By @hubidu
|
|
58
|
+
* Fixed hanging error handler inside scenario. See #1721 by @haily-lgc.
|
|
59
|
+
* Fixed by @Vorobeyko: tests did not fail when an exception was raised in async bootstrap.
|
|
60
|
+
* [WebDriver] Added window control methods by @emmonspired
|
|
61
|
+
* `grabAllWindowHandles` returns all window handles
|
|
62
|
+
* `grabCurrentWindowHandle` returns current window handle
|
|
63
|
+
* `switchToWindow` switched to window by its handle
|
|
64
|
+
* [Appium] Fixed using `host` as configuration by @trinhpham
|
|
65
|
+
* Fixed `run-multiple` command when `tests` config option is undefined (in Gherkin scenarios). By @gkushang.
|
|
66
|
+
* German translation introduced by @hubidu
|
|
67
|
+
|
|
68
|
+
## 2.1.4
|
|
69
|
+
|
|
70
|
+
* [WebDriver][Puppeteer][Protractor][Nightmare] A11y locator support introduced by @Holorium. Clickable elements as well as fields can be located by following attributes:
|
|
71
|
+
* `aria-label`
|
|
72
|
+
* `title`
|
|
73
|
+
* `aria-labelledby`
|
|
74
|
+
* [Puppeteer] Added support for React locators.
|
|
75
|
+
* New [React Guide](https://codecept.io/react) added.
|
|
76
|
+
* [Puppeteer] Deprecated `downloadFile`
|
|
77
|
+
* [Puppeteer] Introduced `handleDownloads` replacing `downloadFile`
|
|
78
|
+
* [puppeteerCoverage plugin] Fixed path already exists error by @seta-tuha.
|
|
79
|
+
* Fixed 'ERROR: ENAMETOOLONG' creating directory names in `run-multiple` with long config. By @artvinn
|
|
80
|
+
* [REST] Fixed url autocompletion combining base and relative paths by @LukoyanovE
|
|
81
|
+
* [Nightmare][Protractor] `uncheckOption` method introduced by @PeterNgTr
|
|
82
|
+
* [autoLogin plugin] Enable to use without `await` by @tsuemura
|
|
83
|
+
* [Puppeteer] Fixed `UnhandledPromiseRejectionWarning: "Execution context was destroyed...` by @adrielcodeco
|
|
84
|
+
* [WebDriver] Keep browser window dimensions when starting a new session by @spiroid
|
|
85
|
+
* Replace Ghekrin plceholders with values in files that combine a scenerio outline and table by @medtoure18.
|
|
86
|
+
* Added Documentation to [locate elements in React Native](https://codecept.io/mobile-react-native-locators) apps. By @DimGun.
|
|
87
|
+
* Adding optional `path` parameter to `bdd:snippets` command to append snippets to a specific file. By @cthorsen31.
|
|
88
|
+
* Added optional `output` parameter to `def` command by @LukoyanovE.
|
|
89
|
+
* [Puppeteer] Added `grabDataFromPerformanceTiming` by @PeterNgTr.
|
|
90
|
+
* axios updated to `0.19.0` by @SteveShaffer
|
|
91
|
+
* TypeScript defitions updated by @LukoyanovE. Added `secret` and `inject` function.
|
|
92
|
+
|
|
1
93
|
## 2.1.3
|
|
2
94
|
|
|
3
95
|
* Fixed autoLogin plugin to inject `login` function
|
|
@@ -32,7 +124,7 @@ const myPage = require('../page/myPage');
|
|
|
32
124
|
const { I, myPage } = inject();
|
|
33
125
|
```
|
|
34
126
|
|
|
35
|
-
* Added global `secret` function to fill in sensitive data
|
|
127
|
+
* Added global `secret` function to fill in sensitive data. By @RohanHart:
|
|
36
128
|
|
|
37
129
|
```js
|
|
38
130
|
I.fillField('password', secret('123456'));
|
|
@@ -53,7 +145,7 @@ I.fillField('password', secret('123456'));
|
|
|
53
145
|
* [autoLoginPlugin] Fixed using async functions for auto login by @nitschSB
|
|
54
146
|
|
|
55
147
|
> This release was partly sponsored by @GSasu. Thanks for the support!
|
|
56
|
-
Do you want to improve this project? [Learn more about
|
|
148
|
+
Do you want to improve this project? [Learn more about sponsorin CodeceptJS
|
|
57
149
|
|
|
58
150
|
|
|
59
151
|
## 2.0.8
|
|
@@ -125,7 +217,7 @@ Use it with `FileSystem` helper to test availability of a file:
|
|
|
125
217
|
* [allure plugin] Add skipped tests to allure reports by @Vorobeyko
|
|
126
218
|
* Fixed `Logged Test name | [object Object]` when used Data().Scenario(). By @Vorobeyko
|
|
127
219
|
* Fixed Data().only.Scenario() to run for all datasets. By @Vorobeyko
|
|
128
|
-
* [WebDriver] `attachFile` to work with hidden elements. Fixed in
|
|
220
|
+
* [WebDriver] `attachFile` to work with hidden elements. Fixed in #1460 by @tsuemura
|
|
129
221
|
|
|
130
222
|
|
|
131
223
|
|
|
@@ -210,12 +302,12 @@ I.say('This is by default'); //cyan is used
|
|
|
210
302
|
|
|
211
303
|
* [Puppeteer] `dragSlider` action added by @PeterNgTr
|
|
212
304
|
* [Puppeteer] Fixed opening browser in shell mode by @allenhwkim
|
|
213
|
-
* [Puppeteer] Fixed making screenshot on additional sessions by @PeterNgTr. Fixes
|
|
305
|
+
* [Puppeteer] Fixed making screenshot on additional sessions by @PeterNgTr. Fixes #1266
|
|
214
306
|
* Added `--invert` option to `run-multiple` command by @LukoyanovE
|
|
215
307
|
* Fixed steps in Allure reports by @PeterNgTr
|
|
216
308
|
* Add option `output` to customize output directory in [stepByStepReport plugin](https://codecept.io/plugins/#stepbystepreport). By @fpsthirty
|
|
217
309
|
* Changed type definition of PageObjects to get auto completion by @rhicu
|
|
218
|
-
* Fixed steps output for async/arrow functions in CLI by @LukoyanovE. See
|
|
310
|
+
* Fixed steps output for async/arrow functions in CLI by @LukoyanovE. See #1329
|
|
219
311
|
|
|
220
312
|
## 1.4.5
|
|
221
313
|
|
|
@@ -228,7 +320,7 @@ I.say('This is by default'); //cyan is used
|
|
|
228
320
|
```
|
|
229
321
|
|
|
230
322
|
* [WebDriverIO] Fix timeouts definition to be compatible with W3C drivers. By @LukoyanovE
|
|
231
|
-
* Fixed: exception in Before block w/ Mocha causes test not to report failure. See
|
|
323
|
+
* Fixed: exception in Before block w/ Mocha causes test not to report failure. See #1292 by @PeterNgTr
|
|
232
324
|
* Command `run-parallel` now accepts `--override` flag. Thanks to @ClemCB
|
|
233
325
|
* Fixed Allure report with Before/BeforeSuite/After/AfterSuite steps. By @PeterNgTr
|
|
234
326
|
* Added `RUN_MULTIPLE` env variable to [Docker config](https://codecept.io/docker/). Allows to run tests in parallel inside a container. Thanks to @PeterNgTr
|
|
@@ -259,7 +351,7 @@ Scenario('update user profile', () => {
|
|
|
259
351
|
|
|
260
352
|
* Fixed attaching Allure screenshot on exception. Fix by @DevinWatson
|
|
261
353
|
* Improved type definitions for custom steps. By @Akxe
|
|
262
|
-
* Fixed setting `multiple.parallel.chunks` as environment variable in config. See
|
|
354
|
+
* Fixed setting `multiple.parallel.chunks` as environment variable in config. See #1238 by @ngadiyak
|
|
263
355
|
|
|
264
356
|
## 1.4.2
|
|
265
357
|
|
|
@@ -429,9 +521,9 @@ locate('//table')
|
|
|
429
521
|
|
|
430
522
|
* [Dynamic configuration](https://codecept.io/advanced/#dynamic-configuration) to update helpers config per test or per suite.
|
|
431
523
|
* Added `event.test.finished` which fires synchronously for both failed and passed tests.
|
|
432
|
-
* [WebDriverIO][Protractor][Nightmare][Puppeteer] Full page screenshots on failure disabled by default. See [issue
|
|
524
|
+
* [WebDriverIO][Protractor][Nightmare][Puppeteer] Full page screenshots on failure disabled by default. See [issue#1600. You can enabled them with `fullPageScreenshots: true`, however they may work unstable in Selenium.
|
|
433
525
|
* `within` blocks can return values. See [updated documentation](https://codecept.io/basics/#within).
|
|
434
|
-
* Removed doublt call to `_init` in helpers. Fixes issue
|
|
526
|
+
* Removed doublt call to `_init` in helpers. Fixes issue #1036
|
|
435
527
|
* Added scenario and feature configuration via fluent API:
|
|
436
528
|
|
|
437
529
|
```js
|
|
@@ -695,7 +787,7 @@ I.dontSee('Email Address');
|
|
|
695
787
|
↑ This element can be located with `~foobar` in WebDriverIO and Appium helpers. Thanks to @flyskywhy
|
|
696
788
|
|
|
697
789
|
* Allow providing arbitrary objects in config includes by @rlewan
|
|
698
|
-
* [REST] Prevent from mutating default headers by @alexashley. See
|
|
790
|
+
* [REST] Prevent from mutating default headers by @alexashley. See #789
|
|
699
791
|
* [REST] Fixed sending empty helpers with `haveRequestHeaders` in `sendPostRequest`. By @petrisorionel
|
|
700
792
|
* Fixed displaying undefined args in output by @APshenkin
|
|
701
793
|
* Fixed NaN instead of seconds in output by @APshenkin
|
|
@@ -707,8 +799,7 @@ I.dontSee('Email Address');
|
|
|
707
799
|
## 1.0.3
|
|
708
800
|
|
|
709
801
|
* [WebDriverIO][Protractor][Nightmare] method `waitUntilExists` implemented by @sabau
|
|
710
|
-
* Absolute path can be set for `output` dir by @APshenkin. Fix
|
|
711
|
-
* Data table rows can be ignored by using `xadd`. By @APhenkin
|
|
802
|
+
* Absolute path can be set for `output` dir by @APshenkin. Fix #571* Data table rows can be ignored by using `xadd`. By @APhenkin
|
|
712
803
|
* Added `Data(table).only.Scenario` to give ability to launch only Data tests. By @APhenkin
|
|
713
804
|
* Implemented `ElementNotFound` error by @BorisOsipov.
|
|
714
805
|
* Added TypeScript compiler / configs to check the JavaScript by @KennyRules
|
|
@@ -721,12 +812,11 @@ I.dontSee('Email Address');
|
|
|
721
812
|
|
|
722
813
|
* Introduced generators support in scenario hooks for `BeforeSuite`/`Before`/`AfterSuite`/`After`
|
|
723
814
|
* [ApiDataFactory] Fixed loading helper; `requireg` package included.
|
|
724
|
-
* Fix
|
|
815
|
+
* Fix #485`run-multiple`: the first browser-resolution combination was be used in all configurations
|
|
725
816
|
* Fixed unique test names:
|
|
726
|
-
* Fixed
|
|
817
|
+
* Fixed #447 tests failed silently if they have the same name as other tests.
|
|
727
818
|
* Use uuid in screenshot names when `uniqueScreenshotNames: true`
|
|
728
|
-
* [Protractor] Fixed testing non-angular application. `amOutsideAngularApp` is executed before each step. Fixes
|
|
729
|
-
* Added output for steps in hooks when they fail
|
|
819
|
+
* [Protractor] Fixed testing non-angular application. `amOutsideAngularApp` is executed before each step. Fixes #458* Added output for steps in hooks when they fail
|
|
730
820
|
|
|
731
821
|
## 1.0.1
|
|
732
822
|
|
|
@@ -735,8 +825,7 @@ I.dontSee('Email Address');
|
|
|
735
825
|
* Added [Mochawesome](http://codecept.io/helpers/Mochawesome/) helper
|
|
736
826
|
* `addMochawesomeContext` method to add custom data to mochawesome reports
|
|
737
827
|
* Fixed Mochawesome context for failed screenshots.
|
|
738
|
-
* [WebDriverIO] improved click on context to match clickable element with a text inside. Fixes
|
|
739
|
-
* [Nightmare] Added `refresh` function by @awhanks
|
|
828
|
+
* [WebDriverIO] improved click on context to match clickable element with a text inside. Fixes #647* [Nightmare] Added `refresh` function by @awhanks
|
|
740
829
|
* fixed `Unhandled promise rejection (rejection id: 1): Error: Unknown wait type: pageLoad`
|
|
741
830
|
* support for tests with retries in html report
|
|
742
831
|
* be sure that change window size and timeouts completes before test
|
|
@@ -801,16 +890,16 @@ Next notable feature is **[SmartWait](http://codecept.io/acceptance/#smartwait)*
|
|
|
801
890
|
* Minimal NodeJS version is 6.11.1 LTS
|
|
802
891
|
* Use `within` command with generators.
|
|
803
892
|
* [Data Driven Tests](http://codecept.io/advanced/#data-driven-tests) introduced.
|
|
804
|
-
* Print execution time per step in `--debug` mode.
|
|
893
|
+
* Print execution time per step in `--debug` mode. #591 by @APshenkin
|
|
805
894
|
* [WebDriverIO][Protractor][Nightmare] Added `disableScreenshots` option to disable screenshots on fail by @Apshenkin
|
|
806
895
|
* [WebDriverIO][Protractor][Nightmare] Added `uniqueScreenshotNames` option to generate unique names for screenshots on failure by @Apshenkin
|
|
807
896
|
* [WebDriverIO][Nightmare] Fixed click on context; `click('text', '#el')` will throw exception if text is not found inside `#el`.
|
|
808
897
|
* [WebDriverIO][Protractor][SeleniumWebdriver] [SmartWait introduced](http://codecept.io/acceptance/#smartwait).
|
|
809
|
-
* [WebDriverIO][Protractor][Nightmare]Fixed `saveScreenshot` for PhantomJS, `fullPageScreenshots` option introduced by @HughZurname
|
|
898
|
+
* [WebDriverIO][Protractor][Nightmare]Fixed `saveScreenshot` for PhantomJS, `fullPageScreenshots` option introduced by @HughZurname #549
|
|
810
899
|
* [Appium] helper introduced by @APshenkin
|
|
811
|
-
* [REST] helper introduced by @atrevino in
|
|
900
|
+
* [REST] helper introduced by @atrevino in #504
|
|
812
901
|
* [WebDriverIO][SeleniumWebdriver] Fixed "windowSize": "maximize" for Chrome 59+ version #560 by @APshenkin
|
|
813
|
-
* [Nightmare] Fixed restarting by @APshenkin
|
|
902
|
+
* [Nightmare] Fixed restarting by @APshenkin #581
|
|
814
903
|
* [WebDriverIO] Methods added by @APshenkin:
|
|
815
904
|
* [grabCssPropertyFrom](http://codecept.io/helpers/WebDriverIO/#grabcsspropertyfrom)
|
|
816
905
|
* [seeTitleEquals](http://codecept.io/helpers/WebDriverIO/#seetitleequals)
|
|
@@ -830,10 +919,10 @@ Next notable feature is **[SmartWait](http://codecept.io/acceptance/#smartwait)*
|
|
|
830
919
|
* [scrollPageToBottom](http://codecept.io/helpers/WebDriverIO/#scrollpagetobottom)
|
|
831
920
|
* [scrollPageToTop](http://codecept.io/helpers/WebDriverIO/#scrollpagetotop)
|
|
832
921
|
* [grabBrowserLogs](http://codecept.io/helpers/WebDriverIO/#grabbrowserlogs)
|
|
833
|
-
* Use mkdirp to create output directory.
|
|
834
|
-
* [WebDriverIO] Fixed `seeNumberOfVisibleElements` by @BorisOsipov
|
|
835
|
-
* Lots of fixes for promise chain by @APshenkin
|
|
836
|
-
* Fix
|
|
922
|
+
* Use mkdirp to create output directory. #592 by @vkramskikh
|
|
923
|
+
* [WebDriverIO] Fixed `seeNumberOfVisibleElements` by @BorisOsipov #574
|
|
924
|
+
* Lots of fixes for promise chain by @APshenkin #568
|
|
925
|
+
* Fix #543- After block not properly executed if Scenario fails
|
|
837
926
|
* Expected behavior in promise chains: `_beforeSuite` hooks from helpers -> `BeforeSuite` from test -> `_before` hooks from helpers -> `Before` from test - > Test steps -> `_failed` hooks from helpers (if test failed) -> `After` from test -> `_after` hooks from helpers -> `AfterSuite` from test -> `_afterSuite` hook from helpers.
|
|
838
927
|
* if during test we got errors from any hook (in test or in helper) - stop complete this suite and go to another
|
|
839
928
|
* if during test we got error from Selenium server - stop complete this suite and go to another
|
|
@@ -841,7 +930,7 @@ Next notable feature is **[SmartWait](http://codecept.io/acceptance/#smartwait)*
|
|
|
841
930
|
* Complete `_after`, `_afterSuite` hooks even After/AfterSuite from test was failed
|
|
842
931
|
* Don't close browser between suites, when `restart` option is false. We should start browser only one time and close it only after all tests.
|
|
843
932
|
* Close tabs and clear local storage, if `keepCookies` flag is enabled
|
|
844
|
-
* Fix TypeError when using babel-node or ts-node on node.js 7+
|
|
933
|
+
* Fix TypeError when using babel-node or ts-node on node.js 7+ #586 by @vkramskikh
|
|
845
934
|
* [Nightmare] fixed usage of `_locate`
|
|
846
935
|
|
|
847
936
|
Special thanks to **Andrey Pshenkin** for his work on this release and the major improvements.
|
|
@@ -857,9 +946,9 @@ Scenario('My scenario', { build_id: 123, type: 'slow' }, function (I)
|
|
|
857
946
|
those options can be accessed as `opts` property inside a `test` object. Can be used in custom listeners.
|
|
858
947
|
|
|
859
948
|
* Added `docs` directory to a package.
|
|
860
|
-
* [WebDriverIO][Protractor][SeleniumWebdriver] Bugfix: cleaning session when `restart: false` by @tfiwm
|
|
949
|
+
* [WebDriverIO][Protractor][SeleniumWebdriver] Bugfix: cleaning session when `restart: false` by @tfiwm #519
|
|
861
950
|
* [WebDriverIO][Protractor][Nightmare] Added second parameter to `saveScreenshot` to allow a full page screenshot. By @HughZurname
|
|
862
|
-
* Added suite object to `suite.before` and `suite.after` events by @implico.
|
|
951
|
+
* Added suite object to `suite.before` and `suite.after` events by @implico. #496
|
|
863
952
|
|
|
864
953
|
## 0.6.2
|
|
865
954
|
|
|
@@ -922,15 +1011,14 @@ codeceptjs run users_test.js -c tests
|
|
|
922
1011
|
* [Polish translation](http://codecept.io/translation/#polish) added by @limes.
|
|
923
1012
|
* Update process exit code so that mocha saves reports before exit by @romanovma.
|
|
924
1013
|
* [Nightmare] fixed `getAttributeFrom` for custom attributes by @robrkerr
|
|
925
|
-
* [Nightmare] Fixed *UnhandledPromiseRejectionWarning error* when selecting the dropdown using `selectOption` by @robrkerr. [
|
|
1014
|
+
* [Nightmare] Fixed *UnhandledPromiseRejectionWarning error* when selecting the dropdown using `selectOption` by @robrkerr. [Se PR.
|
|
926
1015
|
* [Protractor] fixed `pressKey` method by @romanovma
|
|
927
1016
|
|
|
928
1017
|
## 0.5.0
|
|
929
1018
|
|
|
930
1019
|
* Protractor ^5.0.0 support (while keeping ^4.0.9 compatibility)
|
|
931
|
-
* Fix 'fullTitle() is not a function' in exit.js by @hubidu. See
|
|
932
|
-
* [Nightmare] Fix for `waitTimeout` by @HughZurname. See
|
|
933
|
-
* Dockerized CodeceptJS setup by @artiomnist. [See reference](https://github.com/Codeception/CodeceptJS/blob/master/docker/README.md)
|
|
1020
|
+
* Fix 'fullTitle() is not a function' in exit.js by @hubidu. See #388.
|
|
1021
|
+
* [Nightmare] Fix for `waitTimeout` by @HughZurname. See #391. Resolves #236* Dockerized CodeceptJS setup by @artiomnist. [See reference](https://github.com/Codeception/CodeceptJS/blob/master/docker/README.md)
|
|
934
1022
|
|
|
935
1023
|
## 0.4.16
|
|
936
1024
|
|
|
@@ -1012,7 +1100,7 @@ Scenario('Not that complex', {timeout: 1000}, (I) => {
|
|
|
1012
1100
|
});
|
|
1013
1101
|
```
|
|
1014
1102
|
|
|
1015
|
-
* [WebDriverIO] Added `uniqueScreenshotNames` option to set unique screenshot names for failed tests. By @APshenkin. See
|
|
1103
|
+
* [WebDriverIO] Added `uniqueScreenshotNames` option to set unique screenshot names for failed tests. By @APshenkin. See #299
|
|
1016
1104
|
* [WebDriverIO] `clearField` method improved to accept name/label locators and throw errors.
|
|
1017
1105
|
* [Nightmare][SeleniumWebdriver][Protractor] `clearField` method added.
|
|
1018
1106
|
* [Nightmare] Fixed `waitForElement`, and `waitForVisible` methods.
|
|
@@ -1063,12 +1151,12 @@ module.exports = function(done) {
|
|
|
1063
1151
|
## 0.4.8
|
|
1064
1152
|
|
|
1065
1153
|
* [Protractor][SeleniumWebdriver][Nightmare] added `moveCursorTo` method.
|
|
1066
|
-
* [Protractor][SeleniumWebdriver][WebDriverIO] Added `manualStart` option to start browser manually in the beginning of test. By @cnworks. [PR
|
|
1154
|
+
* [Protractor][SeleniumWebdriver][WebDriverIO] Added `manualStart` option to start browser manually in the beginning of test. By @cnworks. [PR#250
|
|
1067
1155
|
* Fixed `codeceptjs init` to work with nested directories and file masks.
|
|
1068
1156
|
* Fixed `codeceptjs gt` to generate test with proper file name suffix. By @Zougi.
|
|
1069
1157
|
* [Nightmare] Fixed: Error is thrown when clicking on element which can't be locate. By @davetmik
|
|
1070
1158
|
* [WebDriverIO] Fixed `attachFile` for file upload. By @giuband and @davetmik
|
|
1071
|
-
* [WebDriverIO] Add support for timeouts in config and with `defineTimeouts` method. By @easternbloc
|
|
1159
|
+
* [WebDriverIO] Add support for timeouts in config and with `defineTimeouts` method. By @easternbloc #258 and #267 by @davetmik
|
|
1072
1160
|
* Fixed hanging of CodeceptJS when error is thrown by event dispatcher. Fix by @Zougi and @davetmik
|
|
1073
1161
|
|
|
1074
1162
|
|
|
@@ -1112,7 +1200,7 @@ exports.config = {
|
|
|
1112
1200
|
|
|
1113
1201
|
## 0.4.2
|
|
1114
1202
|
|
|
1115
|
-
* Added ability to localize tests with translation
|
|
1203
|
+
* Added ability to localize tests with translation #189. Thanks to @abner
|
|
1116
1204
|
* [Translation] ru-RU translation added.
|
|
1117
1205
|
* [Translation] pt-BR translation added.
|
|
1118
1206
|
* [Protractor] Protractor 4.0.4 compatibility.
|
package/README.md
CHANGED
|
@@ -18,19 +18,20 @@ Scenario('check Welcome page on site', (I) => {
|
|
|
18
18
|
});
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
CodeceptJS tests are:
|
|
22
22
|
|
|
23
23
|
* **Synchronous**. You don't need to care about callbacks, or promises, test scenarios are linear, your test should be too.
|
|
24
24
|
* Written from **user's perspective**. Every action is a method of `I`. That makes test easy to read, write and maintain even for non-tech persons.
|
|
25
25
|
* Backend **API agnostic**. We don't know which WebDriver implementation is running this test. We can easily switch from WebDriverIO to Protractor or PhantomJS.
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
CodeceptJS uses **Helper** modules to provide actions to `I` object. Currently CodeceptJS has these helpers:
|
|
28
28
|
|
|
29
|
-
* [**WebDriverIO**](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/WebDriverIO.md) - wrapper on top of Selenium bindings library [WebDriverIO](http://webdriver.io/)
|
|
30
|
-
* [**Protractor**](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/Protractor.md) - helper empowered by [Protractor](http://protractortest.org/) framework for AngularJS testing
|
|
31
|
-
* [**Nightmare**](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/Nightmare.md) - helper which for testing web applications indi Electron using NightmareJS.
|
|
32
|
-
* [**Appium**](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/Appium.md) - for **mobile testing** with Appium
|
|
33
29
|
* [**Puppeteer**](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/Puppeteer.md) - uses Google Chrome's Puppeteer for fast headless testing.
|
|
30
|
+
* [**WebDriver**](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/WebDriver.md) - uses [webdriverio](http://webdriver.io/) to run tests via WebDriver protocol.
|
|
31
|
+
* [**Protractor**](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/Protractor.md) - helper empowered by [Protractor](http://protractortest.org/) to run tests via WebDriver protocol.
|
|
32
|
+
* [**TestCafe**](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/TestCafe.md) - cheap and fast cross-browser test automation.
|
|
33
|
+
* [**Nightmare**](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/Nightmare.md) - uses Electron and NightmareJS to run tests.
|
|
34
|
+
* [**Appium**](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/Appium.md) - for **mobile testing** with Appium
|
|
34
35
|
|
|
35
36
|
And more to come...
|
|
36
37
|
|
|
@@ -38,7 +39,7 @@ And more to come...
|
|
|
38
39
|
|
|
39
40
|
CodeceptJS is a successor of [Codeception](http://codeception.com), a popular full-stack testing framework for PHP.
|
|
40
41
|
With CodeceptJS your scenario-driven functional and acceptance tests will be as simple and clean as they can be.
|
|
41
|
-
You don't need to worry about asynchronous nature of NodeJS or about various APIs of Selenium,
|
|
42
|
+
You don't need to worry about asynchronous nature of NodeJS or about various APIs of Selenium, Puppeteer, Protractor, TestCafe etc,
|
|
42
43
|
as CodeceptJS unifies them and makes them work as they were synchronous.
|
|
43
44
|
|
|
44
45
|
## Features
|
|
@@ -47,7 +48,6 @@ as CodeceptJS unifies them and makes them work as they were synchronous.
|
|
|
47
48
|
* Designed for scenario driven acceptance testing in BDD-style
|
|
48
49
|
* Uses ES6 natively without transpiler.
|
|
49
50
|
* Also plays nice with TypeScript.
|
|
50
|
-
* Selenium WebDriver integration using [webdriverio](http://webdriver.io).
|
|
51
51
|
* Smart locators: use names, labels, matching text, CSS or XPath to locate elements.
|
|
52
52
|
* Interactive debugging shell: pause test at any point and try different commands in a browser.
|
|
53
53
|
* Easily create tests, pageobjects, stepobjects with CLI generators.
|
|
@@ -55,13 +55,13 @@ as CodeceptJS unifies them and makes them work as they were synchronous.
|
|
|
55
55
|
## Install
|
|
56
56
|
|
|
57
57
|
```sh
|
|
58
|
-
npm install
|
|
58
|
+
npm install codeceptjs --save
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
Move to directory where you'd like to have your tests (and codeceptjs config) stored, and run
|
|
62
62
|
|
|
63
63
|
```sh
|
|
64
|
-
codeceptjs init
|
|
64
|
+
npx codeceptjs init
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
to create and configure test environment. It is recommended to select WebDriverIO from the list of helpers,
|
|
@@ -70,19 +70,19 @@ if you need to write Selenium WebDriver tests.
|
|
|
70
70
|
After that create your first test by executing:
|
|
71
71
|
|
|
72
72
|
```sh
|
|
73
|
-
codeceptjs generate:test
|
|
73
|
+
npx codeceptjs generate:test
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
Now test is created and can be executed with
|
|
77
77
|
|
|
78
78
|
```sh
|
|
79
|
-
codeceptjs run
|
|
79
|
+
npx codeceptjs run
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
If you want to write your tests using TypeScript just generate standard Type Definitions by executing:
|
|
83
83
|
|
|
84
84
|
```sh
|
|
85
|
-
codeceptjs def .
|
|
85
|
+
npx codeceptjs def .
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
Later you can even automagically update Type Definitions to include your own custom [helpers methods](docs/helpers.md).
|
|
@@ -113,7 +113,7 @@ Scenario('test some forms', (I) => {
|
|
|
113
113
|
```
|
|
114
114
|
|
|
115
115
|
All actions are performed by I object; assertions functions start with `see` function.
|
|
116
|
-
In this examples all methods of `I` are taken from
|
|
116
|
+
In this examples all methods of `I` are taken from WebDriver helper, see [reference](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/WebDriver.md) to learn how to use them.
|
|
117
117
|
|
|
118
118
|
Let's execute this test with `run` command. Additional option `--steps` will show us the running process. We recommend use `--steps` or `--debug` during development.
|
|
119
119
|
|
|
@@ -230,16 +230,9 @@ It will create a page object file for you and add it to config.
|
|
|
230
230
|
Let's assume we created one named `docsPage`:
|
|
231
231
|
|
|
232
232
|
```js
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
let I;
|
|
233
|
+
const { I } = inject();
|
|
236
234
|
|
|
237
235
|
module.exports = {
|
|
238
|
-
|
|
239
|
-
_init() {
|
|
240
|
-
I = actor();
|
|
241
|
-
},
|
|
242
|
-
|
|
243
236
|
fields: {
|
|
244
237
|
email: '#user_basic_email',
|
|
245
238
|
password: '#user_basic_password'
|
package/bin/codecept.js
CHANGED
|
@@ -36,6 +36,7 @@ program.command('list [path]')
|
|
|
36
36
|
program.command('def [path]')
|
|
37
37
|
.description('Generates TypeScript definitions for all I actions.')
|
|
38
38
|
.option('-c, --config [file]', 'configuration file to be used')
|
|
39
|
+
.option('-o, --output [folder]', 'target folder to paste definitions')
|
|
39
40
|
.action(require('../lib/command/definitions'));
|
|
40
41
|
|
|
41
42
|
program.command('gherkin:init [path]')
|
|
@@ -52,9 +53,11 @@ program.command('gherkin:steps [path]')
|
|
|
52
53
|
|
|
53
54
|
program.command('gherkin:snippets [path]')
|
|
54
55
|
.alias('bdd:snippets')
|
|
55
|
-
.description('Generate step
|
|
56
|
+
.description('Generate step definitions from steps.')
|
|
56
57
|
.option('--dry-run', "don't save snippets to file")
|
|
57
58
|
.option('-c, --config [file]', 'configuration file to be used')
|
|
59
|
+
.option('--feature [file]', 'feature files(s) to scan')
|
|
60
|
+
.option('--path [file]', 'file in which to place the new snippets')
|
|
58
61
|
.action(require('../lib/command/gherkin/snippets'));
|
|
59
62
|
|
|
60
63
|
|
package/docs/acceptance.md
CHANGED
|
@@ -277,7 +277,7 @@ within({frame: [".content", "#editor"]}, () => {
|
|
|
277
277
|
|
|
278
278
|
## Auto Login
|
|
279
279
|
|
|
280
|
-
To share the same user session
|
|
280
|
+
To share the same user session across different tests CodeceptJS provides [autoLogin plugin](https://codecept.io/plugins#autologin). It simplifies login management and reduces time consuming login operations. Instead of filling in login form before each test it saves the cookies of a valid user session and reuses it for next tests. If a session expires or doesn't exist, logs in a user again.
|
|
281
281
|
|
|
282
282
|
This plugin requires some configuration but is very simple in use:
|
|
283
283
|
|
|
@@ -364,3 +364,46 @@ Function passed into session can use `I`, page objects, and any objects declared
|
|
|
364
364
|
This function can also be declared as async (but doesn't work as generator).
|
|
365
365
|
|
|
366
366
|
Also, you can use `within` inside a session but you can't call session from inside `within`.
|
|
367
|
+
|
|
368
|
+
## Multiple Windows
|
|
369
|
+
|
|
370
|
+
CodeceptJS allows to use several browser windows inside a test. Sometimes we are testing the functionality of websites that we cannot control, such as a closed-source managed package, and there are popups that either remain open for configuring data on the screen, or close as a result of clicking a window. We can use these functions in order to gain more control over which page is being tested with Codecept at any given time. For example:
|
|
371
|
+
|
|
372
|
+
```js
|
|
373
|
+
const assert = require('assert');
|
|
374
|
+
|
|
375
|
+
Scenario('should open main page of configured site, open a popup, switch to main page, then switch to popup, close popup, and go back to main page', async (I) => {
|
|
376
|
+
I.amOnPage('/');
|
|
377
|
+
const handleBeforePopup = await I.grabCurrentWindowHandle();
|
|
378
|
+
const urlBeforePopup = await I.grabCurrentUrl();
|
|
379
|
+
const allHandlesBeforePopup = await I.grabAllWindowHandles();
|
|
380
|
+
assert.equal(allHandlesBeforePopup.length, 1, 'Single Window');
|
|
381
|
+
|
|
382
|
+
await I.executeScript(() => {
|
|
383
|
+
window.open('https://www.w3schools.com/', 'new window', 'toolbar=yes,scrollbars=yes,resizable=yes,width=400,height=400');
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
const allHandlesAfterPopup = await I.grabAllWindowHandles();
|
|
387
|
+
assert.equal(allHandlesAfterPopup.length, 2, 'Two Windows');
|
|
388
|
+
|
|
389
|
+
await I.switchToWindow(allHandlesAfterPopup[1]);
|
|
390
|
+
const urlAfterPopup = await I.grabCurrentUrl();
|
|
391
|
+
assert.equal(urlAfterPopup, 'https://www.w3schools.com/', 'Expected URL: Popup');
|
|
392
|
+
|
|
393
|
+
assert.equal(handleBeforePopup, allHandlesAfterPopup[0], 'Expected Window: Main Window');
|
|
394
|
+
await I.switchToWindow(handleBeforePopup);
|
|
395
|
+
const currentURL = await I.grabCurrentUrl();
|
|
396
|
+
assert.equal(currentURL, urlBeforePopup, 'Expected URL: Main URL');
|
|
397
|
+
|
|
398
|
+
await I.switchToWindow(allHandlesAfterPopup[1]);
|
|
399
|
+
const urlAfterSwitchBack = await I.grabCurrentUrl();
|
|
400
|
+
assert.equal(urlAfterSwitchBack, 'https://www.w3schools.com/', 'Expected URL: Popup');
|
|
401
|
+
await I.closeCurrentTab();
|
|
402
|
+
|
|
403
|
+
const allHandlesAfterPopupClosed = await I.grabAllWindowHandles();
|
|
404
|
+
assert.equal(allHandlesAfterPopupClosed.length, 1, 'Single Window');
|
|
405
|
+
const currentWindowHandle = await I.grabCurrentWindowHandle();
|
|
406
|
+
assert.equal(currentWindowHandle, allHandlesAfterPopup[0], 'Expected Window: Main Window');
|
|
407
|
+
|
|
408
|
+
}).tag('@ProofOfConcept').tag('@grabAllWindowHandles').tag('@grabCurrentWindowHandle').tag('@switchToWindow');
|
|
409
|
+
```
|
package/docs/advanced.md
CHANGED
|
@@ -367,7 +367,7 @@ Scenario('should create data via v2 version of API', (I) => {
|
|
|
367
367
|
```
|
|
368
368
|
|
|
369
369
|
Config can also be set by a function, in this case you can get a test object and specify config values based on it.
|
|
370
|
-
This is very useful when running tests against cloud providers, like BrowserStack.
|
|
370
|
+
This is very useful when running tests against cloud providers, like BrowserStack. This function can also be asynchronous.
|
|
371
371
|
|
|
372
372
|
```js
|
|
373
373
|
Scenario('should report to BrowserStack', (I) => {
|
package/docs/angular.md
CHANGED
|
@@ -150,12 +150,12 @@ exports.config = {
|
|
|
150
150
|
Sure, Protractor can be used to test applications built without AngularJS. In this case you need to disable angular synchronization feature in config:
|
|
151
151
|
|
|
152
152
|
```js
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
153
|
+
helpers: {
|
|
154
|
+
Protractor: {
|
|
155
|
+
url: "http://todomvc.com/examples/angularjs/",
|
|
156
|
+
driver: "hosted",
|
|
157
|
+
browser: "firefox",
|
|
158
|
+
angular: false
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
```
|
|
@@ -304,9 +304,6 @@ Scenario('create todo item', (I) => {
|
|
|
304
304
|
|
|
305
305
|
To learn more about refactoring options in CodeceptJS read [PageObjects guide](http://codecept.io/pageobjects/).
|
|
306
306
|
|
|
307
|
-
## Multiple Sessions
|
|
308
|
-
|
|
309
|
-
To run several browsers in one test see [multiple session](https://codecept.io/acceptance/#multiple-sessions) chapter.
|
|
310
307
|
|
|
311
308
|
## Extending
|
|
312
309
|
|