codeceptjs 3.2.2 → 3.2.3
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 +7 -0
- package/docs/advanced.md +5 -1
- package/docs/build/Appium.js +62 -0
- package/docs/build/FileSystem.js +11 -1
- package/docs/build/Playwright.js +12 -7
- package/docs/changelog.md +7 -0
- package/docs/configuration.md +8 -8
- package/docs/custom-helpers.md +1 -1
- package/docs/data.md +9 -9
- package/docs/helpers/Appium.md +239 -197
- package/docs/helpers/FileSystem.md +11 -1
- package/docs/helpers/Playwright.md +210 -207
- package/docs/installation.md +1 -1
- package/docs/mobile.md +11 -11
- package/docs/nightmare.md +3 -3
- package/docs/playwright.md +4 -4
- package/docs/plugins.md +11 -7
- package/docs/puppeteer.md +5 -5
- package/docs/reports.md +1 -1
- package/docs/testcafe.md +1 -1
- package/docs/translation.md +1 -1
- package/docs/visual.md +2 -2
- package/docs/vue.md +1 -1
- package/docs/webdriver.md +2 -2
- package/lib/cli.js +25 -20
- package/lib/command/workers/runTests.js +25 -7
- package/lib/helper/Appium.js +62 -0
- package/lib/helper/FileSystem.js +11 -1
- package/lib/helper/Playwright.js +12 -7
- package/lib/plugin/autoLogin.js +1 -1
- package/lib/plugin/tryTo.js +6 -0
- package/package.json +1 -1
- package/typings/index.d.ts +2 -0
- package/typings/types.d.ts +83 -100
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## 3.2.3
|
|
2
|
+
|
|
3
|
+
* Documentation improvements by @maojunxyz
|
|
4
|
+
* Guard mocha cli reporter from registering step logger multiple times #3180 by @nikocanvacom
|
|
5
|
+
* [Playwright] Fixed "tracing.stop: tracing.stop: ENAMETOOLONG: name too long" by @hatufacci
|
|
6
|
+
* Fixed #2889: return always the same error contract from simplifyTest. See #3168 by @andremoah
|
|
7
|
+
|
|
1
8
|
## 3.2.2
|
|
2
9
|
|
|
3
10
|
* [Playwright] Reverted removal of retry on context errors. Fixes #3130
|
package/docs/advanced.md
CHANGED
|
@@ -97,10 +97,14 @@ Scenario('update user profile', ({ }) => {
|
|
|
97
97
|
}).tag('@slow').tag('important');
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
All tests with `@tag` could be executed with `--grep @tag` option.
|
|
100
|
+
All tests with `@tag` could be executed with `--grep '@tag'` option.
|
|
101
101
|
|
|
102
102
|
```sh
|
|
103
|
+
<<<<<<< HEAD
|
|
103
104
|
npx codeceptjs run --grep @slow
|
|
105
|
+
=======
|
|
106
|
+
codeceptjs run --grep '@slow'
|
|
107
|
+
>>>>>>> 435964dff7770cb3cd58c78a8579b6221a000d24
|
|
104
108
|
```
|
|
105
109
|
|
|
106
110
|
Use regex for more flexible filtering:
|
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) {
|
|
@@ -918,6 +959,7 @@ class Appium extends Webdriver {
|
|
|
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
|
*/
|
|
@@ -971,6 +1013,7 @@ class Appium extends Webdriver {
|
|
|
971
1013
|
* @param {CodeceptJS.LocatorOrString} 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
|
*/
|
|
@@ -999,6 +1042,7 @@ class Appium extends Webdriver {
|
|
|
999
1042
|
* @param {CodeceptJS.LocatorOrString} 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
|
*/
|
|
@@ -1025,6 +1069,7 @@ class Appium extends Webdriver {
|
|
|
1025
1069
|
* @param {CodeceptJS.LocatorOrString} 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
|
*/
|
|
@@ -1051,6 +1096,7 @@ class Appium extends Webdriver {
|
|
|
1051
1096
|
* @param {CodeceptJS.LocatorOrString} 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() {
|
|
@@ -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);
|
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
|
package/docs/build/Playwright.js
CHANGED
|
@@ -14,7 +14,6 @@ const {
|
|
|
14
14
|
ucfirst,
|
|
15
15
|
fileExists,
|
|
16
16
|
chunkArray,
|
|
17
|
-
toCamelCase,
|
|
18
17
|
convertCssPropertiesToCamelCase,
|
|
19
18
|
screenshotOutputFolder,
|
|
20
19
|
getNormalizedKeyAttributeValue,
|
|
@@ -73,7 +72,7 @@ const { createValueEngine, createDisabledEngine } = require('./extras/Playwright
|
|
|
73
72
|
* * `keepBrowserState`: (optional, default: false) - keep browser state between tests when `restart` is set to false.
|
|
74
73
|
* * `keepCookies`: (optional, default: false) - keep cookies between tests when `restart` is set to false.
|
|
75
74
|
* * `waitForAction`: (optional) how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
|
|
76
|
-
* * `waitForNavigation`: (optional, default: 'load'). When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle`. Choose one of those options is possible. See [Playwright API](https://github.com/microsoft/playwright/blob/
|
|
75
|
+
* * `waitForNavigation`: (optional, default: 'load'). When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle`. Choose one of those options is possible. See [Playwright API](https://github.com/microsoft/playwright/blob/main/docs/api.md#pagewaitfornavigationoptions).
|
|
77
76
|
* * `pressKeyDelay`: (optional, default: '10'). Delay between key presses in ms. Used when calling Playwrights page.type(...) in fillField/appendField
|
|
78
77
|
* * `getPageTimeout` (optional, default: '0') config option to set maximum navigation time in milliseconds.
|
|
79
78
|
* * `waitForTimeout`: (optional) default wait* timeout in ms. Default: 1000.
|
|
@@ -84,6 +83,7 @@ const { createValueEngine, createDisabledEngine } = require('./extras/Playwright
|
|
|
84
83
|
* * `manualStart`: (optional, default: false) - do not start browser before a test, start it manually inside a helper with `this.helpers["Playwright"]._startBrowser()`.
|
|
85
84
|
* * `chromium`: (optional) pass additional chromium options
|
|
86
85
|
* * `electron`: (optional) pass additional electron options
|
|
86
|
+
* * `channel`: (optional) While Playwright can operate against the stock Google Chrome and Microsoft Edge browsers available on the machine. In particular, current Playwright version will support Stable and Beta channels of these browsers. See [Google Chrome & Microsoft Edge](https://playwright.dev/docs/browsers/#google-chrome--microsoft-edge).
|
|
87
87
|
*
|
|
88
88
|
* #### Video Recording Customization
|
|
89
89
|
*
|
|
@@ -301,6 +301,11 @@ class Playwright extends Helper {
|
|
|
301
301
|
headless: !this.options.show,
|
|
302
302
|
...this._getOptionsForBrowser(config),
|
|
303
303
|
};
|
|
304
|
+
|
|
305
|
+
if (this.options.channel && this.options.browser === 'chromium') {
|
|
306
|
+
this.playwrightOptions.channel = this.options.channel;
|
|
307
|
+
}
|
|
308
|
+
|
|
304
309
|
if (this.options.video) {
|
|
305
310
|
this.options.recordVideo = { size: parseWindowSize(this.options.windowSize) };
|
|
306
311
|
}
|
|
@@ -501,10 +506,10 @@ class Playwright extends Helper {
|
|
|
501
506
|
* First argument is a description of an action.
|
|
502
507
|
* Second argument is async function that gets this helper as parameter.
|
|
503
508
|
*
|
|
504
|
-
* { [`page`](https://github.com/microsoft/playwright/blob/
|
|
509
|
+
* { [`page`](https://github.com/microsoft/playwright/blob/main/docs/src/api/class-page.md), [`context`](https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browsercontext.md) [`browser`](https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browser.md) } objects from Playwright API are available.
|
|
505
510
|
*
|
|
506
511
|
* ```js
|
|
507
|
-
* I.usePlaywrightTo('emulate offline mode', async ({ context }) {
|
|
512
|
+
* I.usePlaywrightTo('emulate offline mode', async ({ context }) => {
|
|
508
513
|
* await context.setOffline(true);
|
|
509
514
|
* });
|
|
510
515
|
* ```
|
|
@@ -1169,7 +1174,7 @@ class Playwright extends Helper {
|
|
|
1169
1174
|
* I.openNewTab();
|
|
1170
1175
|
* ```
|
|
1171
1176
|
*
|
|
1172
|
-
* You can pass in [page options](https://github.com/microsoft/playwright/blob/
|
|
1177
|
+
* You can pass in [page options](https://github.com/microsoft/playwright/blob/main/docs/api.md#browsernewpageoptions) to emulate device on this page
|
|
1173
1178
|
*
|
|
1174
1179
|
* ```js
|
|
1175
1180
|
* // enable mobile
|
|
@@ -2157,7 +2162,7 @@ class Playwright extends Helper {
|
|
|
2157
2162
|
*/
|
|
2158
2163
|
async clearCookie() {
|
|
2159
2164
|
// Playwright currently doesn't support to delete a certain cookie
|
|
2160
|
-
// https://github.com/microsoft/playwright/blob/
|
|
2165
|
+
// https://github.com/microsoft/playwright/blob/main/docs/api.md#class-browsercontext
|
|
2161
2166
|
if (!this.browserContext) return;
|
|
2162
2167
|
return this.browserContext.clearCookies();
|
|
2163
2168
|
}
|
|
@@ -2602,7 +2607,7 @@ class Playwright extends Helper {
|
|
|
2602
2607
|
}
|
|
2603
2608
|
|
|
2604
2609
|
if (this.options.trace) {
|
|
2605
|
-
const path = `${global.output_dir}/trace/${clearString(test.title)
|
|
2610
|
+
const path = `${`${global.output_dir}/trace/${clearString(test.title)}`.slice(0, 251)}.zip`;
|
|
2606
2611
|
await this.browserContext.tracing.stop({ path });
|
|
2607
2612
|
test.artifacts.trace = path;
|
|
2608
2613
|
}
|
package/docs/changelog.md
CHANGED
|
@@ -7,6 +7,13 @@ layout: Section
|
|
|
7
7
|
|
|
8
8
|
# Releases
|
|
9
9
|
|
|
10
|
+
## 3.2.3
|
|
11
|
+
|
|
12
|
+
* Documentation improvements by **[maojunxyz](https://github.com/maojunxyz)**
|
|
13
|
+
* Guard mocha cli reporter from registering step logger multiple times [#3180](https://github.com/codeceptjs/CodeceptJS/issues/3180) by **[nikocanvacom](https://github.com/nikocanvacom)**
|
|
14
|
+
* **[Playwright]** Fixed "tracing.stop: tracing.stop: ENAMETOOLONG: name too long" by **[hatufacci](https://github.com/hatufacci)**
|
|
15
|
+
* Fixed [#2889](https://github.com/codeceptjs/CodeceptJS/issues/2889): return always the same error contract from simplifyTest. See [#3168](https://github.com/codeceptjs/CodeceptJS/issues/3168) by **[andremoah](https://github.com/andremoah)**
|
|
16
|
+
|
|
10
17
|
## 3.2.2
|
|
11
18
|
|
|
12
19
|
* **[Playwright]** Reverted removal of retry on context errors. Fixes [#3130](https://github.com/codeceptjs/CodeceptJS/issues/3130)
|
package/docs/configuration.md
CHANGED
|
@@ -17,15 +17,15 @@ Here is an overview of available options with their defaults:
|
|
|
17
17
|
* **timeout**: `10000` - default tests timeout
|
|
18
18
|
* **output**: `"./output"` - where to store failure screenshots, etc
|
|
19
19
|
* **helpers**: `{}` - list of enabled helpers
|
|
20
|
-
* **mocha**: `{}` - mocha options, [reporters](
|
|
21
|
-
* **multiple**: `{}` - multiple options, see [Multiple Execution](
|
|
22
|
-
* **bootstrap**: `"./bootstrap.js"` - an option to run code _before_ tests are run. See [Hooks](
|
|
23
|
-
* **bootstrapAll**: `"./bootstrap.js"` - an option to run code _before_ all test suites are run when using the run-multiple mode. See [Hooks](
|
|
24
|
-
* **teardown**: - an option to run code _after_ all test suites are run when using the run-multiple mode. See [Hooks](
|
|
25
|
-
* **teardownAll**: - an option to run code _after_ tests are run. See [Hooks](
|
|
20
|
+
* **mocha**: `{}` - mocha options, [reporters](https://codecept.io/reports/) can be configured here
|
|
21
|
+
* **multiple**: `{}` - multiple options, see [Multiple Execution](https://codecept.io/parallel#multiple-browsers-execution)
|
|
22
|
+
* **bootstrap**: `"./bootstrap.js"` - an option to run code _before_ tests are run. See [Hooks](https://codecept.io/hooks/#bootstrap-teardown)).
|
|
23
|
+
* **bootstrapAll**: `"./bootstrap.js"` - an option to run code _before_ all test suites are run when using the run-multiple mode. See [Hooks](https://codecept.io/hooks/#bootstrap-teardown)).
|
|
24
|
+
* **teardown**: - an option to run code _after_ all test suites are run when using the run-multiple mode. See [Hooks](https://codecept.io/hooks/#bootstrap-teardown).
|
|
25
|
+
* **teardownAll**: - an option to run code _after_ tests are run. See [Hooks](https://codecept.io/hooks/#bootstrap-teardown).
|
|
26
26
|
* **noGlobals**: `false` - disable registering global variables like `Actor`, `Helper`, `pause`, `within`, `DataTable`
|
|
27
|
-
* **hooks**: - include custom listeners to plug into execution workflow. See [Custom Hooks](
|
|
28
|
-
* **translation**: - [locale](
|
|
27
|
+
* **hooks**: - include custom listeners to plug into execution workflow. See [Custom Hooks](https://codecept.io/hooks/#custom-hooks)
|
|
28
|
+
* **translation**: - [locale](https://codecept.io/translation/) to be used to print s teps output, as well as used in source code.
|
|
29
29
|
* **require**: `[]` - array of module names to be required before codecept starts. See [Require](#require)
|
|
30
30
|
|
|
31
31
|
|
package/docs/custom-helpers.md
CHANGED
|
@@ -264,7 +264,7 @@ class MyHelper extends Helper {
|
|
|
264
264
|
const { WebDriver } = this.helpers
|
|
265
265
|
const { browser } = WebDriver;
|
|
266
266
|
|
|
267
|
-
// get all cookies according to
|
|
267
|
+
// get all cookies according to https://webdriver.io/api/protocol/cookie.html
|
|
268
268
|
// any helper method should return a value in order to be added to promise chain
|
|
269
269
|
const res = await browser.cookie();
|
|
270
270
|
// get values
|
package/docs/data.md
CHANGED
|
@@ -5,7 +5,7 @@ title: Data Management
|
|
|
5
5
|
|
|
6
6
|
# Data Management
|
|
7
7
|
|
|
8
|
-
> This chapter describes data management for external sources. If you are looking for using Data Sets in tests, see [Data Driven Tests](
|
|
8
|
+
> This chapter describes data management for external sources. If you are looking for using Data Sets in tests, see [Data Driven Tests](https://codecept.io/advanced/#data-drivern-tests) section*
|
|
9
9
|
|
|
10
10
|
Managing data for tests is always a tricky issue. How isolate data between tests, how to prepare data for different tests, etc.
|
|
11
11
|
There are different approaches to solve it:
|
|
@@ -22,7 +22,7 @@ API is supposed to be a stable interface and it can be used by acceptance tests.
|
|
|
22
22
|
|
|
23
23
|
## REST
|
|
24
24
|
|
|
25
|
-
[REST helper](
|
|
25
|
+
[REST helper](https://codecept.io/helpers/REST/) allows sending raw HTTP requests to application.
|
|
26
26
|
This is a tool to make shortcuts and create your data pragmatically via API. However, it doesn't provide tools for testing APIs, so it should be paired with WebDriver, Nightmare or Protractor helpers for browser testing.
|
|
27
27
|
|
|
28
28
|
Enable REST helper in the config. It is recommended to set `endpoint`, a base URL for all API requests. If you need some authorization you can optionally set default headers too.
|
|
@@ -87,11 +87,11 @@ This can also be used to emulate Ajax requests:
|
|
|
87
87
|
I.sendPostRequest('/update-status', {}, { http_x_requested_with: 'xmlhttprequest' });
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
> See complete reference on [REST](
|
|
90
|
+
> See complete reference on [REST](https://codecept.io/helpers/REST) helper
|
|
91
91
|
|
|
92
92
|
## GraphQL
|
|
93
93
|
|
|
94
|
-
[GraphQL helper](
|
|
94
|
+
[GraphQL helper](https://codecept.io/helpers/GraphQL/) allows sending GraphQL queries and mutations to application, over Http.
|
|
95
95
|
This is a tool to make shortcuts and create your data pragmatically via GraphQL endpoint. However, it doesn't provide tools for testing the endpoint, so it should be paired with WebDriver, Nightmare or Protractor helpers for browser testing.
|
|
96
96
|
|
|
97
97
|
Enable GraphQL helper in the config. It is recommended to set `endpoint`, the URL to which the requests go to. If you need some authorization you can optionally set default headers too.
|
|
@@ -160,13 +160,13 @@ After(({ I }) => {
|
|
|
160
160
|
});
|
|
161
161
|
```
|
|
162
162
|
|
|
163
|
-
> See complete reference on [GraphQL](
|
|
163
|
+
> See complete reference on [GraphQL](https://codecept.io/helpers/GraphQL) helper
|
|
164
164
|
|
|
165
165
|
## Data Generation with Factories
|
|
166
166
|
|
|
167
167
|
This concept is extended by:
|
|
168
|
-
- [ApiDataFactory](
|
|
169
|
-
- [GraphQLDataFactory](
|
|
168
|
+
- [ApiDataFactory](https://codecept.io/helpers/ApiDataFactory/) helper, and,
|
|
169
|
+
- [GraphQLDataFactory](https://codecept.io/helpers/GraphQLDataFactory/) helper.
|
|
170
170
|
|
|
171
171
|
These helpers build data according to defined rules and use REST API or GraphQL mutations to store them and automatically clean them up after a test.
|
|
172
172
|
|
|
@@ -238,7 +238,7 @@ At the end of a test ApiDataFactory will clean up created record for you. This i
|
|
|
238
238
|
ids from crated records and running `DELETE /api/users/{id}` requests at the end of a test.
|
|
239
239
|
This rules can be customized in helper configuration.
|
|
240
240
|
|
|
241
|
-
> See complete reference on [ApiDataFactory](
|
|
241
|
+
> See complete reference on [ApiDataFactory](https://codecept.io/helpers/ApiDataFactory) helper
|
|
242
242
|
|
|
243
243
|
### GraphQL Data Factory
|
|
244
244
|
|
|
@@ -303,7 +303,7 @@ data from crated records, creating deletion mutation objects by passing the data
|
|
|
303
303
|
This behavior is according the `revert` function be customized in helper configuration.
|
|
304
304
|
The revert function returns an object, that contains the query for deletion, and the variables object to go along with it.
|
|
305
305
|
|
|
306
|
-
> See complete reference on [GraphQLDataFactory](
|
|
306
|
+
> See complete reference on [GraphQLDataFactory](https://codecept.io/helpers/GraphQLDataFactory) helper
|
|
307
307
|
|
|
308
308
|
## Requests Using Browser Session
|
|
309
309
|
|