Skip to content

Commit 71eaa4a

Browse files
authored
Initial script for automation script. (#4386)
* Initial script for automation script. * Remove unnecessary file * update git ignore file
1 parent f427ca4 commit 71eaa4a

Some content is hidden

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

45 files changed

+9475
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
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

connect-automation/README.md

Lines changed: 39 additions & 0 deletions
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-app-e2e-test`
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

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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+
],
46+
47+
// Options to be passed to Jasmine.
48+
jasmineNodeOpts: {
49+
defaultTimeoutInterval: 1200000, // 20 minutes
50+
isVerbose: true,
51+
showColors: true,
52+
},
53+
54+
onPrepare: () => {
55+
BrowserHelper.maximize();
56+
BrowserHelper.implicitlyWait(5000);
57+
const junitReporter = new reporters.JUnitXmlReporter({
58+
consolidateAll: false,
59+
savePath: 'test-results',
60+
});
61+
jasmine.getEnv().addReporter(junitReporter);
62+
jasmine.getEnv().addReporter(
63+
new HtmlReporter({
64+
baseDirectory: 'test-results',
65+
docName: 'TestResult.html', // Change html report file name
66+
docTitle: 'Test Automation Execution Report', // Add title for the html report
67+
gatherBrowserLogs: true, // Store Browser logs
68+
jsonsSubfolder: 'jsons', // JSONs Subfolder
69+
preserveDirectory: false, // Preserve base directory
70+
screenshotsSubfolder: 'screenshots',
71+
takeScreenShotsForSkippedSpecs: true, // Screenshots for skipped test cases
72+
takeScreenShotsOnlyForFailedSpecs: true, // Screenshots only for failed test cases
73+
}).getJasmine2Reporter()
74+
);
75+
},
76+
};
Lines changed: 18 additions & 0 deletions
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+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"env": "dev",
3+
"username": "mailmemakar402",
4+
"password": "P@ssw0rd",
5+
"customerRole": {
6+
"email": "topcoderconnect+Customer@gmail.com",
7+
"password": "appirio123"
8+
},
9+
"copilotRole": {
10+
"email": "topcoderconnect+Copilot@gmail.com",
11+
"password": "appirio123"
12+
},
13+
"copilotManagerRole": {
14+
"email": "topcoderconnect+CopilotManager@gmail.com",
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+
}
Lines changed: 4 additions & 0 deletions
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)