Skip to content

Commit 784e8ce

Browse files
Fixes for tests
1 parent aa5d605 commit 784e8ce

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

e2e/elements/notification.element.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
1-
import { by, element } from 'protractor';
1+
import { by, element, browser } from 'protractor';
22
import { BaseElement } from './base.element';
33

44
export class Notification extends BaseElement {
55
private pageName: string;
6+
private clickSectionScript = `
7+
(function mouseEnter(el, etype) {
8+
if (el.fireEvent) {
9+
el.fireEvent('on' + etype);
10+
} else {
11+
var evObj = document.createEvent('Events');
12+
evObj.initEvent(etype, true, false);
13+
el.dispatchEvent(evObj);
14+
}
15+
})(arguments[0], 'mouseenter')
16+
`;
617

718
constructor(pageName: string) {
819
super(by.tagName('simple-notification'));
@@ -51,7 +62,14 @@ export class Notification extends BaseElement {
5162
return this.assert('warn', message, header);
5263
}
5364

65+
private mouseOver() {
66+
return browser.executeScript(this.clickSectionScript, this.getContainer());
67+
}
68+
5469
private async assert(type: string, message?: string, header?: string) {
70+
if (await this.isVisible()) {
71+
this.mouseOver();
72+
}
5573
await expect(type === 'error' ? this.isError() : type === 'success' ? this.isSuccess() : type === 'warn' ? this.isWarning() : false)
5674
.toBe(true, `${this.pageName}: No Success notification message!`);
5775
if (message) {

e2e/specs/administration/projectSettings/projectSettings.spec.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import { projectSettingsAdministration } from '../../../pages/administration/pro
55
import { logIn } from '../../../pages/login.po';
66
import { predefinedResolutions } from '../../../pages/administration/predefinedResolutions.po';
77
import { Test } from '../../../../src/app/shared/models/test';
8+
import { TestRun } from '../../../../src/app/shared/models/testRun';
9+
import { TestResult } from '../../../../src/app/shared/models/test-result';
810
import using from 'jasmine-data-provider';
911
import usersTestData from '../../../data/users.json';
1012
import cucumberImport from '../../../data/import/cucumber.json';
11-
import { TestRun } from '../../../../src/app/shared/models/testRun';
12-
import { TestResult } from '../../../../src/app/shared/models/test-result';
1313

1414
const editorExamples = {
1515
admin: usersTestData.admin,
@@ -112,13 +112,14 @@ describe('Administartion: Project Settings:', () => {
112112
[cucumberImport],
113113
['cucumber6.json']);
114114
let result: TestResult = (await projectHelper.editorAPI
115-
.getResults({ test_run_id: imported[0].id, project_id: projectHelper.project.id }))[0];
115+
.getResults({ test_run_id: imported[0].id, project_id: projectHelper.project.id }))
116+
.find(x => x.final_result_id === 5);
116117
result.final_result_id = 1;
117118
result.test_resolution_id = 4;
118119
result = await projectHelper.editorAPI.createResult(result);
119120
result = (await projectHelper.editorAPI.getResults(result))[0];
120121
expect(result.test.resolution_colors).toBe(`${result.test_resolution.color},3,3,3,3`, 'resolution_colors is wrong!');
121-
expect(result.test.result_colors).toBe(`${result.final_result.color},5,5,5,5`, 'result_colors is wrong!');
122+
expect(result.test.result_colors).toBe(`${result.final_result.color},4,4,4,4`, 'result_colors is wrong!');
122123
expect(result.test.result_ids.startsWith(`${result.id}`)).toBe(true, 'result_ids is wrong!');
123124
});
124125

0 commit comments

Comments
 (0)