codeceptjs 3.5.0 → 3.5.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.
@@ -144,6 +144,29 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
144
144
  ⚠️ returns a _promise_ which is synchronized internally by recorder
145
145
  - `locator` **([string][4] | [object][5])** field located by label|name|CSS|XPath|strict locator.
146
146
 
147
+ ### blur
148
+
149
+ Remove focus from a text input, button, etc.
150
+ Calls [blur][6] on the element.
151
+
152
+ Examples:
153
+
154
+ ```js
155
+ I.blur('.text-area')
156
+ ```
157
+
158
+ ```js
159
+ //element `#product-tile` is focused
160
+ I.see('#add-to-cart-btn');
161
+ I.blur('#product-tile')
162
+ I.dontSee('#add-to-cart-btn');
163
+ ```
164
+
165
+ #### Parameters
166
+
167
+ - `locator` **([string][4] | [object][5])** field located by label|name|CSS|XPath|strict locator.
168
+ - `options` **any?** Playwright only: [Additional options][7] for available options object as 2nd argument.
169
+
147
170
  ### checkOption
148
171
 
149
172
  Selects a checkbox or radio button.
@@ -395,9 +418,9 @@ let date = await I.executeScript(function(el) {
395
418
 
396
419
  #### Parameters
397
420
 
398
- - `fn` **([string][4] | [function][6])** function to be executed in browser context.
421
+ - `fn` **([string][4] | [function][8])** function to be executed in browser context.
399
422
  - `args` **...any** to be passed to function.
400
- ⚠️ returns a _promise_ which is synchronized internally by recorderIf a function returns a Promise It will wait for it resolution.
423
+ ⚠️ returns a _promise_ which is synchronized internally by recorderIf a function returns a Promise It will wait for its resolution.
401
424
 
402
425
  ### fillField
403
426
 
@@ -421,6 +444,23 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
421
444
  - `value` **([string][4] | [object][5])** text value to fill.
422
445
  ⚠️ returns a _promise_ which is synchronized internally by recorder
423
446
 
447
+ ### focus
448
+
449
+ Calls [focus][6] on the matching element.
450
+
451
+ Examples:
452
+
453
+ ```js
454
+ I.dontSee('#add-to-cart-btn');
455
+ I.focus('#product-tile')
456
+ I.see('#add-to-cart-bnt');
457
+ ```
458
+
459
+ #### Parameters
460
+
461
+ - `locator` **([string][4] | [object][5])** field located by label|name|CSS|XPath|strict locator.
462
+ - `options` **any?** Playwright only: [Additional options][9] for available options object as 2nd argument.
463
+
424
464
  ### grabAttributeFrom
425
465
 
426
466
  Retrieves an attribute from an element located by CSS or XPath and returns it to test.
@@ -436,7 +476,7 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
436
476
  - `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
437
477
  - `attr` **[string][4]** attribute name.
438
478
 
439
- Returns **[Promise][7]<[string][4]>** attribute value
479
+ Returns **[Promise][10]<[string][4]>** attribute value
440
480
 
441
481
  ### grabAttributeFromAll
442
482
 
@@ -453,7 +493,7 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
453
493
  - `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
454
494
  - `attr` **[string][4]** attribute name.
455
495
 
456
- Returns **[Promise][7]<[string][4]>** attribute value
496
+ Returns **[Promise][10]<[string][4]>** attribute value
457
497
 
458
498
  ### grabBrowserLogs
459
499
 
@@ -479,7 +519,7 @@ assert(cookie.value, '123456');
479
519
 
480
520
  - `name` **[string][4]?** cookie name.
481
521
 
482
- Returns **([Promise][7]<[string][4]> | [Promise][7]<[Array][8]<[string][4]>>)** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
522
+ Returns **([Promise][10]<[string][4]> | [Promise][10]<[Array][11]<[string][4]>>)** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
483
523
 
484
524
  ### grabCurrentUrl
485
525
 
@@ -491,7 +531,7 @@ let url = await I.grabCurrentUrl();
491
531
  console.log(`Current URL is [${url}]`);
492
532
  ```
493
533
 
494
- Returns **[Promise][7]<[string][4]>** current URL
534
+ Returns **[Promise][10]<[string][4]>** current URL
495
535
 
496
536
  ### grabNumberOfVisibleElements
497
537
 
@@ -506,7 +546,7 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
506
546
 
507
547
  - `locator` **([string][4] | [object][5])** located by CSS|XPath|strict locator.
508
548
 
509
- Returns **[Promise][7]<[number][9]>** number of visible elements
549
+ Returns **[Promise][10]<[number][12]>** number of visible elements
510
550
 
511
551
  ### grabPageScrollPosition
512
552
 
@@ -517,7 +557,7 @@ Resumes test execution, so **should be used inside an async function with `await
517
557
  let { x, y } = await I.grabPageScrollPosition();
518
558
  ```
519
559
 
520
- Returns **[Promise][7]<PageScrollPosition>** scroll position
560
+ Returns **[Promise][10]<PageScrollPosition>** scroll position
521
561
 
522
562
  ### grabSource
523
563
 
@@ -528,7 +568,7 @@ Resumes test execution, so **should be used inside async function with `await`**
528
568
  let pageSource = await I.grabSource();
529
569
  ```
530
570
 
531
- Returns **[Promise][7]<[string][4]>** source code
571
+ Returns **[Promise][10]<[string][4]>** source code
532
572
 
533
573
  ### grabTextFrom
534
574
 
@@ -545,7 +585,7 @@ If multiple elements found returns first element.
545
585
 
546
586
  - `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
547
587
 
548
- Returns **[Promise][7]<[string][4]>** attribute value
588
+ Returns **[Promise][10]<[string][4]>** attribute value
549
589
 
550
590
  ### grabTextFromAll
551
591
 
@@ -560,7 +600,7 @@ let pins = await I.grabTextFromAll('#pin li');
560
600
 
561
601
  - `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
562
602
 
563
- Returns **[Promise][7]<[Array][8]<[string][4]>>** attribute value
603
+ Returns **[Promise][10]<[Array][11]<[string][4]>>** attribute value
564
604
 
565
605
  ### grabValueFrom
566
606
 
@@ -576,7 +616,7 @@ let email = await I.grabValueFrom('input[name=email]');
576
616
 
577
617
  - `locator` **([string][4] | [object][5])** field located by label|name|CSS|XPath|strict locator.
578
618
 
579
- Returns **[Promise][7]<[string][4]>** attribute value
619
+ Returns **[Promise][10]<[string][4]>** attribute value
580
620
 
581
621
  ### grabValueFromAll
582
622
 
@@ -591,7 +631,7 @@ let inputs = await I.grabValueFromAll('//form/input');
591
631
 
592
632
  - `locator` **([string][4] | [object][5])** field located by label|name|CSS|XPath|strict locator.
593
633
 
594
- Returns **[Promise][7]<[Array][8]<[string][4]>>** attribute value
634
+ Returns **[Promise][10]<[Array][11]<[string][4]>>** attribute value
595
635
 
596
636
  ### moveCursorTo
597
637
 
@@ -606,14 +646,14 @@ I.moveCursorTo('#submit', 5,5);
606
646
  #### Parameters
607
647
 
608
648
  - `locator` **([string][4] | [object][5])** located by CSS|XPath|strict locator.
609
- - `offsetX` **[number][9]** (optional, `0` by default) X-axis offset.
610
- - `offsetY` **[number][9]** (optional, `0` by default) Y-axis offset.
649
+ - `offsetX` **[number][12]** (optional, `0` by default) X-axis offset.
650
+ - `offsetY` **[number][12]** (optional, `0` by default) Y-axis offset.
611
651
  ⚠️ returns a _promise_ which is synchronized internally by recorder
612
652
 
613
653
  ### pressKey
614
654
 
615
655
  Presses a key on a focused element.
616
- Special keys like 'Enter', 'Control', [etc][10]
656
+ Special keys like 'Enter', 'Control', [etc][13]
617
657
  will be replaced with corresponding unicode.
618
658
  If modifier key is used (Control, Command, Alt, Shift) in array, it will be released afterwards.
619
659
 
@@ -624,7 +664,7 @@ I.pressKey(['Control','a']);
624
664
 
625
665
  #### Parameters
626
666
 
627
- - `key` **([string][4] | [Array][8]<[string][4]>)** key or array of keys to press.
667
+ - `key` **([string][4] | [Array][11]<[string][4]>)** key or array of keys to press.
628
668
  ⚠️ returns a _promise_ which is synchronized internally by recorder
629
669
 
630
670
 
@@ -677,8 +717,8 @@ First parameter can be set to `maximize`.
677
717
 
678
718
  #### Parameters
679
719
 
680
- - `width` **[number][9]** width in pixels or `maximize`.
681
- - `height` **[number][9]** height in pixels.
720
+ - `width` **[number][12]** width in pixels or `maximize`.
721
+ - `height` **[number][12]** height in pixels.
682
722
  ⚠️ returns a _promise_ which is synchronized internally by recorder
683
723
 
684
724
  ### rightClick
@@ -729,7 +769,7 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
729
769
  #### Parameters
730
770
 
731
771
  - `fileName` **[string][4]** file name to save.
732
- - `fullPage` **[boolean][11]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
772
+ - `fullPage` **[boolean][14]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
733
773
  ⚠️ returns a _promise_ which is synchronized internally by recorder
734
774
 
735
775
  ### scrollPageToBottom
@@ -765,8 +805,8 @@ I.scrollTo('#submit', 5, 5);
765
805
  #### Parameters
766
806
 
767
807
  - `locator` **([string][4] | [object][5])** located by CSS|XPath|strict locator.
768
- - `offsetX` **[number][9]** (optional, `0` by default) X-axis offset.
769
- - `offsetY` **[number][9]** (optional, `0` by default) Y-axis offset.
808
+ - `offsetX` **[number][12]** (optional, `0` by default) X-axis offset.
809
+ - `offsetY` **[number][12]** (optional, `0` by default) Y-axis offset.
770
810
  ⚠️ returns a _promise_ which is synchronized internally by recorder
771
811
 
772
812
  ### see
@@ -914,7 +954,7 @@ I.seeNumberOfVisibleElements('.buttons', 3);
914
954
  #### Parameters
915
955
 
916
956
  - `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
917
- - `num` **[number][9]** number of elements.
957
+ - `num` **[number][12]** number of elements.
918
958
  ⚠️ returns a _promise_ which is synchronized internally by recorder
919
959
 
920
960
  ### seeTextEquals
@@ -954,7 +994,7 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
954
994
  #### Parameters
955
995
 
956
996
  - `select` **([string][4] | [object][5])** field located by label|name|CSS|XPath|strict locator.
957
- - `option` **([string][4] | [Array][8]<any>)** visible text or value of option.
997
+ - `option` **([string][4] | [Array][11]<any>)** visible text or value of option.
958
998
  ⚠️ returns a _promise_ which is synchronized internally by recorder
959
999
 
960
1000
  ### setCookie
@@ -975,7 +1015,7 @@ I.setCookie([
975
1015
 
976
1016
  #### Parameters
977
1017
 
978
- - `cookie` **(Cookie | [Array][8]<Cookie>)** a cookie object or array of cookie objects.
1018
+ - `cookie` **(Cookie | [Array][11]<Cookie>)** a cookie object or array of cookie objects.
979
1019
  ⚠️ returns a _promise_ which is synchronized internally by recorder
980
1020
 
981
1021
  ### switchTo
@@ -1013,12 +1053,12 @@ I.uncheckOption('agree', '//form');
1013
1053
 
1014
1054
  ### useTestCafeTo
1015
1055
 
1016
- Use [TestCafe][12] API inside a test.
1056
+ Use [TestCafe][15] API inside a test.
1017
1057
 
1018
1058
  First argument is a description of an action.
1019
1059
  Second argument is async function that gets this helper as parameter.
1020
1060
 
1021
- { [`t`][13]) } object from TestCafe API is available.
1061
+ { [`t`][16]) } object from TestCafe API is available.
1022
1062
 
1023
1063
  ```js
1024
1064
  I.useTestCafeTo('handle browser dialog', async ({ t }) {
@@ -1029,7 +1069,7 @@ I.useTestCafeTo('handle browser dialog', async ({ t }) {
1029
1069
  #### Parameters
1030
1070
 
1031
1071
  - `description` **[string][4]** used to show in logs.
1032
- - `fn` **[function][6]** async functuion that executed with TestCafe helper as argument
1072
+ - `fn` **[function][8]** async functuion that executed with TestCafe helper as argument
1033
1073
 
1034
1074
  ### wait
1035
1075
 
@@ -1041,7 +1081,7 @@ I.wait(2); // wait 2 secs
1041
1081
 
1042
1082
  #### Parameters
1043
1083
 
1044
- - `sec` **[number][9]** number of second to wait.
1084
+ - `sec` **[number][12]** number of second to wait.
1045
1085
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1046
1086
 
1047
1087
  ### waitForElement
@@ -1057,7 +1097,7 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
1057
1097
  #### Parameters
1058
1098
 
1059
1099
  - `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
1060
- - `sec` **[number][9]?** (optional, `1` by default) time in seconds to wait
1100
+ - `sec` **[number][12]?** (optional, `1` by default) time in seconds to wait
1061
1101
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1062
1102
 
1063
1103
  ### waitForFunction
@@ -1077,9 +1117,9 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
1077
1117
 
1078
1118
  #### Parameters
1079
1119
 
1080
- - `fn` **([string][4] | [function][6])** to be executed in browser context.
1081
- - `argsOrSec` **([Array][8]<any> | [number][9])?** (optional, `1` by default) arguments for function or seconds.
1082
- - `sec` **[number][9]?** (optional, `1` by default) time in seconds to wait
1120
+ - `fn` **([string][4] | [function][8])** to be executed in browser context.
1121
+ - `argsOrSec` **([Array][11]<any> | [number][12])?** (optional, `1` by default) arguments for function or seconds.
1122
+ - `sec` **[number][12]?** (optional, `1` by default) time in seconds to wait
1083
1123
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1084
1124
 
1085
1125
  ### waitForInvisible
@@ -1094,7 +1134,7 @@ I.waitForInvisible('#popup');
1094
1134
  #### Parameters
1095
1135
 
1096
1136
  - `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
1097
- - `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
1137
+ - `sec` **[number][12]** (optional, `1` by default) time in seconds to wait
1098
1138
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1099
1139
 
1100
1140
  ### waitForText
@@ -1111,7 +1151,7 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
1111
1151
  #### Parameters
1112
1152
 
1113
1153
  - `text` **[string][4]** to wait for.
1114
- - `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
1154
+ - `sec` **[number][12]** (optional, `1` by default) time in seconds to wait
1115
1155
  - `context` **([string][4] | [object][5])?** (optional) element located by CSS|XPath|strict locator.
1116
1156
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1117
1157
 
@@ -1127,7 +1167,7 @@ I.waitForVisible('#popup');
1127
1167
  #### Parameters
1128
1168
 
1129
1169
  - `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
1130
- - `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
1170
+ - `sec` **[number][12]** (optional, `1` by default) time in seconds to wait
1131
1171
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1132
1172
 
1133
1173
  ### waitInUrl
@@ -1141,7 +1181,7 @@ I.waitInUrl('/info', 2);
1141
1181
  #### Parameters
1142
1182
 
1143
1183
  - `urlPart` **[string][4]** value to check.
1144
- - `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
1184
+ - `sec` **[number][12]** (optional, `1` by default) time in seconds to wait
1145
1185
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1146
1186
 
1147
1187
  ### waitNumberOfVisibleElements
@@ -1155,8 +1195,8 @@ I.waitNumberOfVisibleElements('a', 3);
1155
1195
  #### Parameters
1156
1196
 
1157
1197
  - `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
1158
- - `num` **[number][9]** number of elements.
1159
- - `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
1198
+ - `num` **[number][12]** number of elements.
1199
+ - `sec` **[number][12]** (optional, `1` by default) time in seconds to wait
1160
1200
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1161
1201
 
1162
1202
  ### waitToHide
@@ -1171,7 +1211,7 @@ I.waitToHide('#popup');
1171
1211
  #### Parameters
1172
1212
 
1173
1213
  - `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
1174
- - `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
1214
+ - `sec` **[number][12]** (optional, `1` by default) time in seconds to wait
1175
1215
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1176
1216
 
1177
1217
  ### waitUrlEquals
@@ -1186,7 +1226,7 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
1186
1226
  #### Parameters
1187
1227
 
1188
1228
  - `urlPart` **[string][4]** value to check.
1189
- - `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
1229
+ - `sec` **[number][12]** (optional, `1` by default) time in seconds to wait
1190
1230
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1191
1231
 
1192
1232
  ## getPageUrl
@@ -1207,18 +1247,24 @@ Client Functions
1207
1247
 
1208
1248
  [5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
1209
1249
 
1210
- [6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
1250
+ [6]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
1251
+
1252
+ [7]: https://playwright.dev/docs/api/class-locator#locator-blur
1253
+
1254
+ [8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
1255
+
1256
+ [9]: https://playwright.dev/docs/api/class-locator#locator-focus
1211
1257
 
1212
- [7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
1258
+ [10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
1213
1259
 
1214
- [8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
1260
+ [11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
1215
1261
 
1216
- [9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
1262
+ [12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
1217
1263
 
1218
- [10]: https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value
1264
+ [13]: https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value
1219
1265
 
1220
- [11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
1266
+ [14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
1221
1267
 
1222
- [12]: https://devexpress.github.io/testcafe/documentation/test-api/
1268
+ [15]: https://devexpress.github.io/testcafe/documentation/test-api/
1223
1269
 
1224
- [13]: https://devexpress.github.io/testcafe/documentation/test-api/test-code-structure.html#test-controller
1270
+ [16]: https://devexpress.github.io/testcafe/documentation/test-api/test-code-structure.html#test-controller