CI - Ability to run only e2e cloud in case is the only affected folder (#4783)

* Remove skiplint option in favour of lint
Refactor protractor config

* Move rebase check

* Remove the skiplint and run only e2e cloud

* Remove the skip lint

* Change e2e cloud and check the CI runs only that one

* Enable the smart e2e on content

* Delegate the e2e run on the specific project

* Fix typo on specs option

* Add basic readme and fix process service name problem

* Fix bash else if
This commit is contained in:
Maurizio Vitale 2019-05-28 11:04:40 +01:00 committed by Eugenio Romano
parent 6897f20954
commit f6d8bd4130
12 changed files with 213 additions and 50 deletions

View File

@ -46,6 +46,7 @@ describe('Comment Component', () => {
'name': resources.Files.ADF_DOCUMENTS.PNG.file_name, 'name': resources.Files.ADF_DOCUMENTS.PNG.file_name,
'location': resources.Files.ADF_DOCUMENTS.PNG.file_location 'location': resources.Files.ADF_DOCUMENTS.PNG.file_location
}); });
const uploadActions = new UploadActions(); const uploadActions = new UploadActions();
let nodeId, userFullName; let nodeId, userFullName;

View File

@ -41,6 +41,7 @@ describe('Applications list', () => {
it('[C289910] Should the app be displayed on dashboard when is deployed on APS', () => { it('[C289910] Should the app be displayed on dashboard when is deployed on APS', () => {
navigationBarPage.navigateToProcessServicesCloudPage(); navigationBarPage.navigateToProcessServicesCloudPage();
appListCloudPage.checkApsContainer(); appListCloudPage.checkApsContainer();
appListCloudPage.checkAppIsDisplayed(simpleApp); appListCloudPage.checkAppIsDisplayed(simpleApp);
appListCloudPage.goToApp(simpleApp); appListCloudPage.goToApp(simpleApp);
}); });

View File

@ -1,3 +1,80 @@
# Alfresco Testing Library # Alfresco Testing Library
Contains the reusable pages for e2e tests Contains the reusable pages for e2e tests
## Run e2e against a remote env using the .env.cloud file
Create a file `.env.cloud` under the `e2e` folder
```
URL_HOST_BPM_ADF="https://gateway.example.com"
URL_HOST_SSO_ADF="https://identity.example.com/auth/realms/alfresco"
URL_HOST_IDENTITY="https://identity.example.com/auth/admin/realms/alfresco"
IDENTITY_USERNAME_ADF="username"
IDENTITY_PASSWORD_ADF="password"
```
### How can I run the *cloud* e2e against a *remote* env with *chrome headless* ?
Add to `.env.cloud` and run `./scripts/test-e2e-lib.sh`
```
FOLDER="process-services-cloud"
URL_HOST_ADF="http://myadf.example.com"
...
```
or
`./scripts/test-e2e-lib.sh -host http://myadf.example.com -f process-services-cloud`
### How can I run the *cloud* e2e against a *remote* env with *full chrome* ?
Add to `.env.cloud` and run `./scripts/test-e2e-lib.sh`
```
BROWSER_RUN=true
FOLDER="process-services-cloud"
URL_HOST_ADF="http://myadf.example.co"
...
```
or
`./scripts/test-e2e-lib.sh -host http://myadf.example.com -f process-services-cloud -b`
### How can I run specific *specs* agains a *remote* env?
Add to `.env.cloud` and run `./scripts/test-e2e-lib.sh`
```
LIST_SPECS="process-services-cloud/apps-section-cloud.e2e.ts,process-services-cloud/task-filters-cloud.e2e.ts"
URL_HOST_ADF="http://myadf.example.co"
...
```
or `./scripts/test-e2e-lib.sh -host http://myadf.example.com -s process-services-cloud/apps-section-cloud.e2e.ts,process-services-cloud/task-filters-cloud.e2e.ts`
## Run e2e against a local env (use dist) using the .env.cloud file
Create a file `.env.cloud` under the `e2e` folder
```
URL_HOST_BPM_ADF="https://gateway.example.com"
URL_HOST_SSO_ADF="https://identity.example.com/auth/realms/alfresco"
URL_HOST_IDENTITY="https://identity.example.com/auth/admin/realms/alfresco"
IDENTITY_USERNAME_ADF="username"
IDENTITY_PASSWORD_ADF="password"
```
### How can I run the *cloud* e2e against a *local* env with *chrome headless* ?
Add to `.env.cloud` and run `./scripts/test-e2e-lib.sh -ud`
```
FOLDER="process-services-cloud"
URL_HOST_ADF="http://localhost:4200"
...
```
or `./scripts/test-e2e-lib.sh -ud -host http://localhost:4200 -f process-services-cloud `
### How can I run the *cloud* e2e against a *local* env with *full chrome* ?
Add to `.env.cloud` and run `./scripts/test-e2e-lib.sh -ud`
```
BROWSER_RUN=true
FOLDER="process-services-cloud"
URL_HOST_ADF="http://localhost:4200"
...
```
or `./scripts/test-e2e-lib.sh -ud -host http://localhost:4200 -f process-services-cloud -b`
### How can I run specific *specs* agains a *local* env?
Add to `.env.cloud` and run `./scripts/test-e2e-lib.sh -ud`
```
LIST_SPECS="process-services-cloud/apps-section-cloud.e2e.ts,process-services-cloud/task-filters-cloud.e2e.ts"
URL_HOST_ADF="http://localhost:4200"
...
```
or `./scripts/test-e2e-lib.sh -ud -host http://localhost:4200 -s process-services-cloud/apps-section-cloud.e2e.ts,process-services-cloud/task-filters-cloud.e2e.ts`

View File

@ -27,6 +27,7 @@ let SELENIUM_PROMISE_MANAGER = parseInt(process.env.SELENIUM_PROMISE_MANAGER);
let MAXINSTANCES = process.env.MAXINSTANCES || 1; let MAXINSTANCES = process.env.MAXINSTANCES || 1;
let TIMEOUT = parseInt(process.env.TIMEOUT, 10); let TIMEOUT = parseInt(process.env.TIMEOUT, 10);
let SAVE_SCREENSHOT = (process.env.SAVE_SCREENSHOT == 'true'); let SAVE_SCREENSHOT = (process.env.SAVE_SCREENSHOT == 'true');
let LIST_SPECS = process.env.LIST_SPECS || [];
const BPM_HOST = process.env.URL_HOST_BPM_ADF || "bpm"; const BPM_HOST = process.env.URL_HOST_BPM_ADF || "bpm";
const OAUTH_HOST = process.env.URL_HOST_SSO_ADF || "keycloak"; const OAUTH_HOST = process.env.URL_HOST_SSO_ADF || "keycloak";
@ -54,11 +55,7 @@ const appConfig = {
} }
}; };
let specsToRun = './**/e2e/' + FOLDER + '**/*.e2e.ts'; let specsToRun = './**/e2e/' + FOLDER + '/**/*.e2e.ts';
if (process.env.NAME_TEST) {
specsToRun = './e2e/**/' + process.env.NAME_TEST;
}
let args_options = []; let args_options = [];
@ -173,13 +170,17 @@ saveReport = async function (filenameReport, alfrescoJsApi) {
} }
}; };
if (LIST_SPECS.length==0) {
arraySpecs = [specsToRun];
} else {
arraySpecs = LIST_SPECS.split(',');
arraySpecs = arraySpecs.map( (el) => './'+el);
}
exports.config = { exports.config = {
allScriptsTimeout: TIMEOUT, allScriptsTimeout: TIMEOUT,
specs: [ specs: arraySpecs,
specsToRun
],
useAllAngular2AppRoots: true, useAllAngular2AppRoots: true,
@ -327,7 +328,7 @@ exports.config = {
retryCount = ++argv.retry; retryCount = ++argv.retry;
} }
let filenameReport = `ProtractorTestReport-${FOLDER.replace('/', '')}-${retryCount}`; let filenameReport = `ProtractorTestReport-${FOLDER}-${retryCount}`;
let output = ''; let output = '';
let savePath = `${projectRoot}/e2e-output/junit-report/`; let savePath = `${projectRoot}/e2e-output/junit-report/`;

View File

@ -13,7 +13,6 @@ show_help() {
} }
gnu_mode() { gnu_mode() {
echo "====== GNU MODE ====="
GNU=true GNU=true
} }
@ -42,9 +41,6 @@ then
exit 0 exit 0
fi fi
#check if branch needs to be updated
./scripts/check-branch-updated.sh -b $BRANCH_NAME || exit 1;
# tmp folder doesn't exist. # tmp folder doesn't exist.
if [ ! -d "$DIRECTORY" ]; then if [ ! -d "$DIRECTORY" ]; then
#find affected libs #find affected libs
@ -58,7 +54,7 @@ if [ ! -f $DIRECTORY/deps.txt ]; then
npm run affected:libs -- $HEAD_SHA_BRANCH "HEAD" > $DIRECTORY/deps.txt npm run affected:libs -- $HEAD_SHA_BRANCH "HEAD" > $DIRECTORY/deps.txt
fi fi
cat $DIRECTORY/deps.txt #cat $DIRECTORY/deps.txt
#echo "extensions" > deps.txt #echo "extensions" > deps.txt
#clean file #clean file
@ -135,4 +131,4 @@ do
fi fi
done done
echo "AFFECTED LIBS => ${AFFECTED_LIBS}" echo "${AFFECTED_LIBS}"

View File

@ -4,7 +4,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR/../" cd "$DIR/../"
BROWSER_RUN=false BROWSER_RUN=false
DEVELOPMENT=false DEVELOPMENT=false
EXECLINT=true EXECLINT=false
LITESERVER=false LITESERVER=false
EXEC_VERSION_JSAPI=false EXEC_VERSION_JSAPI=false
TIMEOUT=15000 TIMEOUT=15000
@ -29,7 +29,7 @@ show_help() {
echo "-host_sso the entire path including the name of the realm" echo "-host_sso the entire path including the name of the realm"
echo "-save save the error screenshot in the remote env" echo "-save save the error screenshot in the remote env"
echo "-timeout or --timeout override the timeout foe the wait utils" echo "-timeout or --timeout override the timeout foe the wait utils"
echo "-sl --skip-lint skip lint" echo "-l --lint enable lint"
echo "-m --maxInstances max instances parallel for tests" echo "-m --maxInstances max instances parallel for tests"
echo "-disable-control-flow disable control flow" echo "-disable-control-flow disable control flow"
echo "-db or --debug run the debugger" echo "-db or --debug run the debugger"
@ -69,9 +69,9 @@ set_host_identity(){
export URL_HOST_IDENTITY=$HOST_IDENTITY export URL_HOST_IDENTITY=$HOST_IDENTITY
} }
set_test(){ set_specs(){
SINGLE_TEST=true LIST_SPECS=$1
NAME_TEST=$1 export LIST_SPECS=$LIST_SPECS
} }
set_browser(){ set_browser(){
@ -99,14 +99,15 @@ set_development(){
set_test_folder(){ set_test_folder(){
FOLDER=$1 FOLDER=$1
export FOLDER=$FOLDER
} }
set_selenium(){ set_selenium(){
SELENIUM_SERVER=$1 SELENIUM_SERVER=$1
} }
skip_lint(){ lint(){
EXECLINT=false EXECLINT=true
} }
debug(){ debug(){
@ -148,7 +149,7 @@ while [[ $1 == -* ]]; do
-timeout|--timeout) set_timeout $2; shift 2;; -timeout|--timeout) set_timeout $2; shift 2;;
-b|--browser) set_browser; shift;; -b|--browser) set_browser; shift;;
-dev|--dev) set_development; shift;; -dev|--dev) set_development; shift;;
-s|--spec) set_test $2; shift 2;; -s|--specs) set_specs $2; shift 2;;
-db|--debug) debug; shift;; -db|--debug) debug; shift;;
-ud|--use-dist) lite_server; shift;; -ud|--use-dist) lite_server; shift;;
-save) set_save_screenshot; shift;; -save) set_save_screenshot; shift;;
@ -158,7 +159,7 @@ while [[ $1 == -* ]]; do
-host_bpm|--host_bpm) set_host_bpm $2; shift 2;; -host_bpm|--host_bpm) set_host_bpm $2; shift 2;;
-host_sso|--host_sso) set_host_sso $2; shift 2;; -host_sso|--host_sso) set_host_sso $2; shift 2;;
-host_identity|--host_identity) set_host_identity $2; shift 2;; -host_identity|--host_identity) set_host_identity $2; shift 2;;
-sl|--skip-lint) skip_lint; shift;; -l|--lint) lint; shift;;
-m|--maxInstances) max_instances $2; shift 2;; -m|--maxInstances) max_instances $2; shift 2;;
-vjsapi) version_js_api $2; shift 2;; -vjsapi) version_js_api $2; shift 2;;
-disable-control-flow|--disable-control-flow) disable_control_flow; shift;; -disable-control-flow|--disable-control-flow) disable_control_flow; shift;;
@ -171,9 +172,9 @@ rm -rf ./e2e-output/screenshots/
export SAVE_SCREENSHOT=$SAVE_SCREENSHOT export SAVE_SCREENSHOT=$SAVE_SCREENSHOT
export TIMEOUT=$TIMEOUT export TIMEOUT=$TIMEOUT
export FOLDER=$FOLDER'/'
export SELENIUM_SERVER=$SELENIUM_SERVER export SELENIUM_SERVER=$SELENIUM_SERVER
export NAME_TEST=$NAME_TEST
export MAXINSTANCES=$MAXINSTANCES export MAXINSTANCES=$MAXINSTANCES
export SELENIUM_PROMISE_MANAGER=$SELENIUM_PROMISE_MANAGER export SELENIUM_PROMISE_MANAGER=$SELENIUM_PROMISE_MANAGER

View File

@ -4,10 +4,26 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR/../../../ cd $DIR/../../../
AFFECTED_E2E="$(./scripts/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e")"; CONTEXT_ENV="content-services"
./scripts/check-branch-updated.sh -b $TRAVIS_BRANCH || exit 1;
AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)"; AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)";
if [[ $AFFECTED_LIBS =~ "content-services$" || $AFFECTED_E2E = "e2e" || $TRAVIS_PULL_REQUEST == "false" ]]; AFFECTED_E2E="$(./scripts/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e/$CONTEXT_ENV")";
RUN_CHECK=$(echo 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 || exit 1)
if [[ $AFFECTED_LIBS =~ "$CONTEXT_ENV$" || $TRAVIS_PULL_REQUEST == "false" ]];
then then
node ./scripts/check-env/check-cs-env.js --host "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" || exit 1; $RUN_CHECK
./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e "$E2E_EMAIL" --folder content-services --skip-lint --use-dist -b || exit 1; $RUN_E2E --folder $CONTEXT_ENV
else if [[ $AFFECTED_E2E = "e2e/$CONTEXT_ENV" ]];
then
HEAD_SHA_BRANCH="$(git merge-base origin/$TRAVIS_BRANCH HEAD)"
LIST_SPECS="$(git diff --name-only $HEAD_SHA_BRANCH HEAD | grep "^e2e/$CONTEXT_ENV" | paste -sd , -)"
if [[ $LIST_SPECS != "" ]];
then
echo "Run $CONTEXT_ENV e2e based on the sha $HEAD_SHA_BRANCH with the specs: "$LIST_SPECS
$RUN_CHECK
$RUN_E2E --specs "$LIST_SPECS"
fi
fi
fi; fi;

View File

@ -4,11 +4,30 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR/../../../ cd $DIR/../../../
AFFECTED_E2E="$(./scripts/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e")"; CONTEXT_ENV="core"
./scripts/check-branch-updated.sh -b $TRAVIS_BRANCH || exit 1;
AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)"; AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)";
if [[ $AFFECTED_LIBS =~ "core$" || $AFFECTED_E2E = "e2e" || $TRAVIS_PULL_REQUEST == "false" ]]; AFFECTED_E2E="$(./scripts/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e/$CONTEXT_ENV")";
RUN_CHECK_PS=$(echo node ./scripts/check-env/check-ps-env.js --host "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" || exit 1 )
RUN_CHECK_CS=$(echo 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" -save --use-dist -b )
if [[ $AFFECTED_LIBS =~ "$CONTEXT_ENV$" || $TRAVIS_PULL_REQUEST == "false" ]];
then then
node ./scripts/check-env/check-ps-env.js --host "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" || exit 1; $RUN_CHECK_PS
node ./scripts/check-env/check-cs-env.js --host "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" || exit 1; $RUN_CHECK_CS
./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e "$E2E_EMAIL" --folder core --skip-lint -save --use-dist -b || exit 1; $RUN_E2E --folder $CONTEXT_ENV
else if [[ $AFFECTED_E2E = "e2e/$CONTEXT_ENV" ]];
then
HEAD_SHA_BRANCH="$(git merge-base origin/$TRAVIS_BRANCH HEAD)"
LIST_SPECS="$(git diff --name-only $HEAD_SHA_BRANCH HEAD | grep "^e2e/$CONTEXT_ENV" | paste -sd , -)"
if [[ $LIST_SPECS != "" ]];
then
echo "Run $CONTEXT_ENV e2e based on the sha $HEAD_SHA_BRANCH with the specs: "$LIST_SPECS
$RUN_CHECK
$RUN_E2E --specs "$LIST_SPECS"
fi
fi
fi; fi;

View File

@ -4,10 +4,10 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR/../../../ cd $DIR/../../../
AFFECTED_E2E="$(./scripts/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e")"; ./scripts/check-branch-updated.sh -b $TRAVIS_BRANCH || exit 1;
AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)"; AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)";
if [[ $AFFECTED_LIBS =~ "process-services-cloud$" || $AFFECTED_E2E = "e2e" || $TRAVIS_PULL_REQUEST == "false" ]]; if [[ $AFFECTED_LIBS =~ "process-services-cloud$" || $TRAVIS_PULL_REQUEST == "false" ]];
then then
node ./scripts/check-env/check-ps-env.js --host "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" || exit 1; 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 --skip-lint --use-dist || 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; fi;

View File

@ -4,10 +4,27 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR/../../../ cd $DIR/../../../
AFFECTED_E2E="$(./scripts/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e")"; CONTEXT_ENV="process-services-cloud"
./scripts/check-branch-updated.sh -b $TRAVIS_BRANCH || exit 1;
AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)"; AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)";
if [[ $AFFECTED_LIBS =~ "process-services-cloud$" || $AFFECTED_E2E = "e2e" || $TRAVIS_PULL_REQUEST == "false" ]]; AFFECTED_E2E="$(./scripts/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e/$CONTEXT_ENV")";
RUN_CHECK=$(echo node ./scripts/check-env/check-activiti-env.js --host "$E2E_HOST_BPM" --oauth "$E2E_HOST_SSO" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" --client 'activiti' || exit 1 )
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" --use-dist )
if [[ $AFFECTED_LIBS =~ "$CONTEXT_ENV$" || $TRAVIS_PULL_REQUEST == "false" ]];
then then
node ./scripts/check-env/check-activiti-env.js --host "$E2E_HOST_BPM" --oauth "$E2E_HOST_SSO" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" --client 'activiti' || exit 1; $RUN_CHECK
./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" --folder process-services-cloud --skip-lint --use-dist -b -save || exit 1; $RUN_E2E --folder $CONTEXT_ENV
else if [[ $AFFECTED_E2E = "e2e/$CONTEXT_ENV" ]];
then
HEAD_SHA_BRANCH="$(git merge-base origin/$TRAVIS_BRANCH HEAD)"
LIST_SPECS="$(git diff --name-only $HEAD_SHA_BRANCH HEAD | grep "^e2e/$CONTEXT_ENV" | paste -sd , -)"
if [[ $LIST_SPECS != "" ]];
then
echo "Run $CONTEXT_ENV e2e based on the sha $HEAD_SHA_BRANCH with the specs: "$LIST_SPECS
$RUN_CHECK
$RUN_E2E --specs "$LIST_SPECS"
fi
fi
fi; fi;

View File

@ -4,10 +4,27 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR/../../../ cd $DIR/../../../
AFFECTED_E2E="$(./scripts/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e")"; CONTEXT_ENV="process-services"
./scripts/check-branch-updated.sh -b $TRAVIS_BRANCH || exit 1;
AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)"; AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)";
if [[ $AFFECTED_LIBS =~ "process-services$" || $AFFECTED_E2E = "e2e" || $TRAVIS_PULL_REQUEST == "false" ]]; AFFECTED_E2E="$(./scripts/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e/$CONTEXT_ENV/")";
RUN_CHECK=$(echo 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 )
if [[ $AFFECTED_LIBS =~ "$CONTEXT_ENV$" || $TRAVIS_PULL_REQUEST == "false" ]];
then then
node ./scripts/check-env/check-ps-env.js --host "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" || exit 1; $RUN_CHECK
./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e "$E2E_EMAIL" --folder process-services --skip-lint --use-dist -b || exit 1; $RUN_E2E --folder $CONTEXT_ENV
else if [[ $AFFECTED_E2E = "e2e/$CONTEXT_ENV" ]];
then
HEAD_SHA_BRANCH="$(git merge-base origin/$TRAVIS_BRANCH HEAD)"
LIST_SPECS="$(git diff --name-only $HEAD_SHA_BRANCH HEAD | grep "^e2e/$CONTEXT_ENV" | paste -sd , -)"
if [[ $LIST_SPECS != "" ]];
then
echo "Run $CONTEXT_ENV e2e based on the sha $HEAD_SHA_BRANCH with the specs: "$LIST_SPECS
$RUN_CHECK
$RUN_E2E --specs "$LIST_SPECS"
fi
fi
fi; fi;

View File

@ -4,10 +4,27 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR/../../../ cd $DIR/../../../
AFFECTED_E2E="$(./scripts/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e")"; CONTEXT_ENV="search"
./scripts/check-branch-updated.sh -b $TRAVIS_BRANCH || exit 1;
AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)"; AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)";
if [[ $AFFECTED_LIBS =~ "content-services$" || $AFFECTED_E2E = "e2e" || $TRAVIS_PULL_REQUEST == "false" ]]; AFFECTED_E2E="$(./scripts/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e/$CONTEXT_ENV")";
RUN_CHECK=$(echo 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 -save -b )
if [[ $AFFECTED_LIBS =~ "content-services$" || $TRAVIS_PULL_REQUEST == "false" ]];
then then
node ./scripts/check-env/check-cs-env.js --host "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" || exit 1; $RUN_CHECK
./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e "$E2E_EMAIL" --folder search --skip-lint --use-dist -save -b || exit 1; $RUN_E2E --folder $CONTEXT_ENV
else if [[ $AFFECTED_E2E = "e2e/$CONTEXT_ENV" ]];
then
HEAD_SHA_BRANCH="$(git merge-base origin/$TRAVIS_BRANCH HEAD)"
LIST_SPECS="$(git diff --name-only $HEAD_SHA_BRANCH HEAD | grep "^e2e/$CONTEXT_ENV" | paste -sd , -)"
if [[ $LIST_SPECS != "" ]];
then
echo "Run $CONTEXT_ENV e2e based on the sha $HEAD_SHA_BRANCH with the specs: "$LIST_SPECS
$RUN_CHECK
$RUN_E2E --specs "$LIST_SPECS"
fi
fi
fi; fi;