codeceptjs 3.2.0 → 3.3.0-beta.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 +78 -2
- package/docs/advanced.md +3 -3
- package/docs/api.md +227 -188
- package/docs/basics.md +26 -1
- package/docs/bdd.md +2 -2
- package/docs/build/ApiDataFactory.js +13 -6
- package/docs/build/Appium.js +98 -36
- package/docs/build/FileSystem.js +11 -1
- package/docs/build/GraphQL.js +11 -0
- package/docs/build/JSONResponse.js +297 -0
- package/docs/build/Nightmare.js +48 -48
- package/docs/build/Playwright.js +277 -151
- package/docs/build/Puppeteer.js +77 -68
- package/docs/build/REST.js +36 -0
- package/docs/build/TestCafe.js +44 -44
- package/docs/build/WebDriver.js +70 -70
- package/docs/changelog.md +28 -2
- package/docs/configuration.md +8 -8
- package/docs/custom-helpers.md +1 -1
- package/docs/data.md +9 -9
- package/docs/helpers/ApiDataFactory.md +7 -0
- package/docs/helpers/Appium.md +240 -198
- package/docs/helpers/FileSystem.md +11 -1
- package/docs/helpers/JSONResponse.md +230 -0
- package/docs/helpers/Playwright.md +283 -216
- package/docs/helpers/Puppeteer.md +9 -1
- package/docs/helpers/REST.md +30 -9
- package/docs/installation.md +3 -1
- package/docs/internal-api.md +265 -0
- package/docs/mobile.md +11 -11
- package/docs/nightmare.md +3 -3
- package/docs/pageobjects.md +2 -0
- package/docs/playwright.md +73 -18
- package/docs/plugins.md +140 -40
- package/docs/puppeteer.md +28 -12
- package/docs/quickstart.md +2 -3
- package/docs/reports.md +44 -3
- package/docs/testcafe.md +1 -1
- package/docs/translation.md +2 -2
- package/docs/videos.md +2 -2
- package/docs/visual.md +2 -2
- package/docs/vue.md +1 -1
- package/docs/webdriver.md +92 -4
- package/lib/actor.js +2 -2
- package/lib/cli.js +25 -20
- package/lib/command/init.js +5 -15
- package/lib/command/workers/runTests.js +25 -7
- package/lib/config.js +17 -13
- package/lib/helper/ApiDataFactory.js +13 -6
- package/lib/helper/Appium.js +65 -3
- package/lib/helper/FileSystem.js +11 -1
- package/lib/helper/GraphQL.js +11 -0
- package/lib/helper/JSONResponse.js +297 -0
- package/lib/helper/Playwright.js +215 -89
- package/lib/helper/Puppeteer.js +13 -4
- package/lib/helper/REST.js +36 -0
- package/lib/helper/WebDriver.js +1 -1
- package/lib/helper/extras/Console.js +8 -0
- package/lib/helper/extras/PlaywrightRestartOpts.js +35 -0
- package/lib/interfaces/bdd.js +3 -1
- package/lib/listener/timeout.js +4 -3
- package/lib/plugin/allure.js +12 -0
- package/lib/plugin/autoLogin.js +1 -1
- package/lib/plugin/eachElement.js +127 -0
- package/lib/plugin/retryFailedStep.js +4 -3
- package/lib/plugin/stepTimeout.js +5 -4
- package/lib/plugin/tryTo.js +6 -0
- package/lib/recorder.js +2 -1
- package/lib/step.js +57 -2
- package/lib/utils.js +20 -0
- package/package.json +6 -4
- package/translations/pt-BR.js +8 -0
- package/typings/index.d.ts +4 -0
- package/typings/types.d.ts +345 -110
package/docs/bdd.md
CHANGED
|
@@ -5,7 +5,7 @@ title: Behavior Driven Development
|
|
|
5
5
|
|
|
6
6
|
# Behavior Driven Development
|
|
7
7
|
|
|
8
|
-
Behavior Driven Development (BDD) is a popular software development methodology. BDD is considered an extension of TDD, and is greatly inspired by [Agile](
|
|
8
|
+
Behavior Driven Development (BDD) is a popular software development methodology. BDD is considered an extension of TDD, and is greatly inspired by [Agile](https://agilemanifesto.org/) practices. The primary reason to choose BDD as your development process is to break down communication barriers between business and technical teams. BDD encourages the use of automated testing to verify all documented features of a project from the very beginning. This is why it is common to talk about BDD in the context of test frameworks (like CodeceptJS). The BDD approach, however, is about much more than testing - it is a common language for all team members to use during the development process.
|
|
9
9
|
|
|
10
10
|
## What is Behavior Driven Development
|
|
11
11
|
|
|
@@ -55,7 +55,7 @@ I should see that total number of products I want to buy is 2
|
|
|
55
55
|
And my order amount is $1600
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
As we can see this simple story highlights core concepts that are called *contracts*. We should fulfill those contracts to model software correctly. But how we can verify that those contracts are being satisfied? [Cucumber](
|
|
58
|
+
As we can see this simple story highlights core concepts that are called *contracts*. We should fulfill those contracts to model software correctly. But how we can verify that those contracts are being satisfied? [Cucumber](https://cucumber.io) introduced a special language for such stories called **Gherkin**. Same story transformed to Gherkin will look like this:
|
|
59
59
|
|
|
60
60
|
```gherkin
|
|
61
61
|
Feature: checkout process
|
|
@@ -257,13 +257,16 @@ class ApiDataFactory extends Helper {
|
|
|
257
257
|
* // create user with defined email
|
|
258
258
|
* // and receive it when inside async function
|
|
259
259
|
* const user = await I.have('user', { email: 'user@user.com'});
|
|
260
|
+
* // create a user with options that will not be included in the final request
|
|
261
|
+
* I.have('user', { }, { age: 33, height: 55 })
|
|
260
262
|
* ```
|
|
261
263
|
*
|
|
262
264
|
* @param {*} factory factory to use
|
|
263
265
|
* @param {*} params predefined parameters
|
|
266
|
+
* @param {*} options options for programmatically generate the attributes
|
|
264
267
|
*/
|
|
265
|
-
have(factory, params) {
|
|
266
|
-
const item = this._createItem(factory, params);
|
|
268
|
+
have(factory, params, options) {
|
|
269
|
+
const item = this._createItem(factory, params, options);
|
|
267
270
|
this.debug(`Creating ${factory} ${JSON.stringify(item)}`);
|
|
268
271
|
return this._requestCreate(factory, item);
|
|
269
272
|
}
|
|
@@ -277,21 +280,25 @@ class ApiDataFactory extends Helper {
|
|
|
277
280
|
*
|
|
278
281
|
* // create 3 posts by one author
|
|
279
282
|
* I.haveMultiple('post', 3, { author: 'davert' });
|
|
283
|
+
*
|
|
284
|
+
* // create 3 posts by one author with options
|
|
285
|
+
* I.haveMultiple('post', 3, { author: 'davert' }, { publish_date: '01.01.1997' });
|
|
280
286
|
* ```
|
|
281
287
|
*
|
|
282
288
|
* @param {*} factory
|
|
283
289
|
* @param {*} times
|
|
284
290
|
* @param {*} params
|
|
291
|
+
* @param {*} options
|
|
285
292
|
*/
|
|
286
|
-
haveMultiple(factory, times, params) {
|
|
293
|
+
haveMultiple(factory, times, params, options) {
|
|
287
294
|
const promises = [];
|
|
288
295
|
for (let i = 0; i < times; i++) {
|
|
289
|
-
promises.push(this.have(factory, params));
|
|
296
|
+
promises.push(this.have(factory, params, options));
|
|
290
297
|
}
|
|
291
298
|
return Promise.all(promises);
|
|
292
299
|
}
|
|
293
300
|
|
|
294
|
-
_createItem(model, data) {
|
|
301
|
+
_createItem(model, data, options) {
|
|
295
302
|
if (!this.factories[model]) {
|
|
296
303
|
throw new Error(`Factory ${model} is not defined in config`);
|
|
297
304
|
}
|
|
@@ -303,7 +310,7 @@ class ApiDataFactory extends Helper {
|
|
|
303
310
|
modulePath = path.join(global.codecept_dir, modulePath);
|
|
304
311
|
}
|
|
305
312
|
const builder = require(modulePath);
|
|
306
|
-
return builder.build(data);
|
|
313
|
+
return builder.build(data, options);
|
|
307
314
|
} catch (err) {
|
|
308
315
|
throw new Error(`Couldn't load factory file from ${modulePath}, check that
|
|
309
316
|
|
package/docs/build/Appium.js
CHANGED
|
@@ -331,6 +331,7 @@ class Appium extends Webdriver {
|
|
|
331
331
|
*
|
|
332
332
|
* @param {*} caps
|
|
333
333
|
* @param {*} fn
|
|
334
|
+
* @return {Promise<any>}
|
|
334
335
|
*/
|
|
335
336
|
async runOnIOS(caps, fn) {
|
|
336
337
|
if (this.platform !== 'ios') return;
|
|
@@ -373,6 +374,7 @@ class Appium extends Webdriver {
|
|
|
373
374
|
*
|
|
374
375
|
* @param {*} caps
|
|
375
376
|
* @param {*} fn
|
|
377
|
+
* @return {Promise<any>}
|
|
376
378
|
*/
|
|
377
379
|
async runOnAndroid(caps, fn) {
|
|
378
380
|
if (this.platform !== 'android') return;
|
|
@@ -393,6 +395,7 @@ class Appium extends Webdriver {
|
|
|
393
395
|
* ```
|
|
394
396
|
*
|
|
395
397
|
* @param {*} fn
|
|
398
|
+
* @return {Promise<any>}
|
|
396
399
|
*/
|
|
397
400
|
/* eslint-disable */
|
|
398
401
|
async runInWeb(fn) {
|
|
@@ -434,6 +437,7 @@ class Appium extends Webdriver {
|
|
|
434
437
|
* ```
|
|
435
438
|
*
|
|
436
439
|
* @param {string} bundleId String ID of bundled app
|
|
440
|
+
* @return {Promise<void>}
|
|
437
441
|
*
|
|
438
442
|
* Appium: support only Android
|
|
439
443
|
*/
|
|
@@ -451,6 +455,7 @@ class Appium extends Webdriver {
|
|
|
451
455
|
* ```
|
|
452
456
|
*
|
|
453
457
|
* @param {string} bundleId String ID of bundled app
|
|
458
|
+
* @return {Promise<void>}
|
|
454
459
|
*
|
|
455
460
|
* Appium: support only Android
|
|
456
461
|
*/
|
|
@@ -467,6 +472,7 @@ class Appium extends Webdriver {
|
|
|
467
472
|
* I.installApp('/path/to/file.apk');
|
|
468
473
|
* ```
|
|
469
474
|
* @param {string} path path to apk file
|
|
475
|
+
* @return {Promise<void>}
|
|
470
476
|
*
|
|
471
477
|
* Appium: support only Android
|
|
472
478
|
*/
|
|
@@ -508,6 +514,7 @@ class Appium extends Webdriver {
|
|
|
508
514
|
* I.seeCurrentActivityIs(".HomeScreenActivity")
|
|
509
515
|
* ```
|
|
510
516
|
* @param {string} currentActivity
|
|
517
|
+
* @return {Promise<void>}
|
|
511
518
|
*
|
|
512
519
|
* Appium: support only Android
|
|
513
520
|
*/
|
|
@@ -524,6 +531,8 @@ class Appium extends Webdriver {
|
|
|
524
531
|
* I.seeDeviceIsLocked();
|
|
525
532
|
* ```
|
|
526
533
|
*
|
|
534
|
+
* @return {Promise<void>}
|
|
535
|
+
*
|
|
527
536
|
* Appium: support only Android
|
|
528
537
|
*/
|
|
529
538
|
async seeDeviceIsLocked() {
|
|
@@ -539,6 +548,8 @@ class Appium extends Webdriver {
|
|
|
539
548
|
* I.seeDeviceIsUnlocked();
|
|
540
549
|
* ```
|
|
541
550
|
*
|
|
551
|
+
* @return {Promise<void>}
|
|
552
|
+
*
|
|
542
553
|
* Appium: support only Android
|
|
543
554
|
*/
|
|
544
555
|
async seeDeviceIsUnlocked() {
|
|
@@ -555,6 +566,8 @@ class Appium extends Webdriver {
|
|
|
555
566
|
* I.seeOrientationIs('LANDSCAPE')
|
|
556
567
|
* ```
|
|
557
568
|
*
|
|
569
|
+
* @return {Promise<void>}
|
|
570
|
+
*
|
|
558
571
|
* @param {'LANDSCAPE'|'PORTRAIT'} orientation LANDSCAPE or PORTRAIT
|
|
559
572
|
*
|
|
560
573
|
* Appium: support Android and iOS
|
|
@@ -586,6 +599,7 @@ class Appium extends Webdriver {
|
|
|
586
599
|
* ```
|
|
587
600
|
*
|
|
588
601
|
* @param {'LANDSCAPE'|'PORTRAIT'} orientation LANDSCAPE or PORTRAIT
|
|
602
|
+
* @return {Promise<any>}
|
|
589
603
|
*
|
|
590
604
|
* Appium: support Android and iOS
|
|
591
605
|
*/
|
|
@@ -609,6 +623,8 @@ class Appium extends Webdriver {
|
|
|
609
623
|
* let contexts = await I.grabAllContexts();
|
|
610
624
|
* ```
|
|
611
625
|
*
|
|
626
|
+
* @return {Promise<string[]>}
|
|
627
|
+
*
|
|
612
628
|
* Appium: support Android and iOS
|
|
613
629
|
*/
|
|
614
630
|
async grabAllContexts() {
|
|
@@ -623,6 +639,8 @@ class Appium extends Webdriver {
|
|
|
623
639
|
* let context = await I.grabContext();
|
|
624
640
|
* ```
|
|
625
641
|
*
|
|
642
|
+
* @return {Promise<string|null>}
|
|
643
|
+
*
|
|
626
644
|
* Appium: support Android and iOS
|
|
627
645
|
*/
|
|
628
646
|
async grabContext() {
|
|
@@ -637,6 +655,8 @@ class Appium extends Webdriver {
|
|
|
637
655
|
* let activity = await I.grabCurrentActivity();
|
|
638
656
|
* ```
|
|
639
657
|
*
|
|
658
|
+
* @return {Promise<string>}
|
|
659
|
+
*
|
|
640
660
|
* Appium: support only Android
|
|
641
661
|
*/
|
|
642
662
|
async grabCurrentActivity() {
|
|
@@ -653,6 +673,8 @@ class Appium extends Webdriver {
|
|
|
653
673
|
* let con = await I.grabNetworkConnection();
|
|
654
674
|
* ```
|
|
655
675
|
*
|
|
676
|
+
* @return {Promise<{}>}
|
|
677
|
+
*
|
|
656
678
|
* Appium: support only Android
|
|
657
679
|
*/
|
|
658
680
|
async grabNetworkConnection() {
|
|
@@ -673,6 +695,8 @@ class Appium extends Webdriver {
|
|
|
673
695
|
* let orientation = await I.grabOrientation();
|
|
674
696
|
* ```
|
|
675
697
|
*
|
|
698
|
+
* @return {Promise<string>}
|
|
699
|
+
*
|
|
676
700
|
* Appium: support Android and iOS
|
|
677
701
|
*/
|
|
678
702
|
async grabOrientation() {
|
|
@@ -689,6 +713,8 @@ class Appium extends Webdriver {
|
|
|
689
713
|
* let settings = await I.grabSettings();
|
|
690
714
|
* ```
|
|
691
715
|
*
|
|
716
|
+
* @return {Promise<string>}
|
|
717
|
+
*
|
|
692
718
|
* Appium: support Android and iOS
|
|
693
719
|
*/
|
|
694
720
|
async grabSettings() {
|
|
@@ -720,6 +746,8 @@ class Appium extends Webdriver {
|
|
|
720
746
|
* I.switchToWeb('WEBVIEW_io.selendroid.testapp');
|
|
721
747
|
* ```
|
|
722
748
|
*
|
|
749
|
+
* @return {Promise<void>}
|
|
750
|
+
*
|
|
723
751
|
* @param {string} [context]
|
|
724
752
|
*/
|
|
725
753
|
async switchToWeb(context) {
|
|
@@ -747,6 +775,7 @@ class Appium extends Webdriver {
|
|
|
747
775
|
* I.switchToNative('SOME_OTHER_CONTEXT');
|
|
748
776
|
* ```
|
|
749
777
|
* @param {*} context
|
|
778
|
+
* @return {Promise<void>}
|
|
750
779
|
*/
|
|
751
780
|
async switchToNative(context = null) {
|
|
752
781
|
this.isWeb = false;
|
|
@@ -763,6 +792,8 @@ class Appium extends Webdriver {
|
|
|
763
792
|
* I.startActivity('io.selendroid.testapp', '.RegisterUserActivity');
|
|
764
793
|
* ```
|
|
765
794
|
*
|
|
795
|
+
* @return {Promise<void>}
|
|
796
|
+
*
|
|
766
797
|
* Appium: support only Android
|
|
767
798
|
*/
|
|
768
799
|
async startActivity(appPackage, appActivity) {
|
|
@@ -786,6 +817,8 @@ class Appium extends Webdriver {
|
|
|
786
817
|
* ```
|
|
787
818
|
* See corresponding [webdriverio reference](http://webdriver.io/api/mobile/setNetworkConnection.html).
|
|
788
819
|
*
|
|
820
|
+
* @return {Promise<{}>}
|
|
821
|
+
*
|
|
789
822
|
* Appium: support only Android
|
|
790
823
|
*/
|
|
791
824
|
async setNetworkConnection(value) {
|
|
@@ -801,6 +834,7 @@ class Appium extends Webdriver {
|
|
|
801
834
|
* ```
|
|
802
835
|
*
|
|
803
836
|
* @param {object} settings object
|
|
837
|
+
* @return {Promise<any>}
|
|
804
838
|
*
|
|
805
839
|
* Appium: support Android and iOS
|
|
806
840
|
*/
|
|
@@ -841,6 +875,7 @@ class Appium extends Webdriver {
|
|
|
841
875
|
* ```
|
|
842
876
|
*
|
|
843
877
|
* @param {number} keyValue Device specific key value
|
|
878
|
+
* @return {Promise<void>}
|
|
844
879
|
*
|
|
845
880
|
* Appium: support only Android
|
|
846
881
|
*/
|
|
@@ -859,6 +894,8 @@ class Appium extends Webdriver {
|
|
|
859
894
|
* I.openNotifications();
|
|
860
895
|
* ```
|
|
861
896
|
*
|
|
897
|
+
* @return {Promise<void>}
|
|
898
|
+
*
|
|
862
899
|
* Appium: support only Android
|
|
863
900
|
*/
|
|
864
901
|
async openNotifications() {
|
|
@@ -877,6 +914,8 @@ class Appium extends Webdriver {
|
|
|
877
914
|
* I.makeTouchAction("~buttonStartWebviewCD", 'tap');
|
|
878
915
|
* ```
|
|
879
916
|
*
|
|
917
|
+
* @return {Promise<void>}
|
|
918
|
+
*
|
|
880
919
|
* Appium: support Android and iOS
|
|
881
920
|
*/
|
|
882
921
|
async makeTouchAction(locator, action) {
|
|
@@ -898,6 +937,8 @@ class Appium extends Webdriver {
|
|
|
898
937
|
*
|
|
899
938
|
* Shortcut for `makeTouchAction`
|
|
900
939
|
*
|
|
940
|
+
* @return {Promise<void>}
|
|
941
|
+
*
|
|
901
942
|
* @param {*} locator
|
|
902
943
|
*/
|
|
903
944
|
async tap(locator) {
|
|
@@ -914,10 +955,11 @@ class Appium extends Webdriver {
|
|
|
914
955
|
*
|
|
915
956
|
* [See complete reference](http://webdriver.io/api/mobile/swipe.html)
|
|
916
957
|
*
|
|
917
|
-
* @param {
|
|
958
|
+
* @param {string | object} locator
|
|
918
959
|
* @param {number} xoffset
|
|
919
960
|
* @param {number} yoffset
|
|
920
961
|
* @param {number} [speed=1000] (optional), 1000 by default
|
|
962
|
+
* @return {Promise<void>}
|
|
921
963
|
*
|
|
922
964
|
* Appium: support Android and iOS
|
|
923
965
|
*/
|
|
@@ -934,11 +976,11 @@ class Appium extends Webdriver {
|
|
|
934
976
|
* Perform a swipe on the screen.
|
|
935
977
|
*
|
|
936
978
|
* ```js
|
|
937
|
-
* I.
|
|
979
|
+
* I.performSwipe({ x: 300, y: 100 }, { x: 200, y: 100 });
|
|
938
980
|
* ```
|
|
939
981
|
*
|
|
940
|
-
* @param {
|
|
941
|
-
* @param {
|
|
982
|
+
* @param {object} from
|
|
983
|
+
* @param {object} to
|
|
942
984
|
*
|
|
943
985
|
* Appium: support Android and iOS
|
|
944
986
|
*/
|
|
@@ -968,9 +1010,10 @@ class Appium extends Webdriver {
|
|
|
968
1010
|
* I.swipeDown(locator, 1200, 1000); // set offset and speed
|
|
969
1011
|
* ```
|
|
970
1012
|
*
|
|
971
|
-
* @param {
|
|
1013
|
+
* @param {string | object} locator
|
|
972
1014
|
* @param {number} [yoffset] (optional)
|
|
973
1015
|
* @param {number} [speed=1000] (optional), 1000 by default
|
|
1016
|
+
* @return {Promise<void>}
|
|
974
1017
|
*
|
|
975
1018
|
* Appium: support Android and iOS
|
|
976
1019
|
*/
|
|
@@ -996,9 +1039,10 @@ class Appium extends Webdriver {
|
|
|
996
1039
|
* I.swipeLeft(locator, 1200, 1000); // set offset and speed
|
|
997
1040
|
* ```
|
|
998
1041
|
*
|
|
999
|
-
* @param {
|
|
1042
|
+
* @param {string | object} locator
|
|
1000
1043
|
* @param {number} [xoffset] (optional)
|
|
1001
1044
|
* @param {number} [speed=1000] (optional), 1000 by default
|
|
1045
|
+
* @return {Promise<void>}
|
|
1002
1046
|
*
|
|
1003
1047
|
* Appium: support Android and iOS
|
|
1004
1048
|
*/
|
|
@@ -1022,9 +1066,10 @@ class Appium extends Webdriver {
|
|
|
1022
1066
|
* I.swipeRight(locator, 1200, 1000); // set offset and speed
|
|
1023
1067
|
* ```
|
|
1024
1068
|
*
|
|
1025
|
-
* @param {
|
|
1069
|
+
* @param {string | object} locator
|
|
1026
1070
|
* @param {number} [xoffset] (optional)
|
|
1027
1071
|
* @param {number} [speed=1000] (optional), 1000 by default
|
|
1072
|
+
* @return {Promise<void>}
|
|
1028
1073
|
*
|
|
1029
1074
|
* Appium: support Android and iOS
|
|
1030
1075
|
*/
|
|
@@ -1048,9 +1093,10 @@ class Appium extends Webdriver {
|
|
|
1048
1093
|
* I.swipeUp(locator, 1200, 1000); // set offset and speed
|
|
1049
1094
|
* ```
|
|
1050
1095
|
*
|
|
1051
|
-
* @param {
|
|
1096
|
+
* @param {string | object} locator
|
|
1052
1097
|
* @param {number} [yoffset] (optional)
|
|
1053
1098
|
* @param {number} [speed=1000] (optional), 1000 by default
|
|
1099
|
+
* @return {Promise<void>}
|
|
1054
1100
|
*
|
|
1055
1101
|
* Appium: support Android and iOS
|
|
1056
1102
|
*/
|
|
@@ -1084,6 +1130,7 @@ class Appium extends Webdriver {
|
|
|
1084
1130
|
* @param {number} timeout
|
|
1085
1131
|
* @param {number} offset
|
|
1086
1132
|
* @param {number} speed
|
|
1133
|
+
* @return {Promise<void>}
|
|
1087
1134
|
*
|
|
1088
1135
|
* Appium: support Android and iOS
|
|
1089
1136
|
*/
|
|
@@ -1181,6 +1228,10 @@ class Appium extends Webdriver {
|
|
|
1181
1228
|
* I.pullFile('/storage/emulated/0/DCIM/logo.png', output_dir);
|
|
1182
1229
|
* ```
|
|
1183
1230
|
*
|
|
1231
|
+
* @param {string} path
|
|
1232
|
+
* @param {string} dest
|
|
1233
|
+
* @return {Promise<string>}
|
|
1234
|
+
*
|
|
1184
1235
|
* Appium: support Android and iOS
|
|
1185
1236
|
*/
|
|
1186
1237
|
async pullFile(path, dest) {
|
|
@@ -1200,6 +1251,8 @@ class Appium extends Webdriver {
|
|
|
1200
1251
|
* I.shakeDevice();
|
|
1201
1252
|
* ```
|
|
1202
1253
|
*
|
|
1254
|
+
* @return {Promise<void>}
|
|
1255
|
+
*
|
|
1203
1256
|
* Appium: support only iOS
|
|
1204
1257
|
*/
|
|
1205
1258
|
async shakeDevice() {
|
|
@@ -1216,6 +1269,8 @@ class Appium extends Webdriver {
|
|
|
1216
1269
|
*
|
|
1217
1270
|
* See corresponding [webdriverio reference](http://webdriver.io/api/mobile/rotate.html).
|
|
1218
1271
|
*
|
|
1272
|
+
* @return {Promise<void>}
|
|
1273
|
+
*
|
|
1219
1274
|
* Appium: support only iOS
|
|
1220
1275
|
*/
|
|
1221
1276
|
async rotate(x, y, duration, radius, rotation, touchCount) {
|
|
@@ -1228,6 +1283,8 @@ class Appium extends Webdriver {
|
|
|
1228
1283
|
*
|
|
1229
1284
|
* See corresponding [webdriverio reference](http://webdriver.io/api/mobile/setImmediateValue.html).
|
|
1230
1285
|
*
|
|
1286
|
+
* @return {Promise<void>}
|
|
1287
|
+
*
|
|
1231
1288
|
* Appium: support only iOS
|
|
1232
1289
|
*/
|
|
1233
1290
|
async setImmediateValue(id, value) {
|
|
@@ -1244,6 +1301,8 @@ class Appium extends Webdriver {
|
|
|
1244
1301
|
* I.touchId(false); // simulates invalid fingerprint
|
|
1245
1302
|
* ```
|
|
1246
1303
|
*
|
|
1304
|
+
* @return {Promise<void>}
|
|
1305
|
+
*
|
|
1247
1306
|
* Appium: support only iOS
|
|
1248
1307
|
* TODO: not tested
|
|
1249
1308
|
*/
|
|
@@ -1260,6 +1319,8 @@ class Appium extends Webdriver {
|
|
|
1260
1319
|
* I.closeApp();
|
|
1261
1320
|
* ```
|
|
1262
1321
|
*
|
|
1322
|
+
* @return {Promise<void>}
|
|
1323
|
+
*
|
|
1263
1324
|
* Appium: support only iOS
|
|
1264
1325
|
*/
|
|
1265
1326
|
async closeApp() {
|
|
@@ -1274,7 +1335,7 @@ class Appium extends Webdriver {
|
|
|
1274
1335
|
* ```js
|
|
1275
1336
|
* I.appendField('#myTextField', 'appended');
|
|
1276
1337
|
* ```
|
|
1277
|
-
* @param {
|
|
1338
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator
|
|
1278
1339
|
* @param {string} value text value to append.
|
|
1279
1340
|
*
|
|
1280
1341
|
*/
|
|
@@ -1294,8 +1355,8 @@ class Appium extends Webdriver {
|
|
|
1294
1355
|
* I.checkOption('I Agree to Terms and Conditions');
|
|
1295
1356
|
* I.checkOption('agree', '//form');
|
|
1296
1357
|
* ```
|
|
1297
|
-
* @param {
|
|
1298
|
-
* @param {?
|
|
1358
|
+
* @param {string | object} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
1359
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1299
1360
|
*
|
|
1300
1361
|
*/
|
|
1301
1362
|
async checkOption(field) {
|
|
@@ -1326,8 +1387,8 @@ class Appium extends Webdriver {
|
|
|
1326
1387
|
* I.click({css: 'nav a.login'});
|
|
1327
1388
|
* ```
|
|
1328
1389
|
*
|
|
1329
|
-
* @param {
|
|
1330
|
-
* @param {?
|
|
1390
|
+
* @param {string | object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1391
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1331
1392
|
*
|
|
1332
1393
|
*
|
|
1333
1394
|
*/
|
|
@@ -1345,7 +1406,7 @@ class Appium extends Webdriver {
|
|
|
1345
1406
|
* I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
1346
1407
|
* ```
|
|
1347
1408
|
*
|
|
1348
|
-
* @param {
|
|
1409
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator.
|
|
1349
1410
|
*
|
|
1350
1411
|
*
|
|
1351
1412
|
*/
|
|
@@ -1361,7 +1422,7 @@ class Appium extends Webdriver {
|
|
|
1361
1422
|
* I.dontSeeElement('.modal'); // modal is not shown
|
|
1362
1423
|
* ```
|
|
1363
1424
|
*
|
|
1364
|
-
* @param {
|
|
1425
|
+
* @param {string | object} locator located by CSS|XPath|Strict locator.
|
|
1365
1426
|
*/
|
|
1366
1427
|
async dontSeeElement(locator) {
|
|
1367
1428
|
if (this.isWeb) return super.dontSeeElement(locator);
|
|
@@ -1377,7 +1438,7 @@ class Appium extends Webdriver {
|
|
|
1377
1438
|
* I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
1378
1439
|
* ```
|
|
1379
1440
|
*
|
|
1380
|
-
* @param {
|
|
1441
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator.
|
|
1381
1442
|
* @param {string} value value to check.
|
|
1382
1443
|
*
|
|
1383
1444
|
*/
|
|
@@ -1396,7 +1457,7 @@ class Appium extends Webdriver {
|
|
|
1396
1457
|
* ```
|
|
1397
1458
|
*
|
|
1398
1459
|
* @param {string} text which is not present.
|
|
1399
|
-
* @param {
|
|
1460
|
+
* @param {string | object} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
1400
1461
|
*
|
|
1401
1462
|
*/
|
|
1402
1463
|
async dontSee(text, context = null) {
|
|
@@ -1418,8 +1479,8 @@ class Appium extends Webdriver {
|
|
|
1418
1479
|
* // or by strict locator
|
|
1419
1480
|
* I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
1420
1481
|
* ```
|
|
1421
|
-
* @param {
|
|
1422
|
-
* @param {
|
|
1482
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator.
|
|
1483
|
+
* @param {string | object} value text value to fill.
|
|
1423
1484
|
*
|
|
1424
1485
|
*
|
|
1425
1486
|
*/
|
|
@@ -1437,7 +1498,7 @@ class Appium extends Webdriver {
|
|
|
1437
1498
|
* let pins = await I.grabTextFromAll('#pin li');
|
|
1438
1499
|
* ```
|
|
1439
1500
|
*
|
|
1440
|
-
* @param {
|
|
1501
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1441
1502
|
* @returns {Promise<string[]>} attribute value
|
|
1442
1503
|
*
|
|
1443
1504
|
*
|
|
@@ -1456,7 +1517,7 @@ class Appium extends Webdriver {
|
|
|
1456
1517
|
* ```
|
|
1457
1518
|
* If multiple elements found returns first element.
|
|
1458
1519
|
*
|
|
1459
|
-
* @param {
|
|
1520
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1460
1521
|
* @returns {Promise<string>} attribute value
|
|
1461
1522
|
*
|
|
1462
1523
|
*
|
|
@@ -1474,7 +1535,7 @@ class Appium extends Webdriver {
|
|
|
1474
1535
|
* let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
1475
1536
|
* ```
|
|
1476
1537
|
*
|
|
1477
|
-
* @param {
|
|
1538
|
+
* @param {string | object} locator located by CSS|XPath|strict locator.
|
|
1478
1539
|
* @returns {Promise<number>} number of visible elements
|
|
1479
1540
|
*/
|
|
1480
1541
|
async grabNumberOfVisibleElements(locator) {
|
|
@@ -1492,7 +1553,7 @@ class Appium extends Webdriver {
|
|
|
1492
1553
|
* ```js
|
|
1493
1554
|
* let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
1494
1555
|
* ```
|
|
1495
|
-
* @param {
|
|
1556
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1496
1557
|
* @param {string} attr attribute name.
|
|
1497
1558
|
* @returns {Promise<string>} attribute value
|
|
1498
1559
|
*
|
|
@@ -1510,7 +1571,7 @@ class Appium extends Webdriver {
|
|
|
1510
1571
|
* ```js
|
|
1511
1572
|
* let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
1512
1573
|
* ```
|
|
1513
|
-
* @param {
|
|
1574
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1514
1575
|
* @param {string} attr attribute name.
|
|
1515
1576
|
* @returns {Promise<string[]>} attribute value
|
|
1516
1577
|
*
|
|
@@ -1527,7 +1588,7 @@ class Appium extends Webdriver {
|
|
|
1527
1588
|
* ```js
|
|
1528
1589
|
* let inputs = await I.grabValueFromAll('//form/input');
|
|
1529
1590
|
* ```
|
|
1530
|
-
* @param {
|
|
1591
|
+
* @param {string | object} locator field located by label|name|CSS|XPath|strict locator.
|
|
1531
1592
|
* @returns {Promise<string[]>} attribute value
|
|
1532
1593
|
*
|
|
1533
1594
|
*
|
|
@@ -1545,7 +1606,7 @@ class Appium extends Webdriver {
|
|
|
1545
1606
|
* ```js
|
|
1546
1607
|
* let email = await I.grabValueFrom('input[name=email]');
|
|
1547
1608
|
* ```
|
|
1548
|
-
* @param {
|
|
1609
|
+
* @param {string | object} locator field located by label|name|CSS|XPath|strict locator.
|
|
1549
1610
|
* @returns {Promise<string>} attribute value
|
|
1550
1611
|
*
|
|
1551
1612
|
*
|
|
@@ -1564,6 +1625,7 @@ class Appium extends Webdriver {
|
|
|
1564
1625
|
* ```
|
|
1565
1626
|
*
|
|
1566
1627
|
* @param {string} fileName file name to save.
|
|
1628
|
+
* @return {Promise<void>}
|
|
1567
1629
|
*/
|
|
1568
1630
|
async saveScreenshot(fileName) {
|
|
1569
1631
|
return super.saveScreenshot(fileName, false);
|
|
@@ -1578,7 +1640,7 @@ class Appium extends Webdriver {
|
|
|
1578
1640
|
* I.scrollIntoView('#submit', { behavior: "smooth", block: "center", inline: "center" });
|
|
1579
1641
|
* ```
|
|
1580
1642
|
*
|
|
1581
|
-
* @param {
|
|
1643
|
+
* @param {string | object} locator located by CSS|XPath|strict locator.
|
|
1582
1644
|
* @param {ScrollIntoViewOptions} scrollIntoViewOptions see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView.
|
|
1583
1645
|
*
|
|
1584
1646
|
*
|
|
@@ -1597,7 +1659,7 @@ class Appium extends Webdriver {
|
|
|
1597
1659
|
* I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
1598
1660
|
* ```
|
|
1599
1661
|
*
|
|
1600
|
-
* @param {
|
|
1662
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator.
|
|
1601
1663
|
*
|
|
1602
1664
|
*
|
|
1603
1665
|
*/
|
|
@@ -1613,7 +1675,7 @@ class Appium extends Webdriver {
|
|
|
1613
1675
|
* ```js
|
|
1614
1676
|
* I.seeElement('#modal');
|
|
1615
1677
|
* ```
|
|
1616
|
-
* @param {
|
|
1678
|
+
* @param {string | object} locator located by CSS|XPath|strict locator.
|
|
1617
1679
|
*
|
|
1618
1680
|
*/
|
|
1619
1681
|
async seeElement(locator) {
|
|
@@ -1631,7 +1693,7 @@ class Appium extends Webdriver {
|
|
|
1631
1693
|
* I.seeInField('form input[type=hidden]','hidden_value');
|
|
1632
1694
|
* I.seeInField('#searchform input','Search');
|
|
1633
1695
|
* ```
|
|
1634
|
-
* @param {
|
|
1696
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator.
|
|
1635
1697
|
* @param {string} value value to check.
|
|
1636
1698
|
*
|
|
1637
1699
|
*
|
|
@@ -1651,7 +1713,7 @@ class Appium extends Webdriver {
|
|
|
1651
1713
|
* I.see('Register', {css: 'form.register'}); // use strict locator
|
|
1652
1714
|
* ```
|
|
1653
1715
|
* @param {string} text expected on page.
|
|
1654
|
-
* @param {?
|
|
1716
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
1655
1717
|
*
|
|
1656
1718
|
*/
|
|
1657
1719
|
async see(text, context) {
|
|
@@ -1678,7 +1740,7 @@ class Appium extends Webdriver {
|
|
|
1678
1740
|
* ```js
|
|
1679
1741
|
* I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
1680
1742
|
* ```
|
|
1681
|
-
* @param {
|
|
1743
|
+
* @param {string | object} select field located by label|name|CSS|XPath|strict locator.
|
|
1682
1744
|
* @param {string|Array<*>} option visible text or value of option.
|
|
1683
1745
|
*
|
|
1684
1746
|
*
|
|
@@ -1698,7 +1760,7 @@ class Appium extends Webdriver {
|
|
|
1698
1760
|
* I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
1699
1761
|
* ```
|
|
1700
1762
|
*
|
|
1701
|
-
* @param {
|
|
1763
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1702
1764
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
1703
1765
|
*
|
|
1704
1766
|
*/
|
|
@@ -1715,7 +1777,7 @@ class Appium extends Webdriver {
|
|
|
1715
1777
|
* I.waitForVisible('#popup');
|
|
1716
1778
|
* ```
|
|
1717
1779
|
*
|
|
1718
|
-
* @param {
|
|
1780
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1719
1781
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1720
1782
|
*
|
|
1721
1783
|
*
|
|
@@ -1733,7 +1795,7 @@ class Appium extends Webdriver {
|
|
|
1733
1795
|
* I.waitForInvisible('#popup');
|
|
1734
1796
|
* ```
|
|
1735
1797
|
*
|
|
1736
|
-
* @param {
|
|
1798
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1737
1799
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1738
1800
|
*
|
|
1739
1801
|
*/
|
|
@@ -1754,7 +1816,7 @@ class Appium extends Webdriver {
|
|
|
1754
1816
|
*
|
|
1755
1817
|
* @param {string }text to wait for.
|
|
1756
1818
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1757
|
-
* @param {
|
|
1819
|
+
* @param {string | object} [context] (optional) element located by CSS|XPath|strict locator.
|
|
1758
1820
|
*
|
|
1759
1821
|
*/
|
|
1760
1822
|
async waitForText(text, sec = null, context = null) {
|
package/docs/build/FileSystem.js
CHANGED
|
@@ -15,7 +15,17 @@ const { fileEquals } = require('../assert/equal');
|
|
|
15
15
|
* I.amInPath('test');
|
|
16
16
|
* I.seeFile('codecept.json');
|
|
17
17
|
* I.seeInThisFile('FileSystem');
|
|
18
|
-
* I.dontSeeInThisFile("
|
|
18
|
+
* I.dontSeeInThisFile("WebDriver");
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* ## Configuration
|
|
22
|
+
*
|
|
23
|
+
* Enable helper in config file:
|
|
24
|
+
*
|
|
25
|
+
* ```js
|
|
26
|
+
* helpers: {
|
|
27
|
+
* FileSystem: {},
|
|
28
|
+
* }
|
|
19
29
|
* ```
|
|
20
30
|
*
|
|
21
31
|
* ## Methods
|