diff --git a/package.json b/package.json index 281d7eeeb5..b0c6e7f8c7 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "e2e": "./scripts/test-e2e-lib.sh -host 'localhost:4200' -dev --folder demo-shell", "e2e-lib": "ng e2e lib-e2e-test --port=4200", "lite-server-e2e": "lite-server --baseDir='demo-shell/dist/' -c ./e2e/lite-server-proxy.js", - "replace-cloud-config": "node appConfigReplace.cloud.js", + "postbuild:ci": "node ./scripts/app-config-replace.js", "06": "echo -------------------------------------------- Clean ----------------------------------------------", "06s": "", "clean": "rimraf dist ./node_modules typings lib/dist", diff --git a/scripts/app-config-replace.js b/scripts/app-config-replace.js new file mode 100644 index 0000000000..4128d2c78d --- /dev/null +++ b/scripts/app-config-replace.js @@ -0,0 +1,21 @@ +// Protractor configuration file, see link for more information +// https://github.com/angular/protractor/blob/master/lib/config.ts + +require('dotenv').config({ path: process.env.ENV_FILE }); +const fs = require('fs'); + +const PROXY_HOST_ADF = process.env.PROXY_HOST_ADF; +const NOTIFICATION_LAST = process.env.NOTIFICATION_LAST || 8000; + +const configPath = './demo-shell/dist/app.config.json'; + +fs.readFile(configPath, (err, appConfigString) => { + if (err) throw err; + let appConfig = JSON.parse(appConfigString); + appConfig.bpmHost = PROXY_HOST_ADF; + appConfig.ecmHost = PROXY_HOST_ADF; + appConfig.notificationDefaultDuration = NOTIFICATION_LAST; + + let appConfigReplacedJson = JSON.stringify(appConfig); + fs.writeFileSync(configPath, appConfigReplacedJson); +}); diff --git a/scripts/test-e2e-lib.sh b/scripts/test-e2e-lib.sh index 1ea7480185..620a3b3099 100755 --- a/scripts/test-e2e-lib.sh +++ b/scripts/test-e2e-lib.sh @@ -9,11 +9,6 @@ LITESERVER=false EXEC_VERSION_JSAPI=false TIMEOUT=120000 DEBUG=false -eval GNU=false - -gnu_mode() { - GNU=true -} show_help() { echo "Usage: ./scripts/test-e2e-lib.sh -host adf.domain.com -u admin -p admin -e admin" @@ -41,7 +36,6 @@ show_help() { echo "-log or --log print all the browser log" echo "-db or --debug run the debugger" echo "-vjsapi install different version from npm of JS-API defined in the package.json" - echo "-gnu for gnu" echo "-h or --help" } @@ -193,17 +187,10 @@ while [[ $1 == -* ]]; do -l|--lint) lint; shift;; -m|--maxInstances) max_instances $2; shift 2;; -vjsapi) version_js_api $2; shift 2;; - -gnu) gnu_mode; shift;; -*) echo "invalid option: $1" 1>&2; show_help; exit 1;; esac done -if $GNU; then - sedi='-i' -else - sedi=('-i' '') -fi - rm -rf ./e2e/downloads/ rm -rf ./e2e-output/screenshots/ @@ -232,21 +219,10 @@ if [[ $DEVELOPMENT == "true" ]]; then else if [[ $LITESERVER == "true" ]]; then echo "====== Run dist in lite-server =====" - ls demo-shell/dist - if [[ -n "${PROXY_HOST_ADF}" ]] - then - replace="\/" - encoded=${PROXY_HOST_ADF//\//$replace} - sed -e "s/\"bpmHost\": \".*\"/\"bpmHost\": \"${encoded}\"/g" "${sedi[@]}" demo-shell/dist/app.config.json - fi + ls demo-shell/dist/ || exit 1 - if [[ -n "${PROXY_HOST_ADF}" ]] - then - replace="\/" - encoded=${PROXY_HOST_ADF//\//$replace} - sed -e "s/\"ecmHost\": \".*\"/\"ecmHost\": \"${encoded}\"/g" "${sedi[@]}" demo-shell/dist/app.config.json - fi + npm run postbuild:ci npm run lite-server-e2e>/dev/null & $DEBUG_OPTION ./node_modules/protractor/bin/protractor protractor.conf.ts || exit 1 else diff --git a/scripts/travis/e2e/insights-e2e.sh b/scripts/travis/e2e/insights-e2e.sh index 4d8294f3a1..6b302285c4 100755 --- a/scripts/travis/e2e/insights-e2e.sh +++ b/scripts/travis/e2e/insights-e2e.sh @@ -10,5 +10,5 @@ AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)"; if [[ $AFFECTED_LIBS =~ "testing" || $AFFECTED_LIBS =~ "insight" || $TRAVIS_PULL_REQUEST == "false" ]]; then node ./scripts/check-env/check-ps-env.js --host "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" || exit 1; - ./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e "$E2E_EMAIL" --folder insights --use-dist -gnu || exit 1; + ./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e "$E2E_EMAIL" --folder insights --use-dist || exit 1; fi; diff --git a/scripts/travis/e2e/process-services-cloud-e2e.sh b/scripts/travis/e2e/process-services-cloud-e2e.sh index cc3fa09e97..384b475fd9 100755 --- a/scripts/travis/e2e/process-services-cloud-e2e.sh +++ b/scripts/travis/e2e/process-services-cloud-e2e.sh @@ -11,7 +11,7 @@ CONTEXT_ENV="process-services-cloud" AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)"; AFFECTED_E2E="$(./scripts/git-util/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e/$CONTEXT_ENV")"; -RUN_E2E=$(echo ./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2E_HOST_BPM" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e "$E2E_EMAIL" -host_sso "$E2E_HOST_SSO" -host_bpm "$E2E_HOST_BPM" -host_identity "$E2E_HOST_IDENTITY" -identity_admin_email "$E2E_ADMIN_EMAIL_IDENTITY" -identity_admin_password "$E2E_ADMIN_PASSWORD_IDENTITY" -prefix $TRAVIS_BUILD_NUMBER --use-dist -gnu ) +RUN_E2E=$(echo ./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2E_HOST_BPM" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e "$E2E_EMAIL" -host_sso "$E2E_HOST_SSO" -host_bpm "$E2E_HOST_BPM" -host_identity "$E2E_HOST_IDENTITY" -identity_admin_email "$E2E_ADMIN_EMAIL_IDENTITY" -identity_admin_password "$E2E_ADMIN_PASSWORD_IDENTITY" -prefix $TRAVIS_BUILD_NUMBER --use-dist ) ./node_modules/@alfresco/adf-cli/bin/adf-cli init-aae-env --host "$E2E_HOST_BPM" --oauth "$E2E_HOST_SSO" --username "$E2E_USERNAME" --password "$E2E_PASSWORD" --clientId 'activiti' || exit 1 node ./scripts/check-env/check-cs-env.js --host "$E2E_HOST_BPM" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" || exit 1 diff --git a/scripts/travis/e2e/process-services-e2e.sh b/scripts/travis/e2e/process-services-e2e.sh index 2c1f9b9f64..0aa744b19a 100755 --- a/scripts/travis/e2e/process-services-e2e.sh +++ b/scripts/travis/e2e/process-services-e2e.sh @@ -12,7 +12,7 @@ AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)"; AFFECTED_E2E="$(./scripts/git-util/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e/$CONTEXT_ENV")"; node ./scripts/check-env/check-ps-env.js --host "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" || exit 1 -RUN_E2E=$(echo ./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e "$E2E_EMAIL" --use-dist -b -m 4 -gnu ) +RUN_E2E=$(echo ./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e "$E2E_EMAIL" --use-dist -b -m 4 ) if [[ $AFFECTED_LIBS =~ "testing" || $AFFECTED_LIBS =~ "$CONTEXT_ENV" || $TRAVIS_PULL_REQUEST == "false" ]]; then diff --git a/scripts/travis/e2e/search-e2e.sh b/scripts/travis/e2e/search-e2e.sh index 1f168cb17b..045a221050 100755 --- a/scripts/travis/e2e/search-e2e.sh +++ b/scripts/travis/e2e/search-e2e.sh @@ -12,7 +12,7 @@ AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)"; AFFECTED_E2E="$(./scripts/git-util/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e/$CONTEXT_ENV")"; node ./scripts/check-env/check-cs-env.js --host "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" || exit 1 -RUN_E2E=$(echo ./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e "$E2E_EMAIL" --use-dist -b -m 2 -gnu ) +RUN_E2E=$(echo ./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e "$E2E_EMAIL" --use-dist -b -m 2 ) if [[ $AFFECTED_LIBS =~ "testing" || $AFFECTED_LIBS =~ "content-services" || $TRAVIS_PULL_REQUEST == "false" ]]; then