Skip to content

Commit 6cc7558

Browse files
Merge pull request #79 from aquality-automation/develop
Develop
2 parents 019134a + d807a04 commit 6cc7558

File tree

225 files changed

+7388
-4355
lines changed

Some content is hidden

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

225 files changed

+7388
-4355
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
command: |
5050
export NVM_DIR="/opt/circleci/.nvm"
5151
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
52-
export TESTRUNID="$(npm run aquality:start -- ${TOKEN} All Docker_Chrome build_${CIRCLE_BUILD_NUM})"
52+
export TESTRUNID="$(npm run aquality:start -- ${TOKEN} All Docker_Chrome build_${CIRCLE_BUILD_NUM}_${CIRCLE_BRANCH})"
5353
export TESTRUNID=${TESTRUNID##*$'\n'}
5454
echo $TESTRUNID
5555
echo "export TESTRUNID=$TESTRUNID" >> $BASH_ENV

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# CHANGELOG
22

3+
## 0.3.5 (2020-02-15)
4+
5+
Features:
6+
- Exclude Debug testruns from graph on test runs list -> [View Issue](https://github.com/aquality-automation/aquality-tracking/issues/46)
7+
- Import: Mark import as debug -> [View Issue](https://github.com/aquality-automation/aquality-tracking/issues/47)
8+
- Milestone View: Add functionality that displays the latest results of the tests from the test runs -> [View Issue](https://github.com/aquality-automation/aquality-tracking/issues/11)
9+
- List of predefined Resolutions -> [View Issue](https://github.com/aquality-automation/aquality-tracking/issues/26)
10+
- Add JUnit 5 support -> [View Issue](https://github.com/aquality-automation/aquality-tracking/issues/33)
11+
- Add posibility to Finish Test Run Manually -> [View Issue](https://github.com/aquality-automation/aquality-tracking/issues/21)
12+
13+
Bugfixes:
14+
- Cannot remove milestone from TestRun -> [View Issue](https://github.com/aquality-automation/aquality-tracking/issues/50)
15+
- Refactored Permissions service
16+
17+
Bugfixes:
18+
- Test Runs: Filter by Start Time date From doesn't work -> [View Issue](https://github.com/aquality-automation/aquality-tracking/issues/38)
19+
320
## 0.3.4 (2019-12-10)
421

522
Features:

e2e/api/editor.api.ts

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import { TestSuite } from '../../src/app/shared/models/testSuite';
2+
import { Test } from '../../src/app/shared/models/test';
3+
import { Step, StepToTest } from '../../src/app/shared/models/steps';
4+
import { TestRun } from '../../src/app/shared/models/testRun';
5+
import { Milestone } from '../../src/app/shared/models/milestone';
6+
import { sendPost, sendGet, sendDelete } from '../utils/aqualityTrackingAPI.util';
7+
import { TestResult } from '../../src/app/shared/models/test-result';
8+
import { Project } from '../../src/app/shared/models/project';
9+
10+
enum Endpoints {
11+
suite = '/suite',
12+
test = '/test',
13+
steps = '/steps',
14+
testrun = '/testrun',
15+
milestone = '/milestone',
16+
testresult = '/testresult',
17+
testSteps = '/test/steps',
18+
testToSuite = '/testToSuite'
19+
}
20+
21+
export class EditorAPI {
22+
project: Project;
23+
token: string;
24+
25+
constructor(project: Project, token: string) {
26+
this.project = project;
27+
this.token = token;
28+
}
29+
30+
public async createSuite(suite: TestSuite): Promise<TestSuite> {
31+
suite.project_id = this.project.id;
32+
return sendPost(Endpoints.suite, undefined, suite, this.token, this.project.id);
33+
}
34+
35+
public async createTest(test: Test): Promise<Test> {
36+
test.project_id = this.project.id;
37+
return sendPost(Endpoints.test, undefined, test, this.token, this.project.id);
38+
}
39+
40+
public async createStep(step: Step): Promise<Step> {
41+
step.project_id = this.project.id;
42+
return sendPost(Endpoints.steps, undefined, step, this.token, this.project.id);
43+
}
44+
45+
public async createTestRun(testrun: TestRun) {
46+
testrun.project_id = this.project.id;
47+
return sendPost(Endpoints.testrun, undefined, testrun, this.token, this.project.id);
48+
}
49+
50+
public async createMilestone(milestone: Milestone) {
51+
milestone.project_id = this.project.id;
52+
return sendPost(Endpoints.milestone, undefined, milestone, this.token, this.project.id);
53+
}
54+
55+
public async createResult(testResult: TestResult): Promise<TestResult> {
56+
return sendPost(Endpoints.testresult, undefined, testResult, this.token, this.project.id);
57+
}
58+
59+
public async addStepToTest(stepToTest: StepToTest): Promise<Step> {
60+
stepToTest.project_id = this.project.id;
61+
return sendPost(Endpoints.testSteps, undefined, stepToTest, this.token, this.project.id);
62+
}
63+
64+
public async addTestToSuite(testId: number, suiteId: number) {
65+
return sendPost(Endpoints.testToSuite, { testId, suiteId, projectId: this.project.id }, {}, this.token, this.project.id);
66+
}
67+
68+
public async getSuites(testSuite: TestSuite): Promise<TestSuite[]> {
69+
return sendGet(Endpoints.suite, testSuite, this.token, this.project.id);
70+
}
71+
72+
public async getTests(test: Test): Promise<Test[]> {
73+
return sendGet(Endpoints.test, test, this.token, this.project.id);
74+
}
75+
76+
public async getResults(testResult: TestResult): Promise<TestResult[]> {
77+
return sendGet(Endpoints.testresult, testResult, this.token, this.project.id);
78+
}
79+
80+
public async getTestRuns(testrun: TestRun): Promise<TestRun[]> {
81+
return sendGet(Endpoints.testrun, testrun, this.token, this.project.id);
82+
}
83+
84+
public async removeTestRun(testRunId: number) {
85+
return sendDelete(Endpoints.testrun, { id: testRunId, projectId: this.project.id}, null, this.token, this.project.id);
86+
}
87+
}

e2e/api/importer.api.ts

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
import { sendPostFiles } from '../utils/aqualityTrackingAPI.util';
2+
import { logger } from '../utils/log.util';
3+
import { Project } from '../../src/app/shared/models/project';
4+
import { EditorAPI } from './editor.api';
5+
import { TestRun } from '../../src/app/shared/models/testRun';
6+
7+
export class ImportParams {
8+
projectId?: number;
9+
format: ImportFormats;
10+
suite: string;
11+
addToLastTestRun: boolean;
12+
testNameKey?: string;
13+
buildName?: string;
14+
}
15+
16+
export enum ImportFormats {
17+
cucumber = 'Cucumber',
18+
msTest = 'MSTest'
19+
}
20+
21+
const CHECK_IMPORTED_DELAY = 2000;
22+
23+
export class Importer {
24+
project: Project;
25+
token: string;
26+
editorAPI: EditorAPI;
27+
28+
constructor(project: Project, token: string) {
29+
this.project = project;
30+
this.token = token;
31+
this.editorAPI = new EditorAPI(this.project, this.token);
32+
}
33+
34+
public async executeImport(importParameters: ImportParams, files: string[], fileNames: string[]): Promise<TestRun[]> {
35+
importParameters.projectId = this.project.id;
36+
const buildNames = fileNames.map(fileName => fileName.split('.').slice(0, -1).join('.'));
37+
const result = await this.doImport(importParameters, files, fileNames);
38+
if (!result) {
39+
throw Error('Import Failed!');
40+
}
41+
42+
return new Promise<TestRun[]>(async (resolve) => {
43+
let imported: TestRun[] = await this.isAllBuildsAreImported(buildNames);
44+
if (imported.length > 0) {
45+
logger.info(`Import was finished Successfully`);
46+
resolve(imported);
47+
}
48+
49+
setTimeout(async () => {
50+
imported = await this.isAllBuildsAreImported(buildNames);
51+
if (imported.length > 0) {
52+
logger.info(`Import was finished Successfully`);
53+
resolve(imported);
54+
}
55+
56+
setTimeout(async () => {
57+
imported = await this.isAllBuildsAreImported(buildNames);
58+
logger.info(`Import was finished Successfully, but testrun was not created yet.`);
59+
resolve(imported);
60+
}, CHECK_IMPORTED_DELAY);
61+
}, CHECK_IMPORTED_DELAY);
62+
});
63+
}
64+
65+
public async executeCucumberImport(suiteName: string, files: object[], fileNames: string[]): Promise<TestRun[]> {
66+
const filesAsStringArray = files.map(file => JSON.stringify(file));
67+
return this.executeImport({
68+
projectId: this.project.id,
69+
suite: suiteName,
70+
format: ImportFormats.cucumber,
71+
addToLastTestRun: false
72+
}, filesAsStringArray, fileNames);
73+
}
74+
75+
public generateBuilds(count: number): { names: any, filenames: string[] } {
76+
const names = {};
77+
const filenames: string[] = [];
78+
79+
for (let i = 0; i < count; i++) {
80+
const name = `build_${i + 1}`;
81+
names[name] = name;
82+
filenames.push(`${name}.json`);
83+
}
84+
85+
return { names, filenames };
86+
}
87+
88+
private async isAllBuildsAreImported(buildNames: string[]): Promise<TestRun[]> {
89+
const testRuns = await this.editorAPI.getTestRuns({ project_id: this.project.id });
90+
let imported = true;
91+
const importedTestRuns: TestRun[] = [];
92+
buildNames.forEach(buildName => {
93+
const importedTestRun = testRuns.find(testRun => testRun.build_name === buildName);
94+
if (!importedTestRun) {
95+
imported = false;
96+
}
97+
importedTestRuns.push(importedTestRun);
98+
});
99+
return imported ? importedTestRuns : [];
100+
}
101+
102+
private async doImport(params: ImportParams, filesAsString: string[], fileNames: string[]): Promise<boolean> {
103+
try {
104+
logger.info(`Start API import with params: ${JSON.stringify(params)}`);
105+
logger.info(`Files count: ${filesAsString.length}`);
106+
logger.info(`File Names count: ${filesAsString.length}`);
107+
await sendPostFiles('/import', params, filesAsString, fileNames, this.token, this.project.id);
108+
return true;
109+
} catch (err) {
110+
logger.error(`Import was failed: ${err.message}`);
111+
return false;
112+
}
113+
}
114+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Test,Test Suite,Result,Resolution,Comment
2+
"Login: should not be able to login with wrong username","Login","Failed",,
3+
"Test Run: Test Run can be created without Milestone","Test Run: Manager","Not Executed",,
4+
"Test Run: Test Run can be created with Milestone","Test Run: Manager","Not Executed",,
5+
"Test Run: Build name should be inherited from create page","Test Run: Manager","Not Executed",,
6+
"Login: should be able to login as admin","Login","Passed",,
7+
"Login: should not be able to login with wrong password","Login","Pending",,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Test,Test Suite,Result,Resolution,Comment
2+
"Login: should not be able to login with wrong username","Login","Failed",,
3+
"Test Run: Test Run can be created with Milestone","Test Run: Viewer","Failed",,
4+
"Login: should be able to login as admin","Login","Passed",,
5+
"Test Run: Test Run can be created without Milestone","Test Run: Viewer","Passed",,
6+
"Test Run: Build name should be inherited from create page","Test Run: Viewer","Passed",,
7+
"Login: should not be able to login with wrong password","Login","Pending",,
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Test,Test Suite,Result,Resolution,Comment
2+
"Login: should not be able to login with wrong username","Login","Failed",,
3+
"Login: should be able to login as admin","Login","Passed",,
4+
"Login: should not be able to login with wrong password","Login","Pending",,
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Test,Test Suite,Result,Resolution,Comment,Finished
2+
"Login: should be able to login as admin","Login","Not Executed",,,"Invalid Date"
3+
"Login: should not be able to login with wrong username","Login","Not Executed",,,"Invalid Date"
4+
"Login: should not be able to login with wrong password","Login","Not Executed",,,"Invalid Date"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Test,Test Suite,Result,Resolution,Comment
2+
"Login: should not be able to login with wrong username","Login","Failed",,
3+
"Test Run: Test Run can be created with Milestone","Test Run: Manager","Failed",,
4+
"Test Run: Test Run can be created with Milestone","Test Run: Viewer","Failed",,
5+
"Login: should be able to login as admin","Login","Passed",,
6+
"Test Run: Test Run can be created without Milestone","Test Run: Manager","Passed",,
7+
"Test Run: Test Run can be created without Milestone","Test Run: Viewer","Passed",,
8+
"Test Run: Build name should be inherited from create page","Test Run: Viewer","Passed",,
9+
"Login: should not be able to login with wrong password","Login","Pending",,
10+
"Test Run: Build name should be inherited from create page","Test Run: Manager","Pending",,
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
[
2+
{
3+
"description": "Test Report",
4+
"keyword": "Feature",
5+
"name": "Login",
6+
"line": 2,
7+
"id": "Test-Report",
8+
"tags": [],
9+
"uri": "features/testdeature.feature",
10+
"elements": [
11+
{
12+
"id": "passed",
13+
"keyword": "Scenario",
14+
"line": 7,
15+
"name": "should be able to login as admin",
16+
"tags": [],
17+
"type": "scenario",
18+
"steps": [
19+
{
20+
"arguments": [],
21+
"keyword": "Given ",
22+
"line": 8,
23+
"name": "passed step",
24+
"match": {
25+
"location": "Projects/nodejs-cucumber-sample-master/node_modules/cucumber/lib/support_code_library_builder/define_helpers.js:135"
26+
},
27+
"result": {
28+
"status": "passed",
29+
"duration": 7033
30+
}
31+
},
32+
{
33+
"arguments": [],
34+
"keyword": "Then ",
35+
"line": 9,
36+
"name": "passed step",
37+
"match": {
38+
"location": "Projects/nodejs-cucumber-sample-master/node_modules/cucumber/lib/support_code_library_builder/define_helpers.js:135"
39+
},
40+
"result": {
41+
"status": "passed",
42+
"duration": 86
43+
}
44+
}
45+
]
46+
}, {
47+
"id": "failed",
48+
"keyword": "Scenario",
49+
"line": 7,
50+
"name": "should not be able to login with wrong username",
51+
"tags": [],
52+
"type": "scenario",
53+
"steps": [
54+
{
55+
"arguments": [],
56+
"keyword": "Given ",
57+
"line": 8,
58+
"name": "passed step",
59+
"match": {
60+
"location": "Projects/nodejs-cucumber-sample-master/node_modules/cucumber/lib/support_code_library_builder/define_helpers.js:135"
61+
},
62+
"result": {
63+
"status": "passed",
64+
"duration": 7033
65+
}
66+
},
67+
{
68+
"arguments": [],
69+
"keyword": "Then ",
70+
"line": 9,
71+
"name": "failed step",
72+
"match": {
73+
"location": "Projects/nodejs-cucumber-sample-master/node_modules/cucumber/lib/support_code_library_builder/define_helpers.js:135"
74+
},
75+
"result": {
76+
"status": "failed",
77+
"duration": 86,
78+
"error_message": "step was failed\n log asdf sadf asdf dsd dd d d d d d dasd asdf [error]\nExpected 1\n[error]"
79+
}
80+
}
81+
]
82+
}, {
83+
"id": "failed",
84+
"keyword": "Scenario",
85+
"line": 7,
86+
"name": "should not be able to login with wrong password",
87+
"tags": [],
88+
"type": "scenario",
89+
"steps": [
90+
{
91+
"arguments": [],
92+
"keyword": "Given ",
93+
"line": 8,
94+
"name": "passed step",
95+
"match": {
96+
"location": "Projects/nodejs-cucumber-sample-master/node_modules/cucumber/lib/support_code_library_builder/define_helpers.js:135"
97+
},
98+
"result": {
99+
"status": "passed",
100+
"duration": 7033
101+
}
102+
},
103+
{
104+
"arguments": [],
105+
"keyword": "Then ",
106+
"line": 9,
107+
"name": "skipped step",
108+
"match": {
109+
"location": "Projects/nodejs-cucumber-sample-master/node_modules/cucumber/lib/support_code_library_builder/define_helpers.js:135"
110+
},
111+
"result": {
112+
"status": "skipped",
113+
"duration": 86,
114+
"error_message": "step was skipped"
115+
}
116+
}
117+
]
118+
}
119+
]
120+
}
121+
]

0 commit comments

Comments
 (0)