Skip to content

Commit b888405

Browse files
1 parent 056dda7 commit b888405

File tree

6 files changed

+28
-21
lines changed

6 files changed

+28
-21
lines changed

e2e/api/editor.api.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ export class EditorAPI extends BaseAPI {
8383
return this.sendGet(Endpoints.milestone, milestone);
8484
}
8585

86-
public async removeTestRun(testRunId: number) {
87-
return this.sendDelete(Endpoints.testrun, { id: testRunId, project_id: this.project.id }, null);
88-
}
89-
9086
public async createIssue(issue: Issue): Promise<Issue> {
9187
issue.project_id = this.project.id;
9288
issue.creator_id = 1;

e2e/api/user.api.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ enum Endpoints {
1313
customer = '/customer',
1414
apiToken = '/project/apiToken',
1515
projectPermission = '/users/permissions',
16-
users = '/users'
16+
users = '/users',
17+
testrun = '/testrun',
1718
}
1819

1920
export class UserAPI extends BaseAPI {
@@ -84,4 +85,8 @@ export class UserAPI extends BaseAPI {
8485
const authCookie = await browser.manage().getCookie('iio78');
8586
this.cookie = decodeURIComponent(authCookie.value)
8687
}
88+
89+
public async removeTestRun(testRunId: number) {
90+
return this.sendDelete(Endpoints.testrun, { id: testRunId, project_id: this.project.id }, null);
91+
}
8792
}

e2e/helpers/project.helper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export class ProjectHelper {
7676

7777
public async dispose() {
7878
this.ifDisposed();
79+
browser.navigate().back();
7980
try {
8081
await this.adminAPI.removeProject(this.project);
8182
} catch(err ) {

e2e/specs/suite/syncSuite.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ describe('Sync Test Suite', () => {
9696
});
9797

9898
afterAll(async () => {
99-
await projectHelper.editorAPI.removeTestRun(notSyncTestRun[0].id);
100-
await projectHelper.editorAPI.removeTestRun(syncTestRuns[0].id);
101-
return projectHelper.editorAPI.removeTestRun(syncTestRuns[1].id);
99+
await projectHelper.adminAPI.removeTestRun(notSyncTestRun[0].id);
100+
await projectHelper.adminAPI.removeTestRun(syncTestRuns[0].id);
101+
return projectHelper.adminAPI.removeTestRun(syncTestRuns[1].id);
102102
});
103103

104104
it('Check default fields if suite was not chosen', async () => {

src/app/pages/project/project-view/project-veiw.component.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export class ProjectViewComponent implements OnInit {
8282

8383
this.project = (await this.projectService.getProjects(this.project).toPromise())[0];
8484

85-
[this.allIssues,this.suites, this.testRuns, this.testRunStats] = await Promise.all([
85+
[this.allIssues, this.suites, this.testRuns, this.testRunStats] = await Promise.all([
8686
this.issueService.getIssues({ project_id: projectId }),
8787
this.testSuiteService.getTestSuite({ project_id: projectId }),
8888
this.testrunService.getTestRun(this.testRun, 5),
@@ -175,17 +175,21 @@ export class ProjectViewComponent implements OnInit {
175175
calculateAutomationQuality(testRunStatsBySuites: { suite: TestSuite, stats: TestRunStat[] }[]): { quality: number, NA: number, testIssue: number, other: number, appIssue: number, passed: number, total: number } {
176176
let stat = { quality: 0, NA: 0, testIssue: 0, other: 0, appIssue: 0, passed: 0, total: 0 }
177177

178+
console.log(testRunStatsBySuites)
179+
178180
for (const suiteStat of testRunStatsBySuites) {
179181
if (suiteStat.stats[0]) {
180-
stat.NA += suiteStat.stats[0].not_assigned;
181-
stat.appIssue += suiteStat.stats[0].app_issue;
182-
stat.passed += suiteStat.stats[0].passed;
183-
stat.testIssue += suiteStat.stats[0].warning;
184-
stat.other += suiteStat.stats[0].other;
185-
stat.total += suiteStat.stats[0].total;
182+
stat.NA += suiteStat.stats[0].not_assigned ? suiteStat.stats[0].not_assigned : 0;
183+
stat.appIssue += suiteStat.stats[0].app_issue ? suiteStat.stats[0].app_issue : 0;
184+
stat.passed += suiteStat.stats[0].passed ? suiteStat.stats[0].passed : 0;
185+
stat.testIssue += suiteStat.stats[0].warning ? suiteStat.stats[0].warning : 0;
186+
stat.other += suiteStat.stats[0].other ? suiteStat.stats[0].other : 0;
187+
stat.total += suiteStat.stats[0].total ? suiteStat.stats[0].total : 0;
186188
}
187189
}
188190

191+
console.log(stat)
192+
189193
stat.quality = stat.total > 0 ? (1 - ((stat.NA * 1 + stat.testIssue * 0.75 + stat.other * 0.5) / (stat.total))) * 100 : 0;
190194
if (stat.quality < 0) {
191195
stat.quality = 0;
@@ -204,10 +208,10 @@ export class ProjectViewComponent implements OnInit {
204208
for (const suiteStat of testRunStatsBySuite) {
205209
for (const stat of suiteStat.stats) {
206210
if (Math.floor(new Date().getTime() - new Date(stat.finish_time).getTime()) / (1000 * 60 * 60 * 24) < 90) {
207-
ttlNA += stat.not_assigned;
208-
ttltestIssue += stat.warning;
209-
ttlOther += stat.other;
210-
ttl += stat.total;
211+
ttlNA += stat.not_assigned ? stat.not_assigned : 0;
212+
ttltestIssue += stat.warning ? stat.warning : 0;
213+
ttlOther += stat.other ? stat.other : 0;
214+
ttl += stat.total ? stat.total : 0;
211215
}
212216
}
213217
}
@@ -220,6 +224,7 @@ export class ProjectViewComponent implements OnInit {
220224
}
221225

222226
createChartData(data: { quality: number, NA: number, testIssue: number, other: number, appIssue: number, passed: number }) {
227+
console.log(data);
223228
return [{
224229
value: data.passed,
225230
color: '#28A745',

src/app/pages/project/test/steps-container/steps-container.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010

1111
<ul *ngIf="editable" class="col-sm-12 no-padding creator">
1212
<li class="clearfix step-row form-row">
13-
<div class="col-sm-1 add-step-cell">
13+
<div class="col-sm-2 add-step-cell">
1414
<lookup-autocomplete class="type-selector" [cutLongText]="true" [small]="true" placeholder="Step Type" [allowEmptyValue]="true"
1515
[propertiesToShow]="['name']" [array]="types" [model]="newStepType" (modelChange)="setNewStepType($event)">
1616
</lookup-autocomplete>
1717
</div>
18-
<div class="col-sm-10 add-step-cell">
18+
<div class="col-sm-9 add-step-cell">
1919
<lookup-autocomplete class="step-selector" [cutLongText]="true" [small]="true" placeholder="Step" [allowEmptyValue]="false"
2020
[propertiesToShow]="['name']" [array]="filteredSteps" [(model)]="newStep" [disabled]="!newStepType"
2121
[allowCreation]="true" (searchText)="createStep($event)">

0 commit comments

Comments
 (0)