@@ -7,6 +7,12 @@ title: Plugins
77
88<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
99
10+ ## analyze
11+
12+ ### Parameters
13+
14+ - ` config ` ** any** (optional, default ` {} ` )
15+
1016## autoDelay
1117
1218Sometimes it takes some time for a page to respond to user's actions.
@@ -521,29 +527,13 @@ I.click('=sign-up') // matches => [data-qa=sign-up],[data-test=sign-up]
521527
522528- ` config`  
523529
524- ## debugErrors
525-
526- Prints errors found in HTML code after each failed test.
527-
528- It scans HTML and searches for elements with error classes.
529- If an element found prints a text from it to console and adds as artifact to the test.
530-
531- Enable this plugin in config:
532-
533- ` ` ` js
534- plugins: {
535- debugErrors: {
536- enabled: true ,
537- }
538- ` ` `
539-
540- Additional config options:
530+ ## customReporter
541531
542- - ` errorClasses ` - list of classes to search for errors (default: ` [ ' error ' , ' warning ' , ' alert ' , ' danger ' ] ` )
532+ Sample custom reporter for CodeceptJS.
543533
544534### Parameters
545535
546- - ` config` (optional, default ` {} ` )
536+ - ` config`  
547537
548538## eachElement
549539
@@ -672,6 +662,32 @@ More config options are available:
672662
673663- ` config` (optional, default ` {}` )
674664
665+ ## pageInfo
666+
667+ Collects information from web page after each failed test and adds it to the test as an artifact.
668+ It is suggested to enable this plugin if you run tests on CI and you need to debug failed tests.
669+ This plugin can be paired with ` analyze` plugin to provide more context.
670+
671+ It collects URL, HTML errors (by classes), and browser logs.
672+
673+ Enable this plugin in config:
674+
675+ ` ` ` js
676+ plugins: {
677+ pageInfo: {
678+ enabled: true ,
679+ }
680+ ` ` `
681+
682+ Additional config options:
683+
684+ - ` errorClasses` - list of classes to search for errors (default: ` [' error' , ' warning' , ' alert' , ' danger' ]` )
685+ - ` browserLogs` - list of types of errors to search for in browser logs (default: ` [' error' ]` )
686+
687+ ### Parameters
688+
689+ - ` config` (optional, default ` {}` )
690+
675691## pauseOnFail
676692
677693Automatically launches [interactive pause][11] when a test fails.
@@ -757,79 +773,6 @@ Scenario('scenario tite', () => {
757773
758774- ` config`  
759775
760- ## retryTo
761-
762- Adds global ` retryTo` which retries steps a few times before failing.
763-
764- Enable this plugin in ` codecept .conf .js ` (enabled by default for new setups):
765-
766- ` ` ` js
767- plugins: {
768- retryTo: {
769- enabled: true
770- }
771- }
772- ` ` `
773-
774- Use it in your tests:
775-
776- ` ` ` js
777- // retry these steps 5 times before failing
778- await retryTo (tryNum => {
779- I .switchTo (' #editor frame' )
780- I .click (' Open' )
781- I .see (' Opened' )
782- }, 5 )
783- ` ` `
784-
785- Set polling interval as 3rd argument (200ms by default):
786-
787- ` ` ` js
788- // retry these steps 5 times before failing
789- await retryTo (
790- tryNum => {
791- I .switchTo (' #editor frame' )
792- I .click (' Open' )
793- I .see (' Opened' )
794- },
795- 5 ,
796- 100 ,
797- )
798- ` ` `
799-
800- Default polling interval can be changed in a config:
801-
802- ` ` ` js
803- plugins: {
804- retryTo: {
805- enabled: true ,
806- pollInterval: 500 ,
807- }
808- }
809- ` ` `
810-
811- Disables retryFailedStep plugin for steps inside a block;
812-
813- Use this plugin if:
814-
815- - you need repeat a set of actions in flaky tests
816- - iframe was not rendered and you need to retry switching to it
817-
818- #### Configuration
819-
820- - ` pollInterval` - default interval between retries in ms. 200 by default.
821- - ` registerGlobal` - to register ` retryTo` function globally, true by default
822-
823- If ` registerGlobal` is false you can use retryTo from the plugin:
824-
825- ` ` ` js
826- const retryTo = codeceptjs .container .plugins (' retryTo' )
827- ` ` `
828-
829- ### Parameters
830-
831- - ` config`  
832-
833776## screenshotOnFail
834777
835778Creates screenshot on failure. Screenshot is saved into ` output` directory.
@@ -1083,76 +1026,6 @@ plugins: {
10831026}
10841027` ` `
10851028
1086- ## tryTo
1087-
1088- Adds global ` tryTo` function in which all failed steps won't fail a test but will return true/false.
1089-
1090- Enable this plugin in ` codecept .conf .js ` (enabled by default for new setups):
1091-
1092- ` ` ` js
1093- plugins: {
1094- tryTo: {
1095- enabled: true
1096- }
1097- }
1098- ` ` `
1099-
1100- Use it in your tests:
1101-
1102- ` ` ` js
1103- const result = await tryTo (() => I .see (' Welcome' ))
1104-
1105- // if text "Welcome" is on page, result => true
1106- // if text "Welcome" is not on page, result => false
1107- ` ` `
1108-
1109- Disables retryFailedStep plugin for steps inside a block;
1110-
1111- Use this plugin if:
1112-
1113- - you need to perform multiple assertions inside a test
1114- - there is A/B testing on a website you test
1115- - there is "Accept Cookie" banner which may surprisingly appear on a page.
1116-
1117- #### Usage
1118-
1119- #### Multiple Conditional Assertions
1120-
1121- ` ` ` ` js
1122-
1123- Add assert requires first:
1124- ` ` ` js
1125- const assert = require (' assert' );
1126- ` ` ` `
1127-
1128- Then use the assertion:
1129- const result1 = await tryTo (() => I .see (' Hello, user' ));
1130- const result2 = await tryTo (() => I .seeElement (' .welcome' ));
1131- assert .ok (result1 && result2, ' Assertions were not succesful' );
1132-
1133- ` ` ` `
1134-
1135- ##### Optional click
1136-
1137- ` ` ` js
1138- I.amOnPage('/');
1139- tryTo(() => I.click('Agree', '.cookies'));
1140- ` ` ` `
1141-
1142- #### Configuration
1143-
1144- - ` registerGlobal` - to register ` tryTo` function globally, true by default
1145-
1146- If ` registerGlobal` is false you can use tryTo from the plugin:
1147-
1148- ` ` ` js
1149- const tryTo = codeceptjs .container .plugins (' tryTo' )
1150- ` ` `
1151-
1152- ### Parameters
1153-
1154- - ` config`  
1155-
11561029## wdio
11571030
11581031Webdriverio services runner.
0 commit comments