mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-4957] Use Replace JS instead of sed to run e2e (#5160)
* use replace js * Update app-config-replace.js * update replace * update replace * fix folder
This commit is contained in:
committed by
Denys Vuika
parent
450b20eca4
commit
27fa7a4725
@@ -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",
|
||||
|
21
scripts/app-config-replace.js
Normal file
21
scripts/app-config-replace.js
Normal file
@@ -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);
|
||||
});
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user