Skip to content

Commit

Permalink
support DEV/PROD configs for Smoke Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
maxceem committed Nov 24, 2021
1 parent 55712aa commit f54f9cc
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Expand Up @@ -115,7 +115,7 @@ smoke_testing: &smoke_testing
command: |
source awsenvconf
source buildenvvar
./connect-automation/smoketest.sh
./connect-automation/smoketest.sh connect-automation-config-${LOGICAL_ENV}.json $LOGICAL_ENV
- store_artifacts:
path: ./connect-automation/test-results

Expand Down Expand Up @@ -195,7 +195,7 @@ workflows:
- build-dev
filters: &filters-dev
branches:
only: ['dev', 'feature/milestone-customer-approval']
only: ['dev', 'feature/milestone-customer-approval', 'feature/test-automation-envs']

- deployTest01:
context : org-global
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -12,3 +12,5 @@ npm-debug.log
# e2e test case
connect-automation/temp
connect-automation/test-results
# avoid accidental pushing of the production config to the repository
connect-automation/config/connect-automation-config-prod.json
32 changes: 27 additions & 5 deletions connect-automation/README.md
Expand Up @@ -7,12 +7,20 @@ Chrome Browser

#### Installation:

- `cd connect-automation`

- Installs
`npm install`

- To run tests
`cd connect-automation`
`npm run test`
- To run Tests locally
`npm run test:local`

- To run Tests agains production environment
`npm run test:prod`

- To run Tests agains dev environment
`npm run test:dev`


- Test results are generated in test-results/ folder

Expand All @@ -29,9 +37,23 @@ Junit report - junitresults-TopcoderLoginPageTests.xml and junitresults-Topcoder

As of now, the tests are running in headless mode. To view the actual chrom browser running the tests, you can remove `--headless` option from `chromeOptions.args` in `config.ts`

#### Test Datas:
#### Test Data and Config

- Test data are located in `/test-data/test-data.json` file.
- All the test data which doesn't depend on the environment should be placed in `/test-data/test-data.json` file.
- All the test data which dose depend on the environment should be placed inside a `config/connect-automation-config-{ENV}.json` file:
- ⚠️ Don't push production config `config/connect-automation-config-prod.json` to the repository for security reasons

##### Test Data and Config for CircleCI

When running test automation using CircleCI it would use config files which should be placed inside Topcoder S3:

- DEV `s3://tc-platform-dev/securitymanager/connect-automation-config-dev.json`
- PROD `s3://tc-platform-prod/securitymanager/connect-automation-config-prod.json`

Production config should be filled with production data like production user login/password, production project id with billing account as so on. For reference you may use file [connect-automation-config-dev.json](config/connect-automation-config-dev.json).

- Test datas are located in /test-data/test-data.json file
These configs should be updated by someone from Topcoder.

#### Configuration details:

Expand Down
28 changes: 28 additions & 0 deletions connect-automation/config/connect-automation-config-dev.json
@@ -0,0 +1,28 @@
{
"env": "dev",
"username": "mailmemakar402",
"password": "P@ssw0rd",
"customerRole": {
"email": "topcoderconnect+Customer@gmail.com",
"password": "appirio123"
},
"copilotRole": {
"email": "topcoderconnect+Copilot@gmail.com",
"password": "appirio123"
},
"copilotManagerRole": {
"email": "topcoderconnect+CopilotManager@gmail.com",
"password": "appirio123"
},
"homePageUrl": "https://connect.topcoder-dev.com/",
"loginUrl": "https://auth.topcoder-dev.com",
"redirectLoginUrl": "https://accounts-auth0.topcoder-dev.com/?regSource=tcBusiness&retUrl=https://connect.topcoder-dev.com",
"logoutUrl": "https://accounts-auth0.topcoder-dev.com/?logout=true&retUrl=https://connect.topcoder-dev.com",
"myProfileUrl": "https://connect.topcoder-dev.com/settings/profile",
"notificationSettingsUrl": "https://connect.topcoder-dev.com/settings/notifications",
"accountAndSecurityUrl": "https://connect.topcoder-dev.com/settings/account",
"notificationsUrl": "https://connect.topcoder-dev.com/notifications",
"allProjectsUrl": "https://connect.topcoder-dev.com/projects",
"expiredProjectUrl": "https://connect.topcoder-dev.com/projects/17236",
"platformUrl": "https://platform.topcoder-dev.com/taas/myteams"
}
28 changes: 28 additions & 0 deletions connect-automation/config/connect-automation-config-local.json
@@ -0,0 +1,28 @@
{
"env": "dev",
"username": "mailmemakar402",
"password": "P@ssw0rd",
"customerRole": {
"email": "topcoderconnect+Customer@gmail.com",
"password": "appirio123"
},
"copilotRole": {
"email": "topcoderconnect+Copilot@gmail.com",
"password": "appirio123"
},
"copilotManagerRole": {
"email": "topcoderconnect+CopilotManager@gmail.com",
"password": "appirio123"
},
"homePageUrl": "https://connect.topcoder-dev.com/",
"loginUrl": "https://auth.topcoder-dev.com",
"redirectLoginUrl": "https://accounts-auth0.topcoder-dev.com/?regSource=tcBusiness&retUrl=https://connect.topcoder-dev.com",
"logoutUrl": "https://accounts-auth0.topcoder-dev.com/?logout=true&retUrl=https://connect.topcoder-dev.com",
"myProfileUrl": "https://connect.topcoder-dev.com/settings/profile",
"notificationSettingsUrl": "https://connect.topcoder-dev.com/settings/notifications",
"accountAndSecurityUrl": "https://connect.topcoder-dev.com/settings/account",
"notificationsUrl": "https://connect.topcoder-dev.com/notifications",
"allProjectsUrl": "https://connect.topcoder-dev.com/projects",
"expiredProjectUrl": "https://connect.topcoder-dev.com/projects/17236",
"platformUrl": "https://platform.topcoder-dev.com/taas/myteams"
}
5 changes: 4 additions & 1 deletion connect-automation/package.json
Expand Up @@ -35,7 +35,10 @@
"webdriver-update": "node node_modules/protractor/bin/webdriver-manager update",
"pretest": "npm run webdriver-update && npm run clean && npm run tsc",
"test": "protractor temp/conf.js",
"lint": "npx tslint --project . --fix"
"lint": "npx tslint --project . --fix",
"test:local": "cp config/connect-automation-config-local.json config/config.json && npm run pretest && protractor temp/conf.js",
"test:dev": "cp config/connect-automation-config-dev.json config/config.json && npm run pretest && protractor temp/conf.js",
"test:prod": "cp config/connect-automation-config-prod.json config/config.json && npm run pretest && protractor temp/conf.js"
},
"keywords": [
"protractor",
Expand Down
27 changes: 24 additions & 3 deletions connect-automation/smoketest.sh
@@ -1,7 +1,28 @@
#!/bin/bash

log()
{
echo "`date +'%D %T'` : $1"
}
track_error()
{
if [ $1 != "0" ]; then
log "$2 exited with error code $1"
log "completed execution IN ERROR at `date`"
exit $1
fi

}

APPCONFIGFILENAME=$1
LOGICAL_PATH=$2

cd connect-automation
aws s3 cp s3://tc-platform-${LOGICAL_PATH}/securitymanager/${APPCONFIGFILENAME} .
track_error $? "Environment setting"
cp ${APPCONFIGFILENAME} config/config.json

docker build -t conn-smoke:latest .
docker run --name conn-smoke --shm-size=2g conn-smoke:latest ./testrun.sh -d -p 4444:4444
docker cp conn-smoke:./connect-automation/test-results .
docker build -t comm-smoke:latest .
docker run --name comm-smoke --shm-size=2g comm-smoke:latest ./testrun.sh -d -p 4444:4444
docker cp comm-smoke:./connect-automation/test-results .
track_error $? "Test case Failed"

0 comments on commit f54f9cc

Please sign in to comment.