Skip to content
Snippets Groups Projects
Commit d3e517a6 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6592: Move run-tests one directory up. Validate parameters. Prepare for...

OZG-6592: Move run-tests one directory up. Validate parameters. Prepare for multiple suites. Refactored Paths.
parent b7780052
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
export NO_COLOR=1
REPORT_FOLDER=$1
CONFIG_FILE="${2:-cypress.config.ts}"
echo "Run E2E for $REPORT_FOLDER with configuration apps/alfa-e2e/$CONFIG_FILE..."
rm -rf apps/alfa-e2e/reports/${REPORT_FOLDER}
npx cypress run --project apps/alfa-e2e --spec apps/alfa-e2e/src/e2e/${REPORT_FOLDER} --config-file $CONFIG_FILE
TEST_RESULT=$?
if [ -d "apps/alfa-e2e/reports/${REPORT_FOLDER}/mochawesome-report/.jsons" ]; then
mv apps/alfa-e2e/reports/${REPORT_FOLDER}/mochawesome-report/.jsons apps/alfa-e2e/reports/${REPORT_FOLDER}/mochawesome-report/jsons
npx mochawesome-merge apps/alfa-e2e/reports/${REPORT_FOLDER}/mochawesome-report/**/*.json > apps/alfa-e2e/reports/${REPORT_FOLDER}/report.json
# Workaround: mochawesome's "screenshotsFolder" value is not added in the generated HTML file. Add "screenshots" to image paths.
sed --in-place --regexp-extended 's/"([^"]*\.png)/"screenshots\1/' apps/alfa-e2e/reports/${REPORT_FOLDER}/report.json
npx marge apps/alfa-e2e/reports/${REPORT_FOLDER}/report.json -f report -o apps/alfa-e2e/reports/${REPORT_FOLDER}
else
echo "ERROR: Reports do not exist at apps/alfa-e2e/reports/${REPORT_FOLDER}/mochawesome-report/.jsons"
fi
exit $TEST_RESULT
\ No newline at end of file
#!/bin/bash
export NO_COLOR=1
REPORT_FOLDER=$1
CONFIG_FILE="${2:-cypress.config.ts}"
SUITE_NAME="${3:-alfa-e2e}"
if [ -z $REPORT_FOLDER ]; then echo "Report Folder not set" && exit 1; fi
if [ -z $CONFIG_FILE ]; then echo "Config File not set" && exit 1; fi
if [ -z $SUITE_NAME ]; then echo "Suite Name not set" && exit 1; fi
BASE_PATH=${SUITE_NAME}
REPORT_BASE_PATH=${BASE_PATH}/reports/
FULL_REPORT_PATH=${REPORT_BASE_PATH}${REPORT_FOLDER}
MOCHA_REPORT_PATH=${FULL_REPORT_PATH}/mochawesome-report/
MOCHA_REPORT_JSONS=${MOCHA_REPORT_PATH}.jsons
MOCHA_REPORT_FILE=${MOCHA_REPORT_PATH}report.json
echo "Run E2E for ${REPORT_FOLDER} with configuration ${BASE_PATH}/$CONFIG_FILE..."
rm -rf ${FULL_REPORT_PATH}
npx cypress run --project ${BASE_PATH} --spec ${BASE_PATH}/src/e2e/${REPORT_FOLDER} --config-file $CONFIG_FILE
TEST_RESULT=$?
if [ -d "${MOCHA_REPORT_JSONS}" ]; then
mv ${MOCHA_REPORT_JSONS} ${MOCHA_REPORT_PATH}/jsons
npx mochawesome-merge ${MOCHA_REPORT_PATH}**/*.json > ${MOCHA_REPORT_FILE}
# Workaround: mochawesome's "screenshotsFolder" value is not added in the generated HTML file. Add "screenshots" to image paths.
sed --in-place --regexp-extended 's/"([^"]*\.png)/"screenshots\1/' ${MOCHA_REPORT_FILE}
npx marge ${MOCHA_REPORT_FILE} -f report -o ${FULL_REPORT_PATH}
else
echo "ERROR: Reports do not exist at ${MOCHA_REPORT_JSONS}"
fi
exit $TEST_RESULT
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment