Skip to content

Commit fe3a89b

Browse files
author
Abhi Singh
committed
adds multiple reporter option
1 parent 7e14e09 commit fe3a89b

File tree

8 files changed

+752
-9
lines changed

8 files changed

+752
-9
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ You need BrowserStack credentials to be able to run Cypress tests. You have to r
1414

1515
**Alternatively, you can set the environment variables `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY` with your credentials and all the scripts in this repository should work fine**
1616

17+
NOTE: **Supported on Node v14+**
18+
1719
## Run Cypress test on BrowserStack
1820

1921
1. Clone this repository

browserstack.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@
2828
"exclude": [],
2929
"parallels": "3",
3030
"npm_dependencies": {
31-
"browserstack-cypress-cli": "^1.19.3",
3231
"cypress": "^12.5.1",
3332
"cypress-cucumber-preprocessor": "^4.3.1",
33+
"cypress-multi-reporters": "^1.6.2",
3434
"cypress-xpath": "^2.0.1",
35+
"mocha-junit-reporter": "^2.2.0",
3536
"mochawesome": "^7.1.3"
3637
},
3738
"package_config_options": {

cypress.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ const cucumber = require("cypress-cucumber-preprocessor").default;
44
module.exports = defineConfig({
55
watchForFileChanges: true,
66
experimentalWebKitSupport: true,
7-
reporter: "junit",
7+
reporter: "cypress-multi-reporters",
88
reporterOptions: {
9-
mochaFile: "results/test-results-[hash].xml",
9+
configFile: "reporterConfig.json",
1010
},
1111

1212
e2e: {
1313
setupNodeEvents(on, config) {
1414
on("file:preprocessor", cucumber());
1515
},
1616
specPattern: "**/e2e.feature",
17-
baseUrl: "https://bstackdemo.com/signin",
17+
baseUrl: "https://bstackdemo.com/",
1818
excludeSpecPattern: ["*.js"],
1919
},
2020
});

cypress/support/step_definitions/e2e.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const purchase = new Purchase();
1111
const orders = new Orders();
1212

1313
Given("I navigate to website", () => {
14-
cy.visit(Cypress.config().baseUrl);
14+
cy.visit(Cypress.config().baseUrl + "signin");
1515
});
1616

1717
And("I SignIn as {string} with {string} password", (username, password) => {

cypress_local.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ const cucumber = require("cypress-cucumber-preprocessor").default;
44
module.exports = defineConfig({
55
watchForFileChanges: true,
66
experimentalWebKitSupport: true,
7-
reporter: "junit",
7+
reporter: "cypress-multi-reporters",
88
reporterOptions: {
9-
mochaFile: "results/test-results-[hash].xml",
9+
configFile: "reporterConfig.json",
1010
},
1111

1212
e2e: {

0 commit comments

Comments
 (0)