Skip to content

Commit cc04f4c

Browse files
Add ne inline input
Update Dashboard
1 parent 0bdbbb6 commit cc04f4c

33 files changed

+520
-179
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
Features:
66
- Update Tests to use Admin API to create preconditions -> [View Issue](https://github.com/aquality-automation/aquality-tracking/issues/100)
7+
- Dashboard: My open Issues -> [View Issue](https://github.com/aquality-automation/aquality-tracking/issues/74)
8+
- Cannot open external issue from Modal and View of Issue -> [View Issue](https://github.com/aquality-automation/aquality-tracking/issues/96)
9+
- Test run Bulk Delete -> [View Issue](https://github.com/aquality-automation/aquality-tracking/issues/91)
710

811
Bugfixes:
912
- Test run View Page performance is bad -> [View Issue](https://github.com/aquality-automation/aquality-tracking/issues/99)

e2e/api/base.api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ enum RequestType {
1414
export class BaseAPI {
1515
project: Project;
1616
token: string;
17-
cookie: string;
17+
protected cookie: string;
1818

1919
constructor(project: Project, token: string, cookie: string = undefined) {
2020
this.project = project;

e2e/api/user.api.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { Customer } from '../../src/app/shared/models/customer';
55
import { LocalPermissions } from '../../src/app/shared/models/LocalPermissions';
66
import { PermissionType } from '../helpers/project.helper';
77
import { logger } from '../utils/log.util';
8+
import { logIn } from '../pages/login.po';
9+
import { browser } from 'protractor';
810

911
enum Endpoints {
1012
project = '/project',
@@ -15,9 +17,11 @@ enum Endpoints {
1517
}
1618

1719
export class UserAPI extends BaseAPI {
20+
private user: User;
1821

19-
constructor(authCookie: string) {
22+
constructor(authCookie: string, user: User) {
2023
super(null, null, authCookie)
24+
this.user = user;
2125
}
2226

2327
public async createProject(project: Project): Promise<Project> {
@@ -74,4 +78,10 @@ export class UserAPI extends BaseAPI {
7478
public removeProject(project: Project): Promise<string> {
7579
return this.sendDelete(Endpoints.project, { id: project.id });
7680
}
81+
82+
public async relogin(): Promise<void> {
83+
await logIn.logInAs(this.user.user_name, this.user.password);
84+
const authCookie = await browser.manage().getCookie('iio78');
85+
this.cookie = decodeURIComponent(authCookie.value)
86+
}
7787
}

e2e/elements/base.element.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ export class BaseElement {
2323
return this.element.isPresent();
2424
}
2525

26+
async isDisplayed(): Promise<boolean> {
27+
return this.element.isDisplayed();
28+
}
29+
2630
async isEnabled(): Promise<boolean> {
2731
return this.element.isEnabled();
2832
}
Lines changed: 53 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,62 @@
1-
import { by, ElementFinder, Locator } from 'protractor';
1+
import { by, ElementFinder, Locator, browser } from 'protractor';
22
import { BaseElement } from './base.element';
33
import { Input } from './input.element';
4+
import { logger } from '../utils/log.util';
45

56
export class InlineEditor extends BaseElement {
67

78
constructor(locatorOrElement: Locator | ElementFinder) {
89
super(locatorOrElement);
910
}
1011

11-
private inlineForm: ElementFinder = this.element.element(by.css('.inlineEditForm'));
12-
private inlineFormSave: ElementFinder = this.element.element(by.css('#inline-editor-button-save'));
13-
private inlineInput: Input = new Input(this.element.element(by.css('input, textarea')));
14-
private link: ElementFinder = this.element.element(by.css('a'));
12+
private inlineForm: ElementFinder = this.element.element(by.css('.ie-value-holder'));
13+
private inlineLinkForm: ElementFinder = this.element.element(by.css('.link-holder'));
14+
private inlineFormPlaceholder: ElementFinder = this.element.element(by.css('.placeholder'));
15+
private editFormOpener: ElementFinder = this.element.element(by.css('.ie-edit'));
16+
private editorFormSave: ElementFinder = this.element.element(by.css('.ie-save'));
17+
private editorFormCancel: ElementFinder = this.element.element(by.css('.ie-cancel'));
18+
private editorInput: Input = new Input(this.element.element(by.css('.ie-editor')));
19+
private error: ElementFinder = this.element.element(by.css('.invalid-feedback'));
1520

1621
public async openEditor() {
17-
if (!(await this.inlineForm.isDisplayed())) {
18-
return this.element.click();
22+
logger.info('Opening Inline Editor');
23+
if (await this.inlineForm.isDisplayed()) {
24+
await browser.actions().mouseMove(this.inlineForm).perform();
25+
return this.editFormOpener.click();
1926
}
27+
logger.warn('Inline Editor is not displayed or already opened!');
2028
}
2129

2230
public async accept() {
23-
if (await this.inlineForm.isDisplayed()) {
24-
return this.inlineFormSave.click();
31+
logger.info('Saving Inline Editor');
32+
if (await this.editorInput.isDisplayed()) {
33+
return this.editorFormSave.click();
2534
}
35+
logger.warn('Inline Editor is not displayed or not opened!');
36+
}
37+
38+
public async cancel() {
39+
logger.info('Cancel Inline Editor');
40+
if (await this.editorInput.isDisplayed()) {
41+
return this.editorFormCancel.click();
42+
}
43+
logger.warn('Inline Editor is not displayed or not opened!');
2644
}
2745

2846
public async typeText(value: string) {
29-
if (await this.inlineForm.isDisplayed()) {
30-
return this.inlineInput.typeText(value);
47+
logger.info('Typing into Inline Editor');
48+
if (await this.editorInput.isDisplayed()) {
49+
return this.editorInput.typeText(value);
3150
}
51+
logger.warn('Inline Editor is not displayed or not opened!');
3252
}
3353

3454
public async isEnabled(): Promise<boolean> {
35-
await this.element.click();
36-
return this.inlineForm.isDisplayed();
55+
if (await this.inlineForm.isDisplayed()) {
56+
await browser.actions().mouseMove(this.inlineForm).perform();
57+
return this.editFormOpener.isPresent();
58+
}
59+
logger.warn('Inline Editor is not displayed or opened!');
3760
}
3861

3962
public async changeAndSetValue(value: string) {
@@ -42,7 +65,23 @@ export class InlineEditor extends BaseElement {
4265
return this.accept();
4366
}
4467

68+
public async getError(){
69+
return this.error.getText();
70+
}
71+
4572
public async getValue() {
46-
return this.link.getText();
73+
logger.warn('Getting Inline Editor value!');
74+
if (await this.inlineFormPlaceholder.isPresent()) {
75+
logger.warn('Inline Editor value is empty!');
76+
return ''
77+
}
78+
79+
if (await this.inlineLinkForm.isPresent()) {
80+
logger.warn('Inline Editor value is a link!');
81+
return this.inlineLinkForm.getAttribute('href');
82+
}
83+
84+
logger.warn('Inline Editor value is a text!');
85+
return this.inlineForm.getText();
4786
}
4887
}

e2e/helpers/project.helper.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class ProjectHelper {
4848
try {
4949
await logIn.logInAs(this.admin.user_name, this.admin.password);
5050
const authCookie = await browser.manage().getCookie('iio78');
51-
this.adminAPI = new UserAPI(decodeURIComponent(authCookie.value));
51+
this.adminAPI = new UserAPI(decodeURIComponent(authCookie.value), this.admin);
5252
this.project = await this.adminAPI.createProject(this.project);
5353
const token = await this.adminAPI.createToken(this.project);
5454
if (permissions) {
@@ -76,7 +76,14 @@ export class ProjectHelper {
7676

7777
public async dispose() {
7878
this.ifDisposed();
79-
await this.adminAPI.removeProject(this.project);
79+
try {
80+
await this.adminAPI.removeProject(this.project);
81+
} catch(err ) {
82+
if((err as string).endsWith(`Credentials you've provided are not valid. Reenter please.`)) {
83+
await this.adminAPI.relogin();
84+
await this.adminAPI.removeProject(this.project);
85+
}
86+
}
8087
this.disposed = true;
8188
}
8289

e2e/pages/issues/view.po/constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ import { Lookup } from '../../../elements/lookup.element';
33
import { Input } from '../../../elements/input.element';
44
import { Autocomplete } from '../../../elements/autocomplete.element';
55
import { SmartTable } from '../../../elements/smartTable.element';
6+
import { InlineEditor } from '../../../elements/inlineEditor.element';
67

78
export const elements = {
89
uniqueElement: element(by.id('issue-view')),
910
resolution: new Lookup(by.id('issue-resolution')),
1011
save: element(by.id('save')),
1112
title: new Input(by.id('issue-title')),
1213
assignee: new Autocomplete(by.id('issue-assignee')),
13-
extarnalIssue: new Input(by.id('issue-external-url')),
14+
extarnalIssue: new InlineEditor(by.id('issue-external-url')),
1415
description: new Input(by.id('issue-description')),
1516
expressionError: element(by.css('#issue-expression + .invalid-feedback')),
1617
overlappedIssues: new SmartTable(by.id('overlapped-issues-table')),

e2e/pages/issues/view.po/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class IssuesView extends BasePage {
2222
}
2323

2424
setExternalIssue(value: string): Promise<void> {
25-
return elements.extarnalIssue.typeText(value);
25+
return elements.extarnalIssue.changeAndSetValue(value);
2626
}
2727

2828
setAssignee(fullName: string): Promise<void> {

e2e/pages/modals/issueCreate.po/constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Input } from '../../../elements/input.element';
44
import { Lookup } from '../../../elements/lookup.element';
55
import { SmartTable } from '../../../elements/smartTable.element';
66
import { UiSwitch } from '../../../elements/ui-switch';
7+
import { InlineEditor } from '../../../elements/inlineEditor.element';
78

89
const baseElement = element(by.tagName('issue-create-modal'));
910

@@ -18,7 +19,7 @@ export const elements = {
1819
overlappedIssues: new SmartTable(baseElement.element(by.id('overlapped-issues-table'))),
1920
expressionError: baseElement.element(by.css('#issue-expression + div.invalid-feedback')),
2021
expression: new Input(baseElement.element(by.id('issue-expression'))),
21-
externalIssue: new Input(baseElement.element(by.id('issue-external-url'))),
22+
externalIssue: new InlineEditor(baseElement.element(by.id('issue-external-url'))),
2223
addToResults: new UiSwitch(baseElement.element(by.css('#update-results'))),
2324
description: new Input(baseElement.element(by.id('issue-description'))),
2425
};

e2e/pages/modals/issueCreate.po/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class IssueCreateModal extends BasePage {
4848
}
4949

5050
setExternalIssue(external_url: string): Promise<void> {
51-
return elements.externalIssue.typeText(external_url);
51+
return elements.externalIssue.changeAndSetValue(external_url);
5252
}
5353

5454
getAssignee(): Promise<string> {

0 commit comments

Comments
 (0)