Skip to content

Commit 6376c2d

Browse files
author
vikasrohit
authored
Merge pull request #4406 from appirio-tech/dev
Prod Release - 2.22.0 - Copilot Feedback
2 parents 3431a0f + 41c97d3 commit 6376c2d

File tree

62 files changed

+10562
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+10562
-6
lines changed

.circleci/config.yml

+75-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,39 @@
1-
version: 2
1+
version: 2.1
2+
parameters:
3+
run_basedeployment:
4+
default: true
5+
type: boolean
6+
run_smoketesting:
7+
default: false
8+
type: boolean
9+
210
defaults: &defaults
311
docker:
412
- image: node:14
13+
514
deploy_defaults: &deploy_defaults
615
docker:
716
- image: cibuilds/aws
17+
18+
test_defaults: &test_defaults
19+
docker:
20+
- image: docker:17.11.0-ce-git
21+
822
install_dependency: &install_dependency
923
name: Installation of build and deployment dependencies.
1024
command: |
1125
apt update
1226
apt install jq -y
1327
apt install python-dev python-pip -y
1428
pip install awscli --upgrade
29+
install_test_dependency: &install_test_dependency
30+
name: Installation of build and deployment dependencies.
31+
command: |
32+
apk update
33+
apk add --no-cache bash openssl curl
34+
apk upgrade
35+
apk add --no-cache jq py-pip sudo
36+
sudo pip install awscli --upgrade
1537
install_deploysuite: &install_deploysuite
1638
name: Installation of install_deploysuite.
1739
command: |
@@ -66,6 +88,36 @@ deploy_steps: &deploy_steps
6688
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-connectapp-deployvar
6789
source buildenvvar
6890
./master_deploy.sh -d CFRONT -e $DEPLOY_ENV -c $ENABLE_CACHE
91+
curl --request POST \
92+
--url https://circleci.com/api/v2/project/github/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pipeline \
93+
--header "Circle-Token: ${CIRCLE_TOKEN}" \
94+
--header 'content-type: application/json' \
95+
--data '{"branch":"'"$CIRCLE_BRANCH"'","parameters":{"run_smoketesting":true, "run_basedeployment": false}}'
96+
97+
98+
# Automated Smoke Testing
99+
smoke_testing: &smoke_testing
100+
# Initialization.
101+
- checkout
102+
- setup_remote_docker
103+
- run: *install_test_dependency
104+
- run: *install_deploysuite
105+
# Restoration of node_modules from cache.
106+
- restore_cache: *restore_cache_settings_for_build
107+
- run:
108+
name: "configuring environment"
109+
command: |
110+
./awsconfiguration.sh $DEPLOY_ENV
111+
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-connectapp-buildvar
112+
- run:
113+
name: "Run automation"
114+
no_output_timeout: 20m
115+
command: |
116+
source awsenvconf
117+
source buildenvvar
118+
./connect-automation/smoketest.sh
119+
- store_artifacts:
120+
path: ./connect-automation/test-results
69121

70122
jobs:
71123
build-dev:
@@ -107,9 +159,17 @@ jobs:
107159
ENABLE_CACHE: true
108160
steps: *deploy_steps
109161

162+
smoke-testing-dev:
163+
<<: *test_defaults
164+
environment:
165+
DEPLOY_ENV: "DEV"
166+
LOGICAL_ENV: "dev"
167+
steps: *smoke_testing
168+
110169
workflows:
111170
version: 2
112171
build:
172+
when: << pipeline.parameters.run_basedeployment >>
113173
jobs:
114174
- build-dev:
115175
context : org-global
@@ -126,9 +186,9 @@ workflows:
126186
context : org-global
127187
requires:
128188
- build-dev
129-
filters:
189+
filters: &filters-dev
130190
branches:
131-
only: ['dev', 'feature/billing_account_protection']
191+
only: ['dev', 'feature/copilot-feedback']
132192

133193
- deployTest01:
134194
context : org-global
@@ -145,3 +205,15 @@ workflows:
145205
filters:
146206
branches:
147207
only: master
208+
209+
Smoke Testing:
210+
when: << pipeline.parameters.run_smoketesting >>
211+
jobs:
212+
- Hold [Smoke-Testing]:
213+
type: approval
214+
- smoke-testing-dev:
215+
context : org-global
216+
requires:
217+
- Hold [Smoke-Testing]
218+
filters:
219+
<<: *filters-dev

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ npm-debug.log
88
.history
99
.build-info
1010
.idea
11+
12+
# e2e test case
13+
connect-automation/temp
14+
connect-automation/test-results

config/constants/dev.js

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ module.exports = {
3232

3333
ACCOUNTS_APP_URL : 'https://accounts-auth0.topcoder-dev.com',
3434
ACCOUNTS_APP_CONNECTOR_URL : 'https://accounts-auth0.topcoder-dev.com',
35+
TYPEFORM_URL : 'https://topcoder.typeform.com/to/vgqiBXdk',
3536

3637
FILE_PICKER_API_KEY: process.env.FILE_PICKER_API_KEY_DEV,
3738
FILE_PICKER_SUBMISSION_CONTAINER_NAME: 'submission-staging-dev',

config/constants/master.js

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ module.exports = {
3333

3434
ACCOUNTS_APP_URL : 'https://accounts-auth0.topcoder.com',
3535
ACCOUNTS_APP_CONNECTOR_URL : 'https://accounts-auth0.topcoder.com',
36+
TYPEFORM_URL : 'https://topcoder.typeform.com/to/vgqiBXdk',
3637

3738
FILE_PICKER_API_KEY: process.env.FILE_PICKER_API_KEY_PROD,
3839
FILE_PICKER_SUBMISSION_CONTAINER_NAME: 'submission-staging-prod',

config/constants/qa.js

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ module.exports = {
3232

3333
ACCOUNTS_APP_URL : 'https://accounts.topcoder-qa.com/#!/member',
3434
ACCOUNTS_APP_CONNECTOR_URL : 'https://accounts.topcoder-qa.com/connector.html',
35+
TYPEFORM_URL : 'https://topcoder.typeform.com/to/vgqiBXdk',
3536

3637
FILE_PICKER_API_KEY: process.env.FILE_PICKER_API_KEY_QA,
3738
FILE_PICKER_SUBMISSION_CONTAINER_NAME: 'submission-staging-qa',

connect-automation/Dockerfile

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM node:10.17.0-stretch
2+
RUN apt update
3+
RUN apt install sudo
4+
RUN sudo apt-get update; sudo apt-get install -y openjdk-8-jre openjdk-8-jre-headless openjdk-8-jdk openjdk-8-jdk-headless;
5+
RUN curl --silent --show-error --location --fail --retry 3 --output /tmp/google-chrome-stable_current_amd64.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
6+
&& (sudo dpkg -i /tmp/google-chrome-stable_current_amd64.deb || sudo apt-get -fy install) \
7+
&& rm -rf /tmp/google-chrome-stable_current_amd64.deb \
8+
&& sudo sed -i 's|HERE/chrome"|HERE/chrome" --disable-setuid-sandbox --no-sandbox|g' \
9+
"/opt/google/chrome/google-chrome" \
10+
&& google-chrome --version
11+
RUN export CHROMEDRIVER_RELEASE=$(curl --location --fail --retry 3 http://chromedriver.storage.googleapis.com/LATEST_RELEASE) \
12+
&& curl --silent --show-error --location --fail --retry 3 --output /tmp/chromedriver_linux64.zip "http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_RELEASE/chromedriver_linux64.zip" \
13+
&& cd /tmp \
14+
&& unzip chromedriver_linux64.zip \
15+
&& rm -rf chromedriver_linux64.zip \
16+
&& sudo mv chromedriver /usr/local/bin/chromedriver \
17+
&& sudo chmod +x /usr/local/bin/chromedriver \
18+
&& chromedriver --version
19+
RUN sudo apt-get install -y libgconf-2-4
20+
RUN sudo apt-get install -y xvfb
21+
RUN sudo apt-get install -y jq
22+
ENV DISPLAY :99
23+
RUN printf '#!/bin/sh\nXvfb :99 -screen 0 1280x1024x24 &\nexec "$@"\n' > /tmp/entrypoint \
24+
&& chmod +x /tmp/entrypoint \
25+
&& sudo mv /tmp/entrypoint /docker-entrypoint.sh
26+
27+
COPY . /connect-automation
28+
WORKDIR /connect-automation
29+
RUN npm install
30+
RUN ./node_modules/.bin/webdriver-manager update --versions.chrome=="$(google-chrome -version)"
31+
ENTRYPOINT ["/docker-entrypoint.sh"]
32+
CMD ["/bin/sh"]

connect-automation/README.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Topcoder Connect App - E2E Tests
2+
3+
#### Software Required
4+
5+
Nodejs v8.11.4+
6+
Chrome Browser
7+
8+
#### Installation:
9+
10+
- Installs
11+
`npm install`
12+
13+
- To run tests
14+
`cd connect-automation`
15+
`npm run test`
16+
17+
- Test results are generated in test-results/ folder
18+
19+
```
20+
HTML report - TestResult.html
21+
Junit report - junitresults-TopcoderLoginPageTests.xml and junitresults-TopcoderRegistrationPageTests.xml
22+
```
23+
24+
- To view junit reports into html, install xunit-viewer
25+
`npm i -g xunit-viewer`
26+
27+
- HTML report from Junit reports can be generated using this command
28+
`xunit-viewer --results=test-results/ --output=/home/Documents/`
29+
30+
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`
31+
32+
#### Test Datas:
33+
34+
- Test datas are located in /test-data/test-data.json file
35+
36+
#### Configuration details:
37+
38+
- config.json holds the data level configuration, like user credentials etc
39+
- conf.ts holds the application configuration, like jasmine reporters to be configured, specs to be run etc.

connect-automation/conf.ts

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import reporters = require('jasmine-reporters');
2+
import HtmlReporter = require('protractor-beautiful-reporter');
3+
import { BrowserHelper } from 'topcoder-testing-lib';
4+
5+
declare global {
6+
namespace NodeJS {
7+
interface IGlobal {
8+
document: Document;
9+
window: Window;
10+
navigator: Navigator;
11+
forgotPasswordMailListener: any;
12+
registrationMailListener: any;
13+
}
14+
}
15+
}
16+
17+
exports.config = {
18+
directConnect: true,
19+
20+
// Capabilities to be passed to the webdriver instance.
21+
capabilities: {
22+
browserName: 'chrome',
23+
chromeOptions: {
24+
args: [
25+
'--headless',
26+
'--disable-gpu',
27+
'--no-sandbox',
28+
'--window-size=1325x744',
29+
],
30+
},
31+
},
32+
33+
// Framework to use. Jasmine is recommended.
34+
framework: 'jasmine2',
35+
36+
specs: [
37+
'../temp/test-suites/profile-update/my-profile.spec.js',
38+
'../temp/test-suites/profile-update/left-menu.spec.js',
39+
'../temp/test-suites/profile-update/user-profile-menu.spec.js',
40+
'../temp/test-suites/profile-update/footer-menu.spec.js',
41+
'../temp/test-suites/project-creation-flow/create-project.spec.js',
42+
'../temp/test-suites/project-creation-flow/invite-copilot.spec.js',
43+
'../temp/test-suites/project-creation-flow/projects.spec.js',
44+
'../temp/test-suites/phase-creation-flow/create-new-phase.spec.js',
45+
'../temp/test-suites/project-settings-flow/project-settings.spec.js'
46+
],
47+
48+
// Options to be passed to Jasmine.
49+
jasmineNodeOpts: {
50+
defaultTimeoutInterval: 1200000, // 20 minutes
51+
isVerbose: true,
52+
showColors: true,
53+
},
54+
55+
onPrepare: () => {
56+
BrowserHelper.maximize();
57+
BrowserHelper.implicitlyWait(5000);
58+
const junitReporter = new reporters.JUnitXmlReporter({
59+
consolidateAll: false,
60+
savePath: 'test-results',
61+
});
62+
jasmine.getEnv().addReporter(junitReporter);
63+
jasmine.getEnv().addReporter(
64+
new HtmlReporter({
65+
baseDirectory: 'test-results',
66+
docName: 'TestResult.html', // Change html report file name
67+
docTitle: 'Test Automation Execution Report', // Add title for the html report
68+
gatherBrowserLogs: true, // Store Browser logs
69+
jsonsSubfolder: 'jsons', // JSONs Subfolder
70+
preserveDirectory: false, // Preserve base directory
71+
screenshotsSubfolder: 'screenshots',
72+
takeScreenShotsForSkippedSpecs: true, // Screenshots for skipped test cases
73+
takeScreenShotsOnlyForFailedSpecs: true, // Screenshots only for failed test cases
74+
}).getJasmine2Reporter()
75+
);
76+
},
77+
};
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"Timeout": {
3+
"FieldVisibility": 15000,
4+
"ElementVisibility": 15000,
5+
"ElementInvisibility": 15000,
6+
"ElementPresence": 15000,
7+
"ElementClickable": 15000,
8+
"PageLoad": 300000
9+
},
10+
11+
"LoggerErrors": {
12+
"ElementVisibilty": "Element did not display within timeout",
13+
"ElementInvisibilty": "Element did not become invisible within timeout",
14+
"ElementPresence": "Element was not present within timeout",
15+
"ElementClickable": "Element was not clickable within timeout",
16+
"PageLoad": "Page did not load within timeout"
17+
}
18+
}

connect-automation/config/config.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"env": "dev",
3+
"username": "mailmemakar402",
4+
"password": "P@ssw0rd",
5+
"customerRole": {
6+
"email": "[email protected]",
7+
"password": "appirio123"
8+
},
9+
"copilotRole": {
10+
"email": "[email protected]",
11+
"password": "appirio123"
12+
},
13+
"copilotManagerRole": {
14+
"email": "[email protected]",
15+
"password": "appirio123"
16+
},
17+
"homePageUrl": "https://connect.topcoder-dev.com/",
18+
"loginUrl": "https://auth.topcoder-dev.com",
19+
"redirectLoginUrl": "https://accounts-auth0.topcoder-dev.com/?regSource=tcBusiness&retUrl=https://connect.topcoder-dev.com",
20+
"logoutUrl": "https://accounts-auth0.topcoder-dev.com/?logout=true&retUrl=https://connect.topcoder-dev.com",
21+
"myProfileUrl": "https://connect.topcoder-dev.com/settings/profile",
22+
"notificationSettingsUrl": "https://connect.topcoder-dev.com/settings/notifications",
23+
"accountAndSecurityUrl": "https://connect.topcoder-dev.com/settings/account",
24+
"notificationsUrl": "https://connect.topcoder-dev.com/notifications",
25+
"allProjectsUrl": "https://connect.topcoder-dev.com/projects",
26+
"givenProjectUrl": "https://connect.topcoder-dev.com/projects/18013",
27+
"expiredProjectUrl": "https://connect.topcoder-dev.com/projects/17236"
28+
}

connect-automation/logger/logger.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { createLogger, transports } from "winston";
2+
export const logger = createLogger({
3+
transports: [new transports.Console()]
4+
});

0 commit comments

Comments
 (0)