diff --git a/alfa-client/apps/alfa-e2e/run-tests.sh b/alfa-client/apps/alfa-e2e/run-tests.sh deleted file mode 100755 index 6b7f5098a285a5417326b611f500c686fcd1f08f..0000000000000000000000000000000000000000 --- a/alfa-client/apps/alfa-e2e/run-tests.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/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 diff --git a/alfa-client/apps/run-tests.sh b/alfa-client/apps/run-tests.sh new file mode 100644 index 0000000000000000000000000000000000000000..fa5009b7d4966811e57783a10594c05819d75705 --- /dev/null +++ b/alfa-client/apps/run-tests.sh @@ -0,0 +1,37 @@ +#!/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