diff --git a/CHANGELOG.md b/CHANGELOG.md
index fe98f0e97..cc7463558 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 2.6.3
+
+* [stepByStepReport plugin] Fixed when using plugin with BeforeSuite. Fixes #2337 by @mirao
+* [allure plugin] Fixed reporting of tests skipped by failure in before hook. Refer to #2349 & #2354. Fix by @koushikmohan1996
+
## 2.6.2
* [WebDriver][Puppeteer] Added `forceClick` method to emulate click event instead of using native events.
diff --git a/docs/basics.md b/docs/basics.md
index 203b5a51f..e422f2470 100644
--- a/docs/basics.md
+++ b/docs/basics.md
@@ -155,18 +155,23 @@ Clicking the links is not what takes the most time during testing a web site. If
Let's submit this sample form for a test:
+
+
```html
```
@@ -178,11 +183,16 @@ I.fillField('Name', 'Miles');
// we can use input name
I.fillField('user[email]','miles@davis.com');
// select element by label, choose option by text
-I.selectOption('Gender','Male');
-// click 'Update' button, found by text
-I.click('Update');
+I.selectOption('Role','Admin');
+// click 'Save' button, found by text
+I.checkOption('Accept');
+I.click('Save');
```
+> ℹ `selectOption` works only with standard `` HTML elements. If your selectbox is created by React, Vue, or as a component of any other framework, this method potentially won't work with it. Use `click` to manipulate it.
+
+> ℹ `checkOption` also works only with standard ` ` HTML elements. If your checkbox is created by React, Vue, or as a component of any other framework, this method potentially won't work with it. Use `click` to manipulate it.
+
Alternative scenario:
```js
@@ -190,12 +200,12 @@ Alternative scenario:
I.fillField('#user_name', 'Miles');
I.fillField('#user_email','miles@davis.com');
// select element by label, option by value
-I.selectOption('#user_gender','m');
+I.selectOption('#user_role','1');
// click 'Update' button, found by name
I.click('submitButton', '#update_form');
```
-To fill in sensitive data use the `secret` function:
+To fill in sensitive data use the `secret` function, it won't expose actual value in logs.
```js
I.fillField('password', secret('123456'));
diff --git a/docs/changelog.md b/docs/changelog.md
index 570c0fbaa..f625445b3 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -7,6 +7,26 @@ layout: Section
# Releases
+## 2.6.2
+
+* [WebDriver][Puppeteer] Added `forceClick` method to emulate click event instead of using native events.
+* **[Playwright]** Updated to 0.14
+* **[Puppeteer]** Updated to Puppeteer v3.0
+* **[wdio]** Fixed undefined output directory for wdio plugns. Fix By **[PeterNgTr](https://github.com/PeterNgTr)**
+* **[Playwright]** Introduced `handleDownloads` method to download file. Please note, this method has slightly different API than the same one in Puppeteer.
+* **[allure]** Fixed undefined output directory for allure plugin on using custom runner. Fix by **[charliepradeep](https://github.com/charliepradeep)**
+* **[WebDriver]** Fixed `waitForEnabled` fix for webdriver 6. Fix by **[dsharapkou](https://github.com/dsharapkou)**
+* Workers: Fixed negative failure result if use scenario with the same names. Fix by **[Vorobeyko](https://github.com/Vorobeyko)**
+* **[MockRequest]** Updated documentation to match new helper version
+* Fixed: skipped tests are not reported if a suite failed in `before`. Refer [#2349](https://github.com/Codeception/CodeceptJS/issues/2349) & [#2354](https://github.com/Codeception/CodeceptJS/issues/2354). Fix by **[koushikmohan1996](https://github.com/koushikmohan1996)**
+
+## 2.6.1
+
+* [screenshotOnFail plugin] Fixed saving screenshot of active session.
+* [screenshotOnFail plugin] Fix issue [#2301](https://github.com/Codeception/CodeceptJS/issues/2301) when having the flag `uniqueScreenshotNames`=true results in `undefined` in screenshot file name by **[PeterNgTr](https://github.com/PeterNgTr)**
+* **[WebDriver]** Fixed `waitForElement` not applying the optional second argument to override the default timeout in webdriverio 6. Fix by **[Mooksc](https://github.com/Mooksc)**
+* **[WebDriver]** Updated `waitUntil` method which is used by all of the wait* functions. This updates the `waitForElement` by the same convention used to update `waitForVisible` and `waitInUrl` to be compatible with both WebDriverIO v5 & v6. See [#2313](https://github.com/Codeception/CodeceptJS/issues/2313) by **[Mooksc](https://github.com/Mooksc)**
+
## 2.6.0
* **[Playwright] Updated to Playwright 0.12** by **[Georgegriff](https://github.com/Georgegriff)**.
@@ -29,6 +49,7 @@ I.executeScript(({x, y}) => x + y, {x, y});
* `click` - automatically waits for element to become clickable (visible, not animated) and waits for navigation.
* `clickLink` - deprecated
* `waitForClickable` - deprecated
+ * `forceClick` - added
* Added support for custom locators. See [#2277](https://github.com/Codeception/CodeceptJS/issues/2277)
* Introduced [device emulation](/playwright/#device-emulation):
* globally via `emulate` config option
diff --git a/docs/helpers/Appium.md b/docs/helpers/Appium.md
index 82e78c615..bbd79b9bb 100644
--- a/docs/helpers/Appium.md
+++ b/docs/helpers/Appium.md
@@ -1162,12 +1162,14 @@ this.helpers['WebDriver']._locateCheckable('I agree with terms and conditions').
Find a clickable element by providing human readable text:
```js
-this.helpers['WebDriver']._locateClickable('Next page').then // ...
+const els = await this.helpers.WebDriver._locateClickable('Next page');
+const els = await this.helpers.WebDriver._locateClickable('Next page', '.pages');
```
#### Parameters
- `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
+- `context`
### \_locateFields
@@ -1211,6 +1213,38 @@ I.amOnPage('/login'); // opens a login page
- `url` **[string][4]** url path or global url.
+### forceClick
+
+Perform an emulated click on a link or a button, given by a locator.
+Unlike normal click instead of sending native event, emulates a click with JavaScript.
+This works on hidden, animated or inactive elements as well.
+
+If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
+For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
+For images, the "alt" attribute and inner text of any parent links are searched.
+
+The second parameter is a context (CSS or XPath locator) to narrow the search.
+
+```js
+// simple link
+I.forceClick('Logout');
+// button of form
+I.forceClick('Submit');
+// CSS button
+I.forceClick('#form input[type=submit]');
+// XPath
+I.forceClick('//form/*[@type=submit]');
+// link in context
+I.forceClick('Logout', '#nav');
+// using strict locator
+I.forceClick({css: 'nav a.login'});
+```
+
+#### Parameters
+
+- `locator` **([string][4] \| [object][6])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
+- `context` **([string][4]? | [object][6])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.{{ react }} (optional, default `null`)
+
### doubleClick
Performs a double-click on an element matched by link|button|label|CSS or XPath.
diff --git a/docs/helpers/Playwright.md b/docs/helpers/Playwright.md
index 500337d54..dcc0eb308 100644
--- a/docs/helpers/Playwright.md
+++ b/docs/helpers/Playwright.md
@@ -38,7 +38,7 @@ This helper should be configured in codecept.json or codecept.conf.js
- `keepBrowserState`: - keep browser state between tests when `restart` is set to false.
- `keepCookies`: - 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.
-- `waitForNavigation`: . When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle0`, `networkidle2`. See [Playwright API][2]. Array values are accepted as well.
+- `waitForNavigation`: . When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle0`, `networkidle2`. Choose one of those options is possible. See [Playwright API][2].
- `pressKeyDelay`: . Delay between key presses in ms. Used when calling Playwrights page.type(...) in fillField/appendField
- `getPageTimeout` config option to set maximum navigation time in milliseconds.
- `waitForTimeout`: (optional) default wait* timeout in ms. Default: 1000.
@@ -63,7 +63,7 @@ This helper should be configured in codecept.json or codecept.conf.js
}
```
-#### Example #2: Wait for DOMContentLoaded event and 0 network connections
+#### Example #2: Wait for DOMContentLoaded event
```js
{
@@ -71,7 +71,7 @@ This helper should be configured in codecept.json or codecept.conf.js
Playwright : {
url: "http://localhost",
restart: false,
- waitForNavigation: [ "domcontentloaded", "networkidle0" ],
+ waitForNavigation: "domcontentloaded",
waitForAction: 500
}
}
@@ -890,6 +890,24 @@ let email = await I.grabValueFrom('input[name=email]');
Returns **[Promise][9]<[string][7]>** attribute value
+### handleDownloads
+
+Handles a file download.Aa file name is required to save the file on disk.
+Files are saved to "output" directory.
+
+Should be used with [FileSystem helper][11] to check that file were downloaded correctly.
+
+```js
+I.handleDownloads('downloads/avatar.jpg');
+I.click('Download Avatar');
+I.amInPath('output/downloads');
+I.waitForFile('downloads/avatar.jpg', 5);
+```
+
+#### Parameters
+
+- `fileName` **[string][7]?** set filename for downloaded file
+
### haveRequestHeaders
Set headers for all next requests
@@ -928,7 +946,7 @@ Open new tab and switch to it
I.openNewTab();
```
-You can pass in [page options][11] to emulate device on this page
+You can pass in [page options][12] to emulate device on this page
```js
// enable mobile
@@ -943,7 +961,7 @@ I.openNewTab({ isMobile: true });
Presses a key in the browser (on a focused element).
-_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][12].
+_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][13].
```js
I.pressKey('Backspace');
@@ -1002,13 +1020,13 @@ Some of the supported key names are:
#### Parameters
-- `key` **([string][7] | [Array][10]<[string][7]>)** key or array of keys to press._Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Playwright#1313][13]).
+- `key` **([string][7] | [Array][10]<[string][7]>)** key or array of keys to press._Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Playwright#1313][14]).
### pressKeyDown
Presses a key in the browser and leaves it in a down state.
-To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][14]).
+To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][15]).
```js
I.pressKeyDown('Control');
@@ -1024,7 +1042,7 @@ I.pressKeyUp('Control');
Releases a key in the browser which was previously set to a down state.
-To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][14]).
+To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][15]).
```js
I.pressKeyDown('Control');
@@ -1092,7 +1110,7 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
#### Parameters
- `fileName` **[string][7]** file name to save.
-- `fullPage` **[boolean][15]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
+- `fullPage` **[boolean][16]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
### scrollPageToBottom
@@ -1541,7 +1559,7 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
#### Parameters
-- `fn` **([string][7] | [function][16])** to be executed in browser context.
+- `fn` **([string][7] | [function][17])** to be executed in browser context.
- `argsOrSec` **([Array][10]<any> | [number][8])?** (optional, `1` by default) arguments for function or seconds.
- `sec` **[number][8]?** (optional, `1` by default) time in seconds to wait
@@ -1563,7 +1581,7 @@ I.waitForInvisible('#popup');
Waits for navigation to finish. By default takes configured `waitForNavigation` option.
-See [Pupeteer's reference][2]
+See [Pupeteer's reference][18]
#### Parameters
@@ -1580,7 +1598,7 @@ I.waitForRequest(request => request.url() === 'http://example.com' && request.me
#### Parameters
-- `urlOrPredicate` **([string][7] | [function][16])**
+- `urlOrPredicate` **([string][7] | [function][17])**
- `sec` **[number][8]?** seconds to wait
### waitForResponse
@@ -1594,7 +1612,7 @@ I.waitForResponse(request => request.url() === 'http://example.com' && request.m
#### Parameters
-- `urlOrPredicate` **([string][7] | [function][16])**
+- `urlOrPredicate` **([string][7] | [function][17])**
- `sec` **[number][8]?** number of seconds to wait
### waitForText
@@ -1640,7 +1658,7 @@ I.waitForVisible('#popup');
#### Parameters
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
-- `sec` **[number][8]** (optional, `1` by default) time in seconds to waitThis method accepts [React selectors][17].
+- `sec` **[number][8]** (optional, `1` by default) time in seconds to waitThis method accepts [React selectors][19].
### waitInUrl
@@ -1694,7 +1712,7 @@ I.waitUntil(() => window.requests == 0, 5);
#### Parameters
-- `fn` **([function][16] | [string][7])** function which is executed in browser context.
+- `fn` **([function][17] | [string][7])** function which is executed in browser context.
- `sec` **[number][8]** (optional, `1` by default) time in seconds to wait
- `timeoutMsg` **[string][7]** message to show in case of timeout fail.
- `interval` **[number][8]?**
@@ -1715,7 +1733,7 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
[1]: https://github.com/microsoft/playwright
-[2]: https://github.com/GoogleChrome/Playwright/blob/master/docs/api.md#pagewaitfornavigationoptions
+[2]: https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitfornavigationoptions
[3]: https://chromedevtools.github.io/devtools-protocol/#how-do-i-access-the-browser-target
@@ -1733,16 +1751,20 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
-[11]: https://github.com/microsoft/playwright/blob/v0.12.1/docs/api.md#browsernewpageoptions
+[11]: https://codecept.io/helpers/FileSystem
+
+[12]: https://github.com/microsoft/playwright/blob/v0.12.1/docs/api.md#browsernewpageoptions
+
+[13]: #fillfield
-[12]: #fillfield
+[14]: https://github.com/GoogleChrome/Playwright/issues/1313
-[13]: https://github.com/GoogleChrome/Playwright/issues/1313
+[15]: #click
-[14]: #click
+[16]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
-[15]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
+[17]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
-[16]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
+[18]: https://github.com/GoogleChrome/Playwright/blob/master/docs/api.md#pagewaitfornavigationoptions
-[17]: https://codecept.io/react
+[19]: https://codecept.io/react
diff --git a/docs/helpers/Puppeteer.md b/docs/helpers/Puppeteer.md
index 9a3092abc..e84c6931b 100644
--- a/docs/helpers/Puppeteer.md
+++ b/docs/helpers/Puppeteer.md
@@ -696,6 +696,42 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
This action supports [React locators](https://codecept.io/react#locators)
+### forceClick
+
+Perform an emulated click on a link or a button, given by a locator.
+Unlike normal click instead of sending native event, emulates a click with JavaScript.
+This works on hidden, animated or inactive elements as well.
+
+If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
+For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
+For images, the "alt" attribute and inner text of any parent links are searched.
+
+The second parameter is a context (CSS or XPath locator) to narrow the search.
+
+```js
+// simple link
+I.forceClick('Logout');
+// button of form
+I.forceClick('Submit');
+// CSS button
+I.forceClick('#form input[type=submit]');
+// XPath
+I.forceClick('//form/*[@type=submit]');
+// link in context
+I.forceClick('Logout', '#nav');
+// using strict locator
+I.forceClick({css: 'nav a.login'});
+```
+
+#### Parameters
+
+- `locator` **([string][8] | [object][6])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
+- `context` **([string][8]? | [object][6])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
+
+
+This action supports [React locators](https://codecept.io/react#locators)
+
+
### grabAttributeFrom
Retrieves an attribute from an element located by CSS or XPath and returns it to test.
diff --git a/docs/helpers/WebDriver.md b/docs/helpers/WebDriver.md
index 60f0f3c93..507378d3c 100644
--- a/docs/helpers/WebDriver.md
+++ b/docs/helpers/WebDriver.md
@@ -391,12 +391,14 @@ this.helpers['WebDriver']._locateCheckable('I agree with terms and conditions').
Find a clickable element by providing human readable text:
```js
-this.helpers['WebDriver']._locateClickable('Next page').then // ...
+const els = await this.helpers.WebDriver._locateClickable('Next page');
+const els = await this.helpers.WebDriver._locateClickable('Next page', '.pages');
```
#### Parameters
- `locator` **([string][19] | [object][18])** element located by CSS|XPath|strict locator.
+- `context`
### _locateFields
@@ -873,6 +875,42 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
This action supports [React locators](https://codecept.io/react#locators)
+### forceClick
+
+Perform an emulated click on a link or a button, given by a locator.
+Unlike normal click instead of sending native event, emulates a click with JavaScript.
+This works on hidden, animated or inactive elements as well.
+
+If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
+For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
+For images, the "alt" attribute and inner text of any parent links are searched.
+
+The second parameter is a context (CSS or XPath locator) to narrow the search.
+
+```js
+// simple link
+I.forceClick('Logout');
+// button of form
+I.forceClick('Submit');
+// CSS button
+I.forceClick('#form input[type=submit]');
+// XPath
+I.forceClick('//form/*[@type=submit]');
+// link in context
+I.forceClick('Logout', '#nav');
+// using strict locator
+I.forceClick({css: 'nav a.login'});
+```
+
+#### Parameters
+
+- `locator` **([string][19] | [object][18])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
+- `context` **([string][19]? | [object][18])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
+
+
+This action supports [React locators](https://codecept.io/react#locators)
+
+
### grabAllWindowHandles
Get all Window Handles.
diff --git a/package.json b/package.json
index 29f88fc33..15f67f433 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "codeceptjs",
- "version": "2.6.2",
+ "version": "2.6.3",
"description": "Supercharged End 2 End Testing Framework for NodeJS",
"keywords": [
"acceptance",
diff --git a/test/acceptance/codecept.Puppeteer.js b/test/acceptance/codecept.Puppeteer.js
index b3eb5df81..0d3591bab 100644
--- a/test/acceptance/codecept.Puppeteer.js
+++ b/test/acceptance/codecept.Puppeteer.js
@@ -7,7 +7,7 @@ module.exports.config = {
helpers: {
Puppeteer: {
url: TestHelper.siteUrl(),
- show: true,
+ show: false,
chrome: {
args: [
'--no-sandbox',