Skip to content

Automated test cases for Topcoder Work Manager - E2E Test Automation - Part 1 #1223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions test-automation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Work Manager App - E2E Tests

#### Software Required

* Nodejs v15.4.0
* Chrome Browser

#### Installation

- Install Dependencies using command
`npm install`

- To run tests

`cd test-automation`

`npm run test`

- Test results are generated in `test-results/` folder

```
HTML report - TestResult.html
Junit report - junitresults-WorkManagerCreateChallengeTests.xml and junitresults-WorkMangerDashboardPageTests.xml
```

- To view junit reports into html, install xunit-viewer
`npm i -g xunit-viewer`

- HTML report from Junit reports can be generated using this command
`xunit-viewer --results=test-results/ --output=./result.html`

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

#### Test Data:

- Test data are located in `/test-data/test-data.json` file.

#### Configuration details:

- `config.json` holds the data level configuration, like user credentials etc
- `conf.ts` holds the application configuration, like jasmine reporters to be configured, specs to be run etc.
79 changes: 79 additions & 0 deletions test-automation/conf.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import reporters = require('jasmine-reporters');
import HtmlReporter = require('protractor-beautiful-reporter');
import { BrowserHelper } from 'topcoder-testing-lib';

declare global {
namespace NodeJS {
interface IGlobal {
document: Document;
window: Window;
navigator: Navigator;
forgotPasswordMailListener: any;
registrationMailListener: any;
}
}
}

exports.config = {
setupFilesAfterEnv: ['./jest.setup.js'],

// Capabilities to be passed to the webdriver instance.
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: [
'--headless',
'--disable-gpu',
'--no-sandbox',
'--window-size=1325x744',
'disable-infobars'
],
'excludeSwitches': ['enable-automation'],
prefs: {
'credentials_enable_service': false,
'profile': {
'password_manager_enabled': false
}
}
},
},

directConnect: true,

// Framework to use. Jasmine is recommended.
framework: 'jasmine2',

specs: [
'../temp/test-suites/dashboard-flow/dashboard.spec.js',
'../temp/test-suites/create-challenge-flow/create-challenge.spec.js',
],

// Options to be passed to Jasmine.
jasmineNodeOpts: {
defaultTimeoutInterval: 1200000, // 20 minutes
isVerbose: true,
showColors: true,
},

onPrepare: () => {
BrowserHelper.maximize();
const junitReporter = new reporters.JUnitXmlReporter({
consolidateAll: false,
savePath: 'test-results',
});
jasmine.getEnv().addReporter(junitReporter);
jasmine.getEnv().addReporter(
new HtmlReporter({
baseDirectory: 'test-results',
docName: 'TestResult.html', // Change html report file name
docTitle: 'Test Automation Execution Report', // Add title for the html report
gatherBrowserLogs: true, // Store Browser logs
jsonsSubfolder: 'jsons', // JSONs Subfolder
preserveDirectory: false, // Preserve base directory
screenshotsSubfolder: 'screenshots',
takeScreenShotsForSkippedSpecs: true, // Screenshots for skipped test cases
takeScreenShotsOnlyForFailedSpecs: true, // Screenshots only for failed test cases
}).getJasmine2Reporter()
);
},
};
19 changes: 19 additions & 0 deletions test-automation/config/app-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"Timeout": {
"FieldVisibility": 15000,
"ElementVisibility": 15000,
"ElementInvisibility": 15000,
"ElementPresence": 15000,
"ElementClickable": 15000,
"PageLoad": 300000,
"ActiveChallengeTimeout": 300000
},

"LoggerErrors": {
"ElementVisibility": "Element did not display within timeout",
"ElementInvisibility": "Element did not become invisible within timeout",
"ElementPresence": "Element was not present within timeout",
"ElementClickable": "Element was not clickable within timeout",
"PageLoad": "Page did not load within timeout"
}
}
15 changes: 15 additions & 0 deletions test-automation/config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"copilotRole": {
"email": "[email protected]",
"password": "appirio123",
"handle": "TCConnCopilot"
},
"copilotManagerRole": {
"email": "[email protected]",
"password": "appirio123",
"handle": "TCConCopilotMgr"
},
"givenUrl": "https://challenges.topcoder-dev.com/",
"challengeUrl": "https://challenges.topcoder-dev.com/projects/16573/challenges",
"logoutUrl": "https://accounts-auth0.topcoder-dev.com/?logout=true&retUrl=https://connect.topcoder-dev.com",
}
4 changes: 4 additions & 0 deletions test-automation/logger/logger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { createLogger, transports } from "winston";
export const logger = createLogger({
transports: [new transports.Console()]
});
Loading