Skip to content

Commit

Permalink
add: support for cucumber espresso tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rushabhshroff committed Aug 30, 2023
1 parent 3a7bbb0 commit 305e042
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions run-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ This action fulfils the following objectives in your runner environment:
* default:
* false, in case this param isn't passed reports will not be uploaded to artifacts.
* specify if you want to upload test reports to artifacts.
* Note: For Espresso Cucumber Tests, please pass [plugins to your cucumberOptions](https://www.browserstack.com/docs/app-automate/espresso/run-cucumber-tests#:~:text=Step%201%3A%20Specify%20format%20of%20test%20report%20in%20command) in your config file for the report to be uploaded.

> Note: In case you are using this action along with **browserstack/github-actions/upload-app@beta** you need not specify app and test_suite in the config and framework in the inputs. It will the automatically picked from the previous steps outputs.
Expand Down
5 changes: 3 additions & 2 deletions run-tests/config/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ module.exports = {
xcuitest: 'xcuitest/v2/builds',
},
REPORT: {
espresso: 'report',
xcuitest: 'resultbundle',
espresso_junit: 'report',
espresso_cucumber: 'assets',
xcuitest_resultbundle: 'resultbundle',
},
DASHBOARD_BASE: 'app-automate.browserstack.com/dashboard/v2/builds',
},
Expand Down
16 changes: 15 additions & 1 deletion run-tests/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,26 @@ class TestRunner {
const rootDir = './reports';
const username = process.env[ENV_VARS.BROWSERSTACK_USERNAME].replace("-GitHubAction", "");
const accesskey = process.env[ENV_VARS.BROWSERSTACK_ACCESS_KEY];
const inputCapabilities = content.input_capabilities;
let reportEndpoint;
if (framework === FRAMEWORKS.espresso) {
if (inputCapabilities.cucumberOptions && inputCapabilities.cucumberOptions.plugins) {
reportEndpoint = URLS.REPORT.espresso_cucumber;
} else {
reportEndpoint = URLS.REPORT.espresso_junit;
}
} else if (framework === FRAMEWORKS.xcuitest) {
reportEndpoint = URLS.REPORT.xcuitest_resultbundle;
} else {
core.error(new Error("Invalid Framework."));
return;
}
for (const device of devices) {
const { sessions } = device;
for (const session of sessions) {
const { id } = session;
const options = {
url: `https://${username}:${accesskey}@${URLS.BASE_URL}/${URLS.WATCH_FRAMEWORKS[framework]}/${buildId}/sessions/${id}/${URLS.REPORT[framework]}`,
url: `https://${username}:${accesskey}@${URLS.BASE_URL}/${URLS.WATCH_FRAMEWORKS[framework]}/${buildId}/sessions/${id}/${reportEndpoint}`,
};
/* eslint-disable no-eval */
promises.push(new Promise((resolve, reject) => {
Expand Down

0 comments on commit 305e042

Please sign in to comment.