codeceptjs 3.0.3 → 3.0.7
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 +114 -18
- package/bin/codecept.js +1 -0
- package/docs/basics.md +2 -2
- package/docs/bdd.md +12 -1
- package/docs/build/Appium.js +2 -1
- package/docs/build/GraphQL.js +9 -10
- package/docs/build/Nightmare.js +4 -5
- package/docs/build/Playwright.js +164 -37
- package/docs/build/Protractor.js +1 -1
- package/docs/build/Puppeteer.js +1 -1
- package/docs/build/REST.js +24 -4
- package/docs/build/TestCafe.js +1 -1
- package/docs/build/WebDriver.js +85 -17
- package/docs/changelog.md +114 -18
- package/docs/data.md +5 -5
- package/docs/detox.md +2 -2
- package/docs/docker.md +11 -11
- package/docs/email.md +8 -8
- package/docs/helpers/Appium.md +1 -1
- package/docs/helpers/Nightmare.md +4 -5
- package/docs/helpers/Playwright.md +94 -64
- package/docs/helpers/Protractor.md +1 -1
- package/docs/helpers/Puppeteer.md +1 -1
- package/docs/helpers/REST.md +9 -0
- package/docs/helpers/TestCafe.md +1 -1
- package/docs/helpers/WebDriver.md +2 -1
- package/docs/locators.md +29 -2
- package/docs/mobile-react-native-locators.md +2 -2
- package/docs/mobile.md +3 -3
- package/docs/nightmare.md +0 -5
- package/docs/pageobjects.md +3 -1
- package/docs/parallel.md +35 -10
- package/docs/playwright.md +55 -8
- package/docs/plugins.md +73 -29
- package/docs/reports.md +8 -7
- package/docs/typescript.md +47 -5
- package/docs/webapi/fillField.mustache +1 -1
- package/lib/cli.js +25 -10
- package/lib/codecept.js +9 -1
- package/lib/command/interactive.js +10 -9
- package/lib/command/run.js +1 -1
- package/lib/command/workers/runTests.js +11 -6
- package/lib/config.js +8 -3
- package/lib/event.js +2 -0
- package/lib/helper/Appium.js +1 -0
- package/lib/helper/GraphQL.js +9 -10
- package/lib/helper/Nightmare.js +1 -1
- package/lib/helper/Playwright.js +131 -38
- package/lib/helper/REST.js +24 -4
- package/lib/helper/WebDriver.js +84 -16
- package/lib/interfaces/gherkin.js +11 -4
- package/lib/output.js +7 -4
- package/lib/plugin/allure.js +3 -7
- package/lib/plugin/fakerTransform.js +51 -0
- package/lib/plugin/screenshotOnFail.js +6 -2
- package/lib/recorder.js +9 -0
- package/lib/step.js +2 -1
- package/lib/transform.js +26 -0
- package/lib/ui.js +6 -2
- package/lib/within.js +1 -1
- package/lib/workers.js +39 -25
- package/package.json +14 -9
- package/typings/index.d.ts +49 -21
- package/typings/types.d.ts +72 -26
package/docs/email.md
CHANGED
|
@@ -6,10 +6,10 @@ title: Email Testing
|
|
|
6
6
|
# Email Testing
|
|
7
7
|
|
|
8
8
|
In End 2 End testing we need to interact with emails.
|
|
9
|
-
Email delivery can't tested locally or mocked while testing.
|
|
10
|
-
That's why for an end to end test you need
|
|
9
|
+
Email delivery can't be tested locally or mocked while testing.
|
|
10
|
+
That's why for an end to end test you need real emails to be sent and real email address to receive that emails.
|
|
11
11
|
|
|
12
|
-
Setting up an email server can be hard. So we recommend to use
|
|
12
|
+
Setting up an email server can be hard. So we recommend to use [MailSlurp](https://mailslurp.com/) - a service designed for testing emails. It creates disposable mailboxes and provides you an access to those mailboxes via REST API.
|
|
13
13
|
|
|
14
14
|
> You no longer need to open your gmail account in a browser to check for an email!
|
|
15
15
|
|
|
@@ -41,7 +41,7 @@ npx codeceptjs def
|
|
|
41
41
|
|
|
42
42
|
## Creating Mailbox
|
|
43
43
|
|
|
44
|
-
MailSlurp allows you to create disposable mailboxes. It means that an email address is created for
|
|
44
|
+
MailSlurp allows you to create disposable mailboxes. It means that an email address is created for one test only and is deleted afterwards. So you can be confident that no other emails are received at that address.
|
|
45
45
|
|
|
46
46
|
To create a mailbox use `I.haveNewMailbox()` command:
|
|
47
47
|
|
|
@@ -57,7 +57,7 @@ mailbox object contains:
|
|
|
57
57
|
|
|
58
58
|
> See [MailSlurp's guide](https://www.mailslurp.com/guides/getting-started/#create-email-addresses) for details.
|
|
59
59
|
|
|
60
|
-
Mailbox is opened on creation. If you need more than one
|
|
60
|
+
Mailbox is opened on creation. If you need more than one mailbox and you want to switch between them use `openMailbox` method:
|
|
61
61
|
|
|
62
62
|
```js
|
|
63
63
|
const mailbox1 = await I.haveNewMailbox();
|
|
@@ -71,7 +71,7 @@ I.openMailbox(mailbox1);
|
|
|
71
71
|
|
|
72
72
|
A last created mailbox will be activated. It means that it will be used by default to check for emails.
|
|
73
73
|
|
|
74
|
-
After an action that triggers sending an email is performed on a website you should wait for this email to be received.
|
|
74
|
+
After an action that triggers sending an email is performed on a website, you should wait for this email to be received.
|
|
75
75
|
A timeout for waiting an email can be set globally for a helper or for a one call.
|
|
76
76
|
|
|
77
77
|
Use `waitForLatestEmail` function to return the first email from a mailbox:
|
|
@@ -109,7 +109,7 @@ const email = await I.waitForLatestEmail();
|
|
|
109
109
|
```
|
|
110
110
|
> Please note, that we use `await` to assign email. This should be declared inside async function
|
|
111
111
|
|
|
112
|
-
An `email` object contains following fields:
|
|
112
|
+
An `email` object contains the following fields:
|
|
113
113
|
|
|
114
114
|
* `subject`
|
|
115
115
|
* `for`
|
|
@@ -130,7 +130,7 @@ I.amOnPage(url);
|
|
|
130
130
|
|
|
131
131
|
## Assertions
|
|
132
132
|
|
|
133
|
-
Assertions are performed on the currently opened email.Email is opened on `waitFor` email call, however, you can open an exact email by using `openEmail` function.
|
|
133
|
+
Assertions are performed on the currently opened email. Email is opened on `waitFor` email call, however, you can open an exact email by using `openEmail` function.
|
|
134
134
|
|
|
135
135
|
```js
|
|
136
136
|
const email1 = await I.waitForLatestEmail();
|
package/docs/helpers/Appium.md
CHANGED
|
@@ -911,7 +911,7 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
911
911
|
#### Parameters
|
|
912
912
|
|
|
913
913
|
- `field` **([string][4] \| [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
914
|
-
- `value` **[string][4]** text value to fill.
|
|
914
|
+
- `value` **([string][4] \| [object][6])** text value to fill.
|
|
915
915
|
|
|
916
916
|
### grabTextFromAll
|
|
917
917
|
|
|
@@ -415,7 +415,7 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
415
415
|
#### Parameters
|
|
416
416
|
|
|
417
417
|
- `field` **([string][3] | [object][4])** located by label|name|CSS|XPath|strict locator.
|
|
418
|
-
- `value` **[string][3]** text value to fill.
|
|
418
|
+
- `value` **([string][3] | [object][4])** text value to fill.
|
|
419
419
|
|
|
420
420
|
### grabAttributeFrom
|
|
421
421
|
|
|
@@ -653,19 +653,18 @@ Returns **[Promise][8]<[string][3]>** attribute value
|
|
|
653
653
|
|
|
654
654
|
### grabValueFromAll
|
|
655
655
|
|
|
656
|
-
Retrieves
|
|
656
|
+
Retrieves an array of value from a form located by CSS or XPath and returns it to test.
|
|
657
657
|
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
658
|
-
If more than one element is found - value of first element is returned.
|
|
659
658
|
|
|
660
659
|
```js
|
|
661
|
-
let
|
|
660
|
+
let inputs = await I.grabValueFromAll('//form/input');
|
|
662
661
|
```
|
|
663
662
|
|
|
664
663
|
#### Parameters
|
|
665
664
|
|
|
666
665
|
- `locator` **([string][3] | [object][4])** field located by label|name|CSS|XPath|strict locator.
|
|
667
666
|
|
|
668
|
-
Returns **[Promise][8]<[string][3]
|
|
667
|
+
Returns **[Promise][8]<[Array][10]<[string][3]>>** attribute value
|
|
669
668
|
|
|
670
669
|
### haveHeader
|
|
671
670
|
|
|
@@ -28,7 +28,7 @@ Requires `playwright` package version ^1 to be installed:
|
|
|
28
28
|
This helper should be configured in codecept.json or codecept.conf.js
|
|
29
29
|
|
|
30
30
|
- `url`: base url of website to be tested
|
|
31
|
-
- `browser`: a browser to test on, either: `chromium`, `firefox`, `webkit`. Default: chromium.
|
|
31
|
+
- `browser`: a browser to test on, either: `chromium`, `firefox`, `webkit`, `electron`. Default: chromium.
|
|
32
32
|
- `show`: - show browser window.
|
|
33
33
|
- `restart`: - restart browser between tests.
|
|
34
34
|
- `disableScreenshots`: - don't save screenshot on failure.
|
|
@@ -47,6 +47,7 @@ This helper should be configured in codecept.json or codecept.conf.js
|
|
|
47
47
|
- `userAgent`: (optional) user-agent string.
|
|
48
48
|
- `manualStart`: - do not start browser before a test, start it manually inside a helper with `this.helpers["Playwright"]._startBrowser()`.
|
|
49
49
|
- `chromium`: (optional) pass additional chromium options
|
|
50
|
+
- `electron`: (optional) pass additional electron options
|
|
50
51
|
|
|
51
52
|
#### Example #1: Wait for 0 network connections.
|
|
52
53
|
|
|
@@ -99,7 +100,7 @@ This helper should be configured in codecept.json or codecept.conf.js
|
|
|
99
100
|
Playwright: {
|
|
100
101
|
url: "http://localhost",
|
|
101
102
|
chromium: {
|
|
102
|
-
browserWSEndpoint:
|
|
103
|
+
browserWSEndpoint: { wsEndpoint: 'ws://localhost:9222/devtools/browser/c5aa6160-b5bc-4d53-bb49-6ecb36cd2e0a' }
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
106
|
}
|
|
@@ -117,6 +118,7 @@ This helper should be configured in codecept.json or codecept.conf.js
|
|
|
117
118
|
url: "http://localhost",
|
|
118
119
|
show: true // headless mode not supported for extensions
|
|
119
120
|
chromium: {
|
|
121
|
+
userDataDir: '/tmp/playwright-tmp', // necessary to launch the browser in normal mode instead of incognito,
|
|
120
122
|
args: [
|
|
121
123
|
`--disable-extensions-except=${pathToExtension}`,
|
|
122
124
|
`--load-extension=${pathToExtension}`
|
|
@@ -174,6 +176,14 @@ Add the 'dialog' event listener to a page
|
|
|
174
176
|
|
|
175
177
|
- `page`
|
|
176
178
|
|
|
179
|
+
### _contextLocator
|
|
180
|
+
|
|
181
|
+
Grab Locator if called within Context
|
|
182
|
+
|
|
183
|
+
#### Parameters
|
|
184
|
+
|
|
185
|
+
- `locator` **any**
|
|
186
|
+
|
|
177
187
|
### _getPageUrl
|
|
178
188
|
|
|
179
189
|
Gets page URL including hash.
|
|
@@ -612,8 +622,10 @@ If a function returns a Promise it will wait for its resolution.
|
|
|
612
622
|
|
|
613
623
|
#### Parameters
|
|
614
624
|
|
|
615
|
-
- `fn`
|
|
616
|
-
- `arg`
|
|
625
|
+
- `fn` **([string][7] | [function][9])** function to be executed in browser context.
|
|
626
|
+
- `arg` **any?** optional argument to pass to the function
|
|
627
|
+
|
|
628
|
+
Returns **[Promise][10]<any>**
|
|
617
629
|
|
|
618
630
|
### fillField
|
|
619
631
|
|
|
@@ -634,21 +646,39 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
634
646
|
#### Parameters
|
|
635
647
|
|
|
636
648
|
- `field` **([string][7] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
637
|
-
- `value` **[string][7]** text value to fill.
|
|
649
|
+
- `value` **([string][7] | [object][5])** text value to fill.
|
|
638
650
|
|
|
639
651
|
### forceClick
|
|
640
652
|
|
|
641
|
-
|
|
653
|
+
Perform an emulated click on a link or a button, given by a locator.
|
|
654
|
+
Unlike normal click instead of sending native event, emulates a click with JavaScript.
|
|
655
|
+
This works on hidden, animated or inactive elements as well.
|
|
656
|
+
|
|
657
|
+
If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
|
|
658
|
+
For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
|
|
659
|
+
For images, the "alt" attribute and inner text of any parent links are searched.
|
|
660
|
+
|
|
661
|
+
The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
642
662
|
|
|
643
663
|
```js
|
|
644
|
-
|
|
645
|
-
I.forceClick('
|
|
664
|
+
// simple link
|
|
665
|
+
I.forceClick('Logout');
|
|
666
|
+
// button of form
|
|
667
|
+
I.forceClick('Submit');
|
|
668
|
+
// CSS button
|
|
669
|
+
I.forceClick('#form input[type=submit]');
|
|
670
|
+
// XPath
|
|
671
|
+
I.forceClick('//form/*[@type=submit]');
|
|
672
|
+
// link in context
|
|
673
|
+
I.forceClick('Logout', '#nav');
|
|
674
|
+
// using strict locator
|
|
675
|
+
I.forceClick({css: 'nav a.login'});
|
|
646
676
|
```
|
|
647
677
|
|
|
648
678
|
#### Parameters
|
|
649
679
|
|
|
650
|
-
- `locator`
|
|
651
|
-
- `context`
|
|
680
|
+
- `locator` **([string][7] | [object][5])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
681
|
+
- `context` **([string][7]? | [object][5])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
652
682
|
|
|
653
683
|
### grabAttributeFrom
|
|
654
684
|
|
|
@@ -665,7 +695,7 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
665
695
|
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
666
696
|
- `attr` **[string][7]** attribute name.
|
|
667
697
|
|
|
668
|
-
Returns **[Promise][
|
|
698
|
+
Returns **[Promise][10]<[string][7]>** attribute value
|
|
669
699
|
|
|
670
700
|
### grabAttributeFromAll
|
|
671
701
|
|
|
@@ -681,7 +711,7 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
681
711
|
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
682
712
|
- `attr` **[string][7]** attribute name.
|
|
683
713
|
|
|
684
|
-
Returns **[Promise][
|
|
714
|
+
Returns **[Promise][10]<[Array][11]<[string][7]>>** attribute value
|
|
685
715
|
|
|
686
716
|
### grabBrowserLogs
|
|
687
717
|
|
|
@@ -692,7 +722,7 @@ let logs = await I.grabBrowserLogs();
|
|
|
692
722
|
console.log(JSON.stringify(logs))
|
|
693
723
|
```
|
|
694
724
|
|
|
695
|
-
Returns **[Promise][
|
|
725
|
+
Returns **[Promise][10]<[Array][11]<any>>**
|
|
696
726
|
|
|
697
727
|
### grabCookie
|
|
698
728
|
|
|
@@ -709,7 +739,7 @@ assert(cookie.value, '123456');
|
|
|
709
739
|
|
|
710
740
|
- `name` **[string][7]?** cookie name.
|
|
711
741
|
|
|
712
|
-
Returns **([Promise][
|
|
742
|
+
Returns **([Promise][10]<[string][7]> | [Promise][10]<[Array][11]<[string][7]>>)** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
713
743
|
|
|
714
744
|
### grabCssPropertyFrom
|
|
715
745
|
|
|
@@ -726,7 +756,7 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
726
756
|
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
727
757
|
- `cssProperty` **[string][7]** CSS property name.
|
|
728
758
|
|
|
729
|
-
Returns **[Promise][
|
|
759
|
+
Returns **[Promise][10]<[string][7]>** CSS value
|
|
730
760
|
|
|
731
761
|
### grabCssPropertyFromAll
|
|
732
762
|
|
|
@@ -742,7 +772,7 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
742
772
|
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
743
773
|
- `cssProperty` **[string][7]** CSS property name.
|
|
744
774
|
|
|
745
|
-
Returns **[Promise][
|
|
775
|
+
Returns **[Promise][10]<[Array][11]<[string][7]>>** CSS value
|
|
746
776
|
|
|
747
777
|
### grabCurrentUrl
|
|
748
778
|
|
|
@@ -754,7 +784,7 @@ let url = await I.grabCurrentUrl();
|
|
|
754
784
|
console.log(`Current URL is [${url}]`);
|
|
755
785
|
```
|
|
756
786
|
|
|
757
|
-
Returns **[Promise][
|
|
787
|
+
Returns **[Promise][10]<[string][7]>** current URL
|
|
758
788
|
|
|
759
789
|
### grabDataFromPerformanceTiming
|
|
760
790
|
|
|
@@ -805,7 +835,7 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
805
835
|
- `prop`
|
|
806
836
|
- `elementSize` **[string][7]?** x, y, width or height of the given element.
|
|
807
837
|
|
|
808
|
-
Returns **([Promise][
|
|
838
|
+
Returns **([Promise][10]<DOMRect> | [Promise][10]<[number][8]>)** Element bounding rectangle
|
|
809
839
|
|
|
810
840
|
### grabHTMLFrom
|
|
811
841
|
|
|
@@ -822,7 +852,7 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
822
852
|
- `locator`
|
|
823
853
|
- `element` **([string][7] | [object][5])** located by CSS|XPath|strict locator.
|
|
824
854
|
|
|
825
|
-
Returns **[Promise][
|
|
855
|
+
Returns **[Promise][10]<[string][7]>** HTML code for an element
|
|
826
856
|
|
|
827
857
|
### grabHTMLFromAll
|
|
828
858
|
|
|
@@ -838,7 +868,7 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
838
868
|
- `locator`
|
|
839
869
|
- `element` **([string][7] | [object][5])** located by CSS|XPath|strict locator.
|
|
840
870
|
|
|
841
|
-
Returns **[Promise][
|
|
871
|
+
Returns **[Promise][10]<[Array][11]<[string][7]>>** HTML code for an element
|
|
842
872
|
|
|
843
873
|
### grabNumberOfOpenTabs
|
|
844
874
|
|
|
@@ -849,7 +879,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
849
879
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
850
880
|
```
|
|
851
881
|
|
|
852
|
-
Returns **[Promise][
|
|
882
|
+
Returns **[Promise][10]<[number][8]>** number of open tabs
|
|
853
883
|
|
|
854
884
|
### grabNumberOfVisibleElements
|
|
855
885
|
|
|
@@ -864,7 +894,7 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
864
894
|
|
|
865
895
|
- `locator` **([string][7] | [object][5])** located by CSS|XPath|strict locator.
|
|
866
896
|
|
|
867
|
-
Returns **[Promise][
|
|
897
|
+
Returns **[Promise][10]<[number][8]>** number of visible elements
|
|
868
898
|
|
|
869
899
|
### grabPageScrollPosition
|
|
870
900
|
|
|
@@ -875,7 +905,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
875
905
|
let { x, y } = await I.grabPageScrollPosition();
|
|
876
906
|
```
|
|
877
907
|
|
|
878
|
-
Returns **[Promise][
|
|
908
|
+
Returns **[Promise][10]<PageScrollPosition>** scroll position
|
|
879
909
|
|
|
880
910
|
### grabPopupText
|
|
881
911
|
|
|
@@ -885,7 +915,7 @@ Grab the text within the popup. If no popup is visible then it will return null
|
|
|
885
915
|
await I.grabPopupText();
|
|
886
916
|
```
|
|
887
917
|
|
|
888
|
-
Returns **[Promise][
|
|
918
|
+
Returns **[Promise][10]<([string][7] | null)>**
|
|
889
919
|
|
|
890
920
|
### grabSource
|
|
891
921
|
|
|
@@ -896,7 +926,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
896
926
|
let pageSource = await I.grabSource();
|
|
897
927
|
```
|
|
898
928
|
|
|
899
|
-
Returns **[Promise][
|
|
929
|
+
Returns **[Promise][10]<[string][7]>** source code
|
|
900
930
|
|
|
901
931
|
### grabTextFrom
|
|
902
932
|
|
|
@@ -913,7 +943,7 @@ If multiple elements found returns first element.
|
|
|
913
943
|
|
|
914
944
|
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
915
945
|
|
|
916
|
-
Returns **[Promise][
|
|
946
|
+
Returns **[Promise][10]<[string][7]>** attribute value
|
|
917
947
|
|
|
918
948
|
### grabTextFromAll
|
|
919
949
|
|
|
@@ -928,7 +958,7 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
928
958
|
|
|
929
959
|
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
930
960
|
|
|
931
|
-
Returns **[Promise][
|
|
961
|
+
Returns **[Promise][10]<[Array][11]<[string][7]>>** attribute value
|
|
932
962
|
|
|
933
963
|
### grabTitle
|
|
934
964
|
|
|
@@ -939,7 +969,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
939
969
|
let title = await I.grabTitle();
|
|
940
970
|
```
|
|
941
971
|
|
|
942
|
-
Returns **[Promise][
|
|
972
|
+
Returns **[Promise][10]<[string][7]>** title
|
|
943
973
|
|
|
944
974
|
### grabValueFrom
|
|
945
975
|
|
|
@@ -955,7 +985,7 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
955
985
|
|
|
956
986
|
- `locator` **([string][7] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
957
987
|
|
|
958
|
-
Returns **[Promise][
|
|
988
|
+
Returns **[Promise][10]<[string][7]>** attribute value
|
|
959
989
|
|
|
960
990
|
### grabValueFromAll
|
|
961
991
|
|
|
@@ -970,14 +1000,14 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
970
1000
|
|
|
971
1001
|
- `locator` **([string][7] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
972
1002
|
|
|
973
|
-
Returns **[Promise][
|
|
1003
|
+
Returns **[Promise][10]<[Array][11]<[string][7]>>** attribute value
|
|
974
1004
|
|
|
975
1005
|
### handleDownloads
|
|
976
1006
|
|
|
977
1007
|
Handles a file download.Aa file name is required to save the file on disk.
|
|
978
1008
|
Files are saved to "output" directory.
|
|
979
1009
|
|
|
980
|
-
Should be used with [FileSystem helper][
|
|
1010
|
+
Should be used with [FileSystem helper][12] to check that file were downloaded correctly.
|
|
981
1011
|
|
|
982
1012
|
```js
|
|
983
1013
|
I.handleDownloads('downloads/avatar.jpg');
|
|
@@ -1028,7 +1058,7 @@ Open new tab and automatically switched to new tab
|
|
|
1028
1058
|
I.openNewTab();
|
|
1029
1059
|
```
|
|
1030
1060
|
|
|
1031
|
-
You can pass in [page options][
|
|
1061
|
+
You can pass in [page options][13] to emulate device on this page
|
|
1032
1062
|
|
|
1033
1063
|
```js
|
|
1034
1064
|
// enable mobile
|
|
@@ -1043,7 +1073,7 @@ I.openNewTab({ isMobile: true });
|
|
|
1043
1073
|
|
|
1044
1074
|
Presses a key in the browser (on a focused element).
|
|
1045
1075
|
|
|
1046
|
-
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][
|
|
1076
|
+
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][14].
|
|
1047
1077
|
|
|
1048
1078
|
```js
|
|
1049
1079
|
I.pressKey('Backspace');
|
|
@@ -1102,13 +1132,13 @@ Some of the supported key names are:
|
|
|
1102
1132
|
|
|
1103
1133
|
#### Parameters
|
|
1104
1134
|
|
|
1105
|
-
- `key` **([string][7] | [Array][
|
|
1135
|
+
- `key` **([string][7] | [Array][11]<[string][7]>)** key or array of keys to press._Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313][15]).
|
|
1106
1136
|
|
|
1107
1137
|
### pressKeyDown
|
|
1108
1138
|
|
|
1109
1139
|
Presses a key in the browser and leaves it in a down state.
|
|
1110
1140
|
|
|
1111
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1141
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][16]).
|
|
1112
1142
|
|
|
1113
1143
|
```js
|
|
1114
1144
|
I.pressKeyDown('Control');
|
|
@@ -1124,7 +1154,7 @@ I.pressKeyUp('Control');
|
|
|
1124
1154
|
|
|
1125
1155
|
Releases a key in the browser which was previously set to a down state.
|
|
1126
1156
|
|
|
1127
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1157
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][16]).
|
|
1128
1158
|
|
|
1129
1159
|
```js
|
|
1130
1160
|
I.pressKeyDown('Control');
|
|
@@ -1206,7 +1236,7 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
1206
1236
|
#### Parameters
|
|
1207
1237
|
|
|
1208
1238
|
- `fileName` **[string][7]** file name to save.
|
|
1209
|
-
- `fullPage` **[boolean][
|
|
1239
|
+
- `fullPage` **[boolean][17]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1210
1240
|
|
|
1211
1241
|
### scrollPageToBottom
|
|
1212
1242
|
|
|
@@ -1466,7 +1496,7 @@ I.seeTitleEquals('Test title.');
|
|
|
1466
1496
|
|
|
1467
1497
|
#### Parameters
|
|
1468
1498
|
|
|
1469
|
-
- `text`
|
|
1499
|
+
- `text` **[string][7]** value to check.
|
|
1470
1500
|
|
|
1471
1501
|
### selectOption
|
|
1472
1502
|
|
|
@@ -1492,7 +1522,7 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1492
1522
|
#### Parameters
|
|
1493
1523
|
|
|
1494
1524
|
- `select` **([string][7] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
1495
|
-
- `option` **([string][7] | [Array][
|
|
1525
|
+
- `option` **([string][7] | [Array][11]<any>)** visible text or value of option.
|
|
1496
1526
|
|
|
1497
1527
|
### setCookie
|
|
1498
1528
|
|
|
@@ -1512,7 +1542,7 @@ I.setCookie([
|
|
|
1512
1542
|
|
|
1513
1543
|
#### Parameters
|
|
1514
1544
|
|
|
1515
|
-
- `cookie` **(Cookie | [Array][
|
|
1545
|
+
- `cookie` **(Cookie | [Array][11]<Cookie>)** a cookie object or array of cookie objects.
|
|
1516
1546
|
|
|
1517
1547
|
### switchTo
|
|
1518
1548
|
|
|
@@ -1557,7 +1587,7 @@ I.switchToPreviousTab(2);
|
|
|
1557
1587
|
|
|
1558
1588
|
Types out the given text into an active field.
|
|
1559
1589
|
To slow down typing use a second parameter, to set interval between key presses.
|
|
1560
|
-
_Note:_ Should be used when [`fillField`][
|
|
1590
|
+
_Note:_ Should be used when [`fillField`][14] is not an option.
|
|
1561
1591
|
|
|
1562
1592
|
```js
|
|
1563
1593
|
// passing in a string
|
|
@@ -1574,7 +1604,7 @@ I.type(['T', 'E', 'X', 'T']);
|
|
|
1574
1604
|
|
|
1575
1605
|
- `keys`
|
|
1576
1606
|
- `delay` **[number][8]?** (optional) delay in ms between key presses
|
|
1577
|
-
- `key` **([string][7] | [Array][
|
|
1607
|
+
- `key` **([string][7] | [Array][11]<[string][7]>)** or array of keys to type.
|
|
1578
1608
|
|
|
1579
1609
|
### uncheckOption
|
|
1580
1610
|
|
|
@@ -1601,7 +1631,7 @@ Use Playwright API inside a test.
|
|
|
1601
1631
|
First argument is a description of an action.
|
|
1602
1632
|
Second argument is async function that gets this helper as parameter.
|
|
1603
1633
|
|
|
1604
|
-
{ [`page`][
|
|
1634
|
+
{ [`page`][18], [`context`][19] [`browser`][20] } objects from Playwright API are available.
|
|
1605
1635
|
|
|
1606
1636
|
```js
|
|
1607
1637
|
I.usePlaywrightTo('emulate offline mode', async ({ context }) {
|
|
@@ -1612,7 +1642,7 @@ I.usePlaywrightTo('emulate offline mode', async ({ context }) {
|
|
|
1612
1642
|
#### Parameters
|
|
1613
1643
|
|
|
1614
1644
|
- `description` **[string][7]** used to show in logs.
|
|
1615
|
-
- `fn` **[function][
|
|
1645
|
+
- `fn` **[function][9]** async functuion that executed with Playwright helper as argument
|
|
1616
1646
|
|
|
1617
1647
|
### wait
|
|
1618
1648
|
|
|
@@ -1698,8 +1728,8 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
1698
1728
|
|
|
1699
1729
|
#### Parameters
|
|
1700
1730
|
|
|
1701
|
-
- `fn` **([string][7] | [function][
|
|
1702
|
-
- `argsOrSec` **([Array][
|
|
1731
|
+
- `fn` **([string][7] | [function][9])** to be executed in browser context.
|
|
1732
|
+
- `argsOrSec` **([Array][11]<any> | [number][8])?** (optional, `1` by default) arguments for function or seconds.
|
|
1703
1733
|
- `sec` **[number][8]?** (optional, `1` by default) time in seconds to wait
|
|
1704
1734
|
|
|
1705
1735
|
### waitForInvisible
|
|
@@ -1720,7 +1750,7 @@ I.waitForInvisible('#popup');
|
|
|
1720
1750
|
|
|
1721
1751
|
Waits for navigation to finish. By default takes configured `waitForNavigation` option.
|
|
1722
1752
|
|
|
1723
|
-
See [
|
|
1753
|
+
See [Playwright's reference][21]
|
|
1724
1754
|
|
|
1725
1755
|
#### Parameters
|
|
1726
1756
|
|
|
@@ -1737,7 +1767,7 @@ I.waitForRequest(request => request.url() === 'http://example.com' && request.me
|
|
|
1737
1767
|
|
|
1738
1768
|
#### Parameters
|
|
1739
1769
|
|
|
1740
|
-
- `urlOrPredicate` **([string][7] | [function][
|
|
1770
|
+
- `urlOrPredicate` **([string][7] | [function][9])**
|
|
1741
1771
|
- `sec` **[number][8]?** seconds to wait
|
|
1742
1772
|
|
|
1743
1773
|
### waitForResponse
|
|
@@ -1751,7 +1781,7 @@ I.waitForResponse(request => request.url() === 'http://example.com' && request.m
|
|
|
1751
1781
|
|
|
1752
1782
|
#### Parameters
|
|
1753
1783
|
|
|
1754
|
-
- `urlOrPredicate` **([string][7] | [function][
|
|
1784
|
+
- `urlOrPredicate` **([string][7] | [function][9])**
|
|
1755
1785
|
- `sec` **[number][8]?** number of seconds to wait
|
|
1756
1786
|
|
|
1757
1787
|
### waitForText
|
|
@@ -1851,7 +1881,7 @@ I.waitUntil(() => window.requests == 0, 5);
|
|
|
1851
1881
|
|
|
1852
1882
|
#### Parameters
|
|
1853
1883
|
|
|
1854
|
-
- `fn` **([function][
|
|
1884
|
+
- `fn` **([function][9] | [string][7])** function which is executed in browser context.
|
|
1855
1885
|
- `sec` **[number][8]** (optional, `1` by default) time in seconds to wait
|
|
1856
1886
|
- `timeoutMsg` **[string][7]** message to show in case of timeout fail.
|
|
1857
1887
|
- `interval` **[number][8]?**
|
|
@@ -1874,7 +1904,7 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
1874
1904
|
|
|
1875
1905
|
[2]: https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitfornavigationoptions
|
|
1876
1906
|
|
|
1877
|
-
[3]: https://
|
|
1907
|
+
[3]: https://playwright.dev/docs/api/class-browsertype#browsertypeconnectparams
|
|
1878
1908
|
|
|
1879
1909
|
[4]: https://github.com/microsoft/playwright/blob/v0.11.0/docs/api.md#working-with-chrome-extensions
|
|
1880
1910
|
|
|
@@ -1886,30 +1916,30 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
1886
1916
|
|
|
1887
1917
|
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
1888
1918
|
|
|
1889
|
-
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
1919
|
+
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
1890
1920
|
|
|
1891
|
-
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
1921
|
+
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
1892
1922
|
|
|
1893
|
-
[11]: https://
|
|
1923
|
+
[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
1894
1924
|
|
|
1895
|
-
[12]: https://
|
|
1925
|
+
[12]: https://codecept.io/helpers/FileSystem
|
|
1896
1926
|
|
|
1897
|
-
[13]: #
|
|
1927
|
+
[13]: https://github.com/microsoft/playwright/blob/master/docs/api.md#browsernewpageoptions
|
|
1898
1928
|
|
|
1899
|
-
[14]:
|
|
1929
|
+
[14]: #fillfield
|
|
1900
1930
|
|
|
1901
|
-
[15]:
|
|
1931
|
+
[15]: https://github.com/GoogleChrome/puppeteer/issues/1313
|
|
1902
1932
|
|
|
1903
|
-
[16]:
|
|
1933
|
+
[16]: #click
|
|
1904
1934
|
|
|
1905
|
-
[17]: https://
|
|
1935
|
+
[17]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
1906
1936
|
|
|
1907
|
-
[18]: https://github.com/microsoft/playwright/blob/master/docs/api.md#class-
|
|
1937
|
+
[18]: https://github.com/microsoft/playwright/blob/master/docs/api.md#class-page
|
|
1908
1938
|
|
|
1909
|
-
[19]: https://github.com/microsoft/playwright/blob/master/docs/api.md#class-
|
|
1939
|
+
[19]: https://github.com/microsoft/playwright/blob/master/docs/api.md#class-context
|
|
1910
1940
|
|
|
1911
|
-
[20]: https://
|
|
1941
|
+
[20]: https://github.com/microsoft/playwright/blob/master/docs/api.md#class-browser
|
|
1912
1942
|
|
|
1913
|
-
[21]: https://
|
|
1943
|
+
[21]: https://playwright.dev/docs/api/class-page?_highlight=waitfornavi#pagewaitfornavigationoptions
|
|
1914
1944
|
|
|
1915
1945
|
[22]: https://codecept.io/react
|
|
@@ -563,7 +563,7 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
563
563
|
#### Parameters
|
|
564
564
|
|
|
565
565
|
- `field` **([string][9] | [object][10])** located by label|name|CSS|XPath|strict locator.
|
|
566
|
-
- `value` **[string][9]** text value to fill.
|
|
566
|
+
- `value` **([string][9] | [object][10])** text value to fill.
|
|
567
567
|
|
|
568
568
|
### grabAttributeFrom
|
|
569
569
|
|
|
@@ -690,7 +690,7 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
690
690
|
#### Parameters
|
|
691
691
|
|
|
692
692
|
- `field` **([string][8] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
693
|
-
- `value` **[string][8]** text value to fill.
|
|
693
|
+
- `value` **([string][8] | [object][6])** text value to fill.
|
|
694
694
|
|
|
695
695
|
|
|
696
696
|
This action supports [React locators](https://codecept.io/react#locators)
|
package/docs/helpers/REST.md
CHANGED
|
@@ -101,6 +101,9 @@ Sends PATCH request to API.
|
|
|
101
101
|
|
|
102
102
|
```js
|
|
103
103
|
I.sendPatchRequest('/api/users.json', { "email": "user@user.com" });
|
|
104
|
+
|
|
105
|
+
// To mask the payload in logs
|
|
106
|
+
I.sendPatchRequest('/api/users.json', secret({ "email": "user@user.com" }));
|
|
104
107
|
```
|
|
105
108
|
|
|
106
109
|
#### Parameters
|
|
@@ -115,6 +118,9 @@ Sends POST request to API.
|
|
|
115
118
|
|
|
116
119
|
```js
|
|
117
120
|
I.sendPostRequest('/api/users.json', { "email": "user@user.com" });
|
|
121
|
+
|
|
122
|
+
// To mask the payload in logs
|
|
123
|
+
I.sendPostRequest('/api/users.json', secret({ "email": "user@user.com" }));
|
|
118
124
|
```
|
|
119
125
|
|
|
120
126
|
#### Parameters
|
|
@@ -129,6 +135,9 @@ Sends PUT request to API.
|
|
|
129
135
|
|
|
130
136
|
```js
|
|
131
137
|
I.sendPutRequest('/api/users.json', { "email": "user@user.com" });
|
|
138
|
+
|
|
139
|
+
// To mask the payload in logs
|
|
140
|
+
I.sendPutRequest('/api/users.json', secret({ "email": "user@user.com" }));
|
|
132
141
|
```
|
|
133
142
|
|
|
134
143
|
#### Parameters
|
package/docs/helpers/TestCafe.md
CHANGED
|
@@ -399,7 +399,7 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
399
399
|
#### Parameters
|
|
400
400
|
|
|
401
401
|
- `field` **([string][4] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
402
|
-
- `value` **[string][4]** text value to fill.
|
|
402
|
+
- `value` **([string][4] | [object][5])** text value to fill.
|
|
403
403
|
|
|
404
404
|
### grabAttributeFrom
|
|
405
405
|
|
|
@@ -868,11 +868,12 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
868
868
|
#### Parameters
|
|
869
869
|
|
|
870
870
|
- `field` **([string][19] | [object][18])** located by label|name|CSS|XPath|strict locator.
|
|
871
|
-
- `value` **[string][19]** text value to fill.
|
|
871
|
+
- `value` **([string][19] | [object][18])** text value to fill.
|
|
872
872
|
|
|
873
873
|
|
|
874
874
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
875
875
|
|
|
876
|
+
{{ custom }}
|
|
876
877
|
|
|
877
878
|
### forceClick
|
|
878
879
|
|