wdio-rerun-service 2.0.6 → 2.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.
Files changed (2) hide show
  1. package/README.md +44 -1
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -8,7 +8,7 @@ WebdriverIO Re-run Service
8
8
 
9
9
  This service tracks failing Mocha or Jasmine tests and Cucumber scenarios executed within the [WebdriverIO](https://webdriver.io) test framework. It will allow failing or unstable tests or scenarios to be re-run.
10
10
 
11
- _NOTE_: Users running WebdriverIO versions `5.x.x` and `6.x.x` should use version `1.6.x`. If you are on `7.x.x`, use version `1.7.x` version of this service. If you are on the latest major version of `8.x.x`, use the latest `2.x.x` version of this service.
11
+ _NOTE_: Users running WebdriverIO `7.x.x`, use version `1.7.x` version of this service. If you are on the latest major version of `8.x.x`, use the latest `2.x.x` version of this service.
12
12
 
13
13
  ## Re-run vs. Retry
14
14
 
@@ -54,6 +54,48 @@ export const config = {
54
54
 
55
55
  Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted.html)
56
56
 
57
+ ## Usage
58
+ By design, this service does not automatically re-run failed tests.
59
+
60
+ After WebDriver.IO has completed execution, if failures or unstable tests/scenarios are found a file will be at **rerunScriptPath** or by default `./rerun.sh` (see Configuration).
61
+
62
+ ### Conditional Re-run
63
+ Every teams re-run needs will differ execution could be based on any number of factors, this is an example of how to accomplish a conditional re-run based on # of failures.
64
+
65
+ ##### attemptRerun.sh
66
+ Executes `./rerun.sh` if less than 25 failures have been found in last execution of WebDriver.IO.
67
+ ```sh
68
+ #!/usr/bin/env bash
69
+ MAX_TO_RERUN=${MAX_TO_RERUN:=25}
70
+ if [ -f "rerun.sh" ]; then
71
+ echo "[rerun.sh] file exits, checking total failures."
72
+ NUMBER_OF_FAILURES=$(grep "\-\-spec" -o rerun.sh | wc -l | xargs)
73
+ if [ "$MAX_TO_RERUN" -gt "$NUMBER_OF_FAILURES" ]; then
74
+ echo "Re-running $NUMBER_OF_FAILURES failed scenarios!"
75
+ . ./rerun.sh
76
+ else
77
+ echo "Skipping re-run, expected < $MAX_TO_RERUN failures to qualify execution for re-run, got $NUMBER_OF_FAILURES failures."
78
+ fi
79
+ else
80
+ echo "No [rerun.sh] file exits, skipping re-run!"
81
+ fi
82
+ ```
83
+ ##### Bash Re-run Command
84
+ Execute in shell
85
+ ```sh
86
+ . ./attemptRerun.sh
87
+ ```
88
+ ##### Integrate with NPM
89
+ Add task in `package.json`
90
+ ```sh
91
+ "attempt-rerun": ". ./attemptRerun.sh"
92
+ ````
93
+ ##### NPM Re-run Command
94
+ Execute in shell
95
+ ```sh
96
+ npm run attempt-rerun
97
+ ```
98
+
57
99
  ## Configuration
58
100
 
59
101
  The following options may be added to the wdio.conf.js file. To define options for the service you need to add the service to the `services` list in the following way:
@@ -178,3 +220,4 @@ export const config = {
178
220
  }
179
221
  ```
180
222
  ----
223
+
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "wdio-rerun-service",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "A WebdriverIO service to track and prepare for re-running failing or flaky Jasmine/Mocha tests or Cucumber Scenarios.",
5
- "author": "Mike Salvia <msalvia@jwplayer.com>",
5
+ "author": "Mike Salvia <mike.salvia@icloud.com>",
6
6
  "homepage": "https://github.com/webdriverio-community/wdio-rerun-service",
7
7
  "license": "MIT",
8
8
  "publishConfig": {
@@ -86,8 +86,8 @@
86
86
  "@types/uuid": "^9.0.0",
87
87
  "@typescript-eslint/eslint-plugin": "^5.46.1",
88
88
  "@typescript-eslint/parser": "^5.46.1",
89
- "@wdio/cucumber-framework": "^8.0.13",
90
- "@wdio/globals": "^8.0.13",
89
+ "@wdio/cucumber-framework": "^8.13.9",
90
+ "@wdio/globals": "^8.13.10",
91
91
  "cross-env": "^7.0.3",
92
92
  "eslint": "^8.30.0",
93
93
  "eslint-config-prettier": "^8.5.0",