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/docs/testcafe.md
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: testcafe
|
|
3
|
+
title: Testing with TestCafe
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
[TestCafe](https://devexpress.github.io/testcafe/) is another alternative engine for driving browsers. It is driven by unique technology which provides fast and simple cross browser testing for desktop and mobile browsers. Unlike WebDriver or Puppeteer, TestCafe doesn't control a browser at all. It is not a browser itself, like [Nightmare](https://codecept.io/nightmare) or Cypress. **TestCafe core is a proxy server** that runs behind the scene, and transforms all HTML and JS to include code that is needed for test automation.
|
|
7
|
+
|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
This is very smart idea. But to use TestCafe on daily basis you need to clearly understand its benefits and limitations:
|
|
11
|
+
|
|
12
|
+
### Pros
|
|
13
|
+
|
|
14
|
+
* **Fast**. Browser is controlled from inside a web page. This makes test run inside a browser as fast as your browser can render page with no extra network requests.
|
|
15
|
+
* **Simple Cross-Browser Support.** Because TestCafe only launches browsers, it can **automate browser** on desktop or mobile. Unlike WebDriver, you don't need special version of browser and driver to prepare to run tests. Setup simplified. All you need is just a browser installed, and you are ready to go.
|
|
16
|
+
* **Stable to Execution.** Because a test is executed inside a browser, the network latency effects are reduced. Unlike WebDriver you won't hit stale element exceptions, or element not interactable exceptions, as from within a web browser all DOM elements are accessible.
|
|
17
|
+
|
|
18
|
+
## Cons
|
|
19
|
+
|
|
20
|
+
* **Magic.** Browsers executed in TestCafe are not aware that they run in test mode. So at some edges automation control can be broken. It's also quite hard to debug possible issues, as you don't know how actually a web page is parsed to inject automation scripts.
|
|
21
|
+
* **No Browser Control.** Because TestCafe do not control browser, you can't actually automate all users actions. For instance, TestCafe can't open new tabs or open a new browser window in incognito mode. There can be also some issues running tests on 3rd party servers or inside iframes.
|
|
22
|
+
* **Simulated Events.** Events like `click` or `doubleClick` are simulated by JavaScript internally. Inside WebDriver or Puppeteer, where those events are dispatched by a browser, called native events. Native events are closer to real user experience. So in some cases simulated events wouldn't represent actual user experience, which can lead to false positive results. For instance, a button which can't be physically clicked by a user, would be clickable inside TestCafe.
|
|
23
|
+
|
|
24
|
+
Anyway, TestCafe is a good option to start if you need cross browser testing. And here is the **reason to use TestCafe with CodeceptJS: if you hit an edge case or issue, you can easily switch your tests to WebDriver**. As all helpers in CodeceptJS share the same syntax.
|
|
25
|
+
|
|
26
|
+
CodeceptJS is a rich testing frameworks which also provides features missing in original TestCafe:
|
|
27
|
+
|
|
28
|
+
* [Cucumber integration](https://codecept.io/bdd)
|
|
29
|
+
* [Real Page Objects](https://codecept.io/pageobjects)
|
|
30
|
+
* [Data Management via API](https://codecept.io/data)
|
|
31
|
+
* and others
|
|
32
|
+
|
|
33
|
+
## Writing Tests
|
|
34
|
+
|
|
35
|
+
To start using TestCafe with CodeceptJS install both via NPM
|
|
36
|
+
|
|
37
|
+
> If you don't have `package.json` in your project, create it with `npm init -y`.
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
npm i codeceptjs testcafe --save-dev
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then you need to initialize a project, selecting TestCafe when asked:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
npx codeceptjs init
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
A first test should be created with `codeceptjs gt` command
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
npx codeceptjs gt
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
In the next example we will [TodoMVC application](http://todomvc.com/examples/angularjs/#/). So let's create a test which will fill in todo list:
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
Feature('TodoMVC');
|
|
59
|
+
|
|
60
|
+
Scenario('create todo item', (I) => {
|
|
61
|
+
I.amOnPage('http://todomvc.com/examples/angularjs/#/');
|
|
62
|
+
I.fillField('.new-todo', todo)
|
|
63
|
+
I.pressKey('Enter');
|
|
64
|
+
I.seeNumberOfVisibleElements('.todo-list li', 1);
|
|
65
|
+
I.see('1 item left', '.todo-count');
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Same syntax is the same for all helpers in CodeceptJS so to learn more about available commands learn [CodeceptJS Basics](https://codecept.io/basics).
|
|
70
|
+
|
|
71
|
+
> [▶ Complete list of TestCafe actions](https://codecept.io/helpers/TestCafe)
|
|
72
|
+
|
|
73
|
+
## Page Objects
|
|
74
|
+
|
|
75
|
+
Multiple tests can be refactored to share some logic and locators. It is recommended to use PageObjects for this. For instance, in example above, we could create special actions for creating todos and checking them. If we move such methods in a corresponding object a test would look even clearer:
|
|
76
|
+
|
|
77
|
+
```js
|
|
78
|
+
Scenario('Create a new todo item', async (I, TodosPage) => {
|
|
79
|
+
I.say('Given I have an empty todo list')
|
|
80
|
+
|
|
81
|
+
I.say('When I create a todo "foo"')
|
|
82
|
+
TodosPage.enterTodo('foo')
|
|
83
|
+
|
|
84
|
+
I.say('Then I see the new todo on my list')
|
|
85
|
+
TodosPage.seeNumberOfTodos(1)
|
|
86
|
+
|
|
87
|
+
I.saveScreenshot('create-todo-item.png')
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
Scenario('Create multiple todo items', async (I, TodosPage) => {
|
|
91
|
+
I.say('Given I have an empty todo list')
|
|
92
|
+
|
|
93
|
+
I.say('When I create todos "foo", "bar" and "baz"')
|
|
94
|
+
TodosPage.enterTodo('foo')
|
|
95
|
+
TodosPage.enterTodo('bar')
|
|
96
|
+
TodosPage.enterTodo('baz')
|
|
97
|
+
|
|
98
|
+
I.say('Then I have these 3 todos on my list')
|
|
99
|
+
TodosPage.seeNumberOfTodos(3)
|
|
100
|
+
|
|
101
|
+
I.saveScreenshot('create-multiple-todo-items.png')
|
|
102
|
+
})
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
> ℹ [Source code of this example](https://github.com/hubidu/codeceptjs-testcafe-todomvc) is available on GitHub.
|
|
106
|
+
|
|
107
|
+
A PageObject can be injected into a test by its name. Here is how TodosPage looks like:
|
|
108
|
+
|
|
109
|
+
```js
|
|
110
|
+
// inside todos_page.js
|
|
111
|
+
const { I } = inject();
|
|
112
|
+
|
|
113
|
+
module.exports = {
|
|
114
|
+
goto() {
|
|
115
|
+
I.amOnPage('http://todomvc.com/examples/angularjs/#/')
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
enterTodo(todo) {
|
|
119
|
+
I.fillField('.new-todo', todo)
|
|
120
|
+
I.pressKey('Enter')
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
seeNumberOfTodos(numberOfTodos) {
|
|
124
|
+
I.seeNumberOfVisibleElements('.todo-list li', numberOfTodos)
|
|
125
|
+
},
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
> [▶ Read more about PageObjects in CodeceptJS](https://codecept.io/pageobjects)
|
|
130
|
+
|
|
131
|
+
## Extending
|
|
132
|
+
|
|
133
|
+
If you want to use TestCafe API inside your tests you can put them into actions of `I` object. To do so you can generate a new helper, access TestCafe helper, and get the test controller.
|
|
134
|
+
|
|
135
|
+
Create a helper using `codecepjs gh` command.
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
npx codeceptjs gh
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
All methods of newly created class will be added to `I` object.
|
|
142
|
+
|
|
143
|
+
```js
|
|
144
|
+
const Helper = codeceptjs.helper;
|
|
145
|
+
|
|
146
|
+
class MyTestCafe extends Helper {
|
|
147
|
+
|
|
148
|
+
slowlyFillField(field, text) {
|
|
149
|
+
// import test controller from TestCafe helper
|
|
150
|
+
const { t } = this.helpers.TestCafe;
|
|
151
|
+
// use TestCafe API here
|
|
152
|
+
return t.setTestSpeed(0.1)
|
|
153
|
+
.typeText(field, text);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
}
|
|
157
|
+
```
|
package/docs/videos.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: videos
|
|
3
|
+
title: Videos
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> Add your own videos to our [Wiki Page](https://github.com/Codeception/CodeceptJS/wiki/Videos)
|
|
7
|
+
## [Introductory Videos](https://www.youtube.com/watch?v=FPFG1rBNJ64&list=PLcFXthgti9Lt4SjSvL1ALDg6dOeTC0TvT)
|
|
8
|
+
|
|
9
|
+
Free educational videos provided by our community member **[@ontytoom](http://github.com/ontytoom)**.
|
|
10
|
+
|
|
11
|
+
1. [Installation](https://www.youtube.com/watch?v=FPFG1rBNJ64)
|
|
12
|
+
1. [Creating a Test](https://www.youtube.com/watch?v=mdQZjL3h9d0)
|
|
13
|
+
1. [Using Page Objects](https://www.youtube.com/watch?v=s677_6VctjQ)
|
|
14
|
+
|
|
15
|
+
## [Practical E2E Testing with CodeceptJS](https://www.udemy.com/practical-e2e-testing-with-codeceptjs/)
|
|
16
|
+
|
|
17
|
+
Udemy course by Luke Beilharz
|
|
18
|
+
|
|
19
|
+
|
|
@@ -4,5 +4,5 @@ Field is located by name, label, CSS or XPath
|
|
|
4
4
|
```js
|
|
5
5
|
I.appendField('#myTextField', 'appended');
|
|
6
6
|
```
|
|
7
|
-
@param field located by label|name|CSS|XPath|strict locator
|
|
8
|
-
@param value text value to append.
|
|
7
|
+
@param {string|object} field located by label|name|CSS|XPath|strict locator
|
|
8
|
+
@param {string} value text value to append.
|
|
@@ -7,5 +7,5 @@ I.attachFile('Avatar', 'data/avatar.jpg');
|
|
|
7
7
|
I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
-
@param locator field located by label|name|CSS|XPath|strict locator.
|
|
11
|
-
@param pathToFile local file path relative to codecept.json config file.
|
|
10
|
+
@param {string|object} locator field located by label|name|CSS|XPath|strict locator.
|
|
11
|
+
@param {string} pathToFile local file path relative to codecept.json config file.
|
|
@@ -8,5 +8,5 @@ I.checkOption('#agree');
|
|
|
8
8
|
I.checkOption('I Agree to Terms and Conditions');
|
|
9
9
|
I.checkOption('agree', '//form');
|
|
10
10
|
```
|
|
11
|
-
@param field checkbox located by label | name | CSS | XPath | strict locator.
|
|
12
|
-
@param context (optional) element located by CSS | XPath | strict locator.
|
|
11
|
+
@param {string|object} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
12
|
+
@param {string} context (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
@@ -20,5 +20,5 @@ I.click('Logout', '#nav');
|
|
|
20
20
|
I.click({css: 'nav a.login'});
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
@param locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
24
|
-
@param context (optional) element to search in CSS|XPath|Strict locator.
|
|
23
|
+
@param {string|object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
24
|
+
@param {string|object} context (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Performs a click on a link and waits for navigation before moving on.
|
|
2
2
|
|
|
3
3
|
```js
|
|
4
|
-
I.
|
|
4
|
+
I.clickLink('Logout', '#nav');
|
|
5
5
|
```
|
|
6
|
-
@param locator clickable link or button located by text, or any element located by CSS|XPath|strict locator
|
|
7
|
-
@param context (optional) element to search in CSS|XPath|Strict locator
|
|
6
|
+
@param {string|object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator
|
|
7
|
+
@param {string|object} context (optional, `null` by default) element to search in CSS|XPath|Strict locator
|
|
@@ -2,7 +2,10 @@ Opposite to `see`. Checks that a text is not present on a page.
|
|
|
2
2
|
Use context parameter to narrow down the search.
|
|
3
3
|
|
|
4
4
|
```js
|
|
5
|
-
I.dontSee('Login'); // assume we are already logged in
|
|
5
|
+
I.dontSee('Login'); // assume we are already logged in.
|
|
6
|
+
I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
6
7
|
```
|
|
7
|
-
|
|
8
|
-
@param
|
|
8
|
+
|
|
9
|
+
@param {string} text which is not present.
|
|
10
|
+
@param {string|object} context (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
11
|
+
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
Verifies that the specified checkbox is not checked.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
```js
|
|
4
|
+
I.dontSeeeCheckboxIsChedcked('#agree'); // located by ID
|
|
5
|
+
I.dontSeeeCheckboxIsChedcked('I agree to terms'); // located by label
|
|
6
|
+
I.dontSeeeCheckboxIsChedcked('agree'); // located by name
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
@param {string|object} field located by label|name|CSS|XPath|strict locator.
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
Checks that current url is not equal to provided one.
|
|
2
2
|
If a relative url provided, a configured url will be prepended to it.
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
```js
|
|
5
|
+
I.dontSeeCurrentUrlEquals('/login'); // relative url are ok
|
|
6
|
+
I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also ok
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
@param {string} url value to check.
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
Opposite to `seeElement`. Checks that element is not visible (or in DOM)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
```js
|
|
4
|
+
I.dontSeeElement('.modal'); // modal is not shown
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
@param {string|object} locator located by CSS|XPath|Strict locator.
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
Opposite to `seeElementInDOM`. Checks that element is not on page.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
```js
|
|
4
|
+
I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
@param {string|object} locator located by CSS|XPath|Strict locator.
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
Checks that value of input field or textare doesn't equal to given value
|
|
2
2
|
Opposite to `seeInField`.
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
@
|
|
4
|
+
```js
|
|
5
|
+
I.dontSeeInField('email', 'user@user.com'); // field by name
|
|
6
|
+
I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
@param {string|object} field located by label|name|CSS|XPath|strict locator.
|
|
10
|
+
@param {string} value value to check.
|
|
@@ -8,5 +8,5 @@ I.doubleClick({css: 'button.accept'});
|
|
|
8
8
|
I.doubleClick('.btn.edit');
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
@param locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
12
|
-
@param context (optional) element to search in CSS|XPath|Strict locator.
|
|
11
|
+
@param {string|object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
12
|
+
@param {string|object} context (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
@@ -7,5 +7,5 @@ If no custom file name is provided, the default name will be used
|
|
|
7
7
|
I.downloadFile('td[class="text-right file-link"] a', 'thisIsCustomName');
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
-
@param locator clickable link or button located by CSS|XPath locator.
|
|
11
|
-
@param string custom file name.
|
|
10
|
+
@param {string|object} locator clickable link or button located by CSS|XPath locator.
|
|
11
|
+
@param {string} file custom file name.
|
|
@@ -4,5 +4,5 @@ Drag an item to a destination element.
|
|
|
4
4
|
I.dragAndDrop('#dragHandle', '#container');
|
|
5
5
|
```
|
|
6
6
|
|
|
7
|
-
@param srcElement located by CSS|XPath|strict locator.
|
|
8
|
-
@param destElement located by CSS|XPath|strict locator.
|
|
7
|
+
@param {string|object} srcElement located by CSS|XPath|strict locator.
|
|
8
|
+
@param {string|object} destElement located by CSS|XPath|strict locator.
|
|
@@ -6,5 +6,5 @@ I.dragSlider('#slider', 30);
|
|
|
6
6
|
I.dragSlider('#slider', -70);
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
@param locator located by label|name|CSS|XPath|strict locator.
|
|
10
|
-
@param offsetX position to drag.
|
|
9
|
+
@param {string|object} locator located by label|name|CSS|XPath|strict locator.
|
|
10
|
+
@param {number} offsetX position to drag.
|
|
@@ -19,5 +19,5 @@ let val = await I.executeAsyncScript(function(url, done) {
|
|
|
19
19
|
}, 'http://ajax.callback.url/');
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
@param fn function to be executed in browser context.
|
|
22
|
+
@param {string|function} fn function to be executed in browser context.
|
|
23
23
|
@param ...args args to be passed to function.
|
|
@@ -21,5 +21,5 @@ let date = await I.executeScript(function(el) {
|
|
|
21
21
|
}, '#date'); // passing jquery selector
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
@param fn function to be executed in browser context.
|
|
24
|
+
@param {string|function} fn function to be executed in browser context.
|
|
25
25
|
@param ...args args to be passed to function.
|
|
@@ -11,5 +11,5 @@ I.fillField('form#login input[name=username]', 'John');
|
|
|
11
11
|
// or by strict locator
|
|
12
12
|
I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
13
13
|
```
|
|
14
|
-
@param field located by label|name|CSS|XPath|strict locator.
|
|
15
|
-
@param value text value to fill.
|
|
14
|
+
@param {string|object} field located by label|name|CSS|XPath|strict locator.
|
|
15
|
+
@param {string} value text value to fill.
|
|
@@ -5,5 +5,6 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
5
5
|
```js
|
|
6
6
|
let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
7
7
|
```
|
|
8
|
-
@param locator element located by CSS|XPath|strict locator.
|
|
9
|
-
@param attr attribute name.
|
|
8
|
+
@param {string|object} locator element located by CSS|XPath|strict locator.
|
|
9
|
+
@param {string} attr attribute name.
|
|
10
|
+
@returns {Promise<string>} attribute value
|
|
@@ -5,5 +5,6 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
5
5
|
const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
6
6
|
```
|
|
7
7
|
|
|
8
|
-
@param locator element located by CSS|XPath|strict locator.
|
|
9
|
-
@param cssProperty CSS property name.
|
|
8
|
+
@param {string|object} locator element located by CSS|XPath|strict locator.
|
|
9
|
+
@param {string} cssProperty CSS property name.
|
|
10
|
+
@returns {Promise<string>} CSS value
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Grab the data from performance timing using Navigation Timing API.
|
|
2
|
+
The returned data will contain following things in ms:
|
|
3
|
+
- responseEnd,
|
|
4
|
+
- domInteractive,
|
|
5
|
+
- domContentLoadedEventEnd,
|
|
6
|
+
- loadEventEnd
|
|
7
|
+
Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
await I.amOnPage('https://example.com');
|
|
11
|
+
let data = await I.grabDataFromPerformanceTiming();
|
|
12
|
+
//Returned data
|
|
13
|
+
{ // all results are in [ms]
|
|
14
|
+
responseEnd: 23,
|
|
15
|
+
domInteractive: 44,
|
|
16
|
+
domContentLoadedEventEnd: 196,
|
|
17
|
+
loadEventEnd: 241
|
|
18
|
+
}
|
|
19
|
+
```
|
|
@@ -6,4 +6,5 @@ If more than one element is found - an array of HTMLs returned.
|
|
|
6
6
|
let postHTML = await I.grabHTMLFrom('#post');
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
@param locator element located by CSS|XPath|strict locator.
|
|
9
|
+
@param locator element located by CSS|XPath|strict locator.
|
|
10
|
+
@returns {Promise<string>} HTML code for an element
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
Grab number of visible elements by locator.
|
|
2
2
|
|
|
3
3
|
```js
|
|
4
|
-
I.grabNumberOfVisibleElements('p');
|
|
4
|
+
let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
5
5
|
```
|
|
6
6
|
|
|
7
|
-
@param locator located by CSS|XPath|strict locator.
|
|
7
|
+
@param {string|object} locator located by CSS|XPath|strict locator.
|
|
8
|
+
@returns {Promise<number>} number of visible elements
|
|
@@ -6,4 +6,5 @@ let pin = await I.grabTextFrom('#pin');
|
|
|
6
6
|
```
|
|
7
7
|
If multiple elements found returns an array of texts.
|
|
8
8
|
|
|
9
|
-
@param locator element located by CSS|XPath|strict locator.
|
|
9
|
+
@param locator element located by CSS|XPath|strict locator.
|
|
10
|
+
@returns {Promise<string>} attribute value
|
|
@@ -4,4 +4,5 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
4
4
|
```js
|
|
5
5
|
let email = await I.grabValueFrom('input[name=email]');
|
|
6
6
|
```
|
|
7
|
-
@param locator field located by label|name|CSS|XPath|strict locator.
|
|
7
|
+
@param {string|object} locator field located by label|name|CSS|XPath|strict locator.
|
|
8
|
+
@returns {Promise<string>} attribute value
|
|
@@ -6,6 +6,6 @@ I.moveCursorTo('.tooltip');
|
|
|
6
6
|
I.moveCursorTo('#submit', 5,5);
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
@param locator located by CSS|XPath|strict locator.
|
|
10
|
-
@param offsetX (optional) X-axis offset.
|
|
11
|
-
@param offsetY (optional) Y-axis offset.
|
|
9
|
+
@param {string|object} locator located by CSS|XPath|strict locator.
|
|
10
|
+
@param {number} offsetX (optional, `0` by default) X-axis offset.
|
|
11
|
+
@param {number} offsetY (optional, `0` by default) Y-axis offset.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Resize the current window to provided width and height.
|
|
2
2
|
First parameter can be set to `maximize`.
|
|
3
3
|
|
|
4
|
-
@param width width in pixels or `maximize`.
|
|
5
|
-
@param height height in pixels.
|
|
4
|
+
@param {number} width width in pixels or `maximize`.
|
|
5
|
+
@param {number} height height in pixels.
|
|
@@ -9,5 +9,5 @@ I.rightClick('Click me');
|
|
|
9
9
|
I.rightClick('Click me', '.context');
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
@param locator clickable element located by CSS|XPath|strict locator.
|
|
13
|
-
@param context (optional) element located by CSS|XPath|strict locator.
|
|
12
|
+
@param {string|object} locator clickable element located by CSS|XPath|strict locator.
|
|
13
|
+
@param {string|object} context (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
|
|
2
|
-
Filename is relative to output folder.
|
|
2
|
+
Filename is relative to output folder.
|
|
3
3
|
Optionally resize the window to the full available page `scrollHeight` and `scrollWidth` to capture the entire page by passing `true` in as the second argument.
|
|
4
4
|
|
|
5
5
|
```js
|
|
@@ -7,5 +7,5 @@ I.saveScreenshot('debug.png');
|
|
|
7
7
|
I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scrollWidth before taking screenshot
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
-
@param fileName file name to save.
|
|
11
|
-
@param fullPage (optional) flag to enable fullscreen screenshot mode.
|
|
10
|
+
@param {string} fileName file name to save.
|
|
11
|
+
@param {boolean} fullPage (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
package/docs/webapi/say.mustache
CHANGED
|
@@ -5,5 +5,5 @@ I.say('This is red', 'red'); //red is used
|
|
|
5
5
|
I.say('This is blue', 'blue'); //blue is used
|
|
6
6
|
I.say('This is by default'); //cyan is used
|
|
7
7
|
```
|
|
8
|
-
@param text expected on console log.
|
|
9
|
-
@param
|
|
8
|
+
@param {string} text expected on console log.
|
|
9
|
+
@param {string} [color='cyan'] color you want to use.
|