Skip to content

Commit 97dabce

Browse files
Merge pull request #107 from aquality-automation/feature/new_dashboard
Feature/new dashboard
2 parents 3496561 + 6ab5f5f commit 97dabce

File tree

60 files changed

+1278
-420
lines changed

Some content is hidden

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

60 files changed

+1278
-420
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@
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)
1013
- API Token page: Link to Aquality Tracking API leads to null -> [View Issue](https://github.com/aquality-automation/aquality-tracking/issues/84)
1114
- External Link does not work on Issues List -> [View Issue](https://github.com/aquality-automation/aquality-tracking/issues/97)
15+
- Test page design is broken if steps are empty -> [View Issue](https://github.com/aquality-automation/aquality-tracking/issues/94)
1216

1317
## 0.3.9 (2020-04-21)
1418

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/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: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,24 @@ 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',
1113
customer = '/customer',
1214
apiToken = '/project/apiToken',
1315
projectPermission = '/users/permissions',
14-
users = '/users'
16+
users = '/users',
17+
testrun = '/testrun',
1518
}
1619

1720
export class UserAPI extends BaseAPI {
21+
private user: User;
1822

19-
constructor(authCookie: string) {
23+
constructor(authCookie: string, user: User) {
2024
super(null, null, authCookie)
25+
this.user = user;
2126
}
2227

2328
public async createProject(project: Project): Promise<Project> {
@@ -74,4 +79,14 @@ export class UserAPI extends BaseAPI {
7479
public removeProject(project: Project): Promise<string> {
7580
return this.sendDelete(Endpoints.project, { id: project.id });
7681
}
82+
83+
public async relogin(): Promise<void> {
84+
await logIn.logInAs(this.user.user_name, this.user.password);
85+
const authCookie = await browser.manage().getCookie('iio78');
86+
this.cookie = decodeURIComponent(authCookie.value)
87+
}
88+
89+
public async removeTestRun(id: number, project_id: number) {
90+
return this.sendDelete(Endpoints.testrun, { id, project_id }, null);
91+
}
7792
}

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/elements/menuBar.element/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { by, element, promise } from 'protractor';
1+
import { by, element, promise, browser } from 'protractor';
22
import { CreateOptions } from './create.options';
33
import { TestsOptions } from './tests.options';
44
import { AuditsOptions } from './audits.options';
@@ -21,7 +21,10 @@ export class MenuBar {
2121
: undefined;
2222
}
2323

24-
clickLogOut() {
24+
async clickLogOut() {
25+
if(await element(by.css('.loader')).isPresent()) {
26+
await browser.navigate().back();
27+
}
2528
return element(by.id('logout')).click();
2629
}
2730

e2e/elements/modal.element.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,36 @@ export class Modal extends BaseElement {
88

99
private _keys = {
1010
yes: 'yes',
11-
no: 'no'
11+
no: 'no',
12+
cancel: 'cancel'
1213
};
1314

1415
private async _clickActionBtn(buttonName: string) {
15-
const isVisible = await this.isVisible();
16-
if (!isVisible) {
16+
const isPresent = await this.isPresent();
17+
if (!isPresent) {
1718
throw new Error('You are trying to click button on the modal but the modal does not exists');
1819
}
1920

2021
return this.element.element(by.xpath(`.//button[text()="${buttonName}"]`)).click();
2122
}
2223

24+
private _clickSuccess() {
25+
return this.element.element(by.css(`button.btn-success`)).click();
26+
}
27+
2328
clickYes() {
2429
return this._clickActionBtn(this._keys.yes);
2530
}
2631

2732
clickNo() {
2833
return this._clickActionBtn(this._keys.no);
2934
}
35+
36+
clickCancel() {
37+
return this._clickActionBtn(this._keys.cancel);
38+
}
39+
40+
clickSuccess() {
41+
return this._clickSuccess();
42+
}
3043
}

e2e/elements/smartTable.element/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Row, CellElements } from './row.element';
99
import { ManageColumns } from './manageCollumns.element';
1010
import { compareCSVStrings } from '../../utils/csv.util';
1111
import { Dots } from '../dots.element';
12+
import { Checkbox } from '../checkbox.element';
1213

1314
const EC = protractor.ExpectedConditions;
1415

@@ -23,6 +24,8 @@ export class SmartTable extends BaseElement {
2324
private refreshButton = this.element.element(by.css('.actions-header .ft-refresh'));
2425
private totalLabel = this.element.element(by.css('.ft-total-label'));
2526
private getCSVButton = this.element.element(by.id('getSCV'));
27+
private deleteAllButton = this.element.element(by.css('.bulk-delete'));
28+
private selectAllCheckbox = new Checkbox(this.element.element(by.css('th input[name="select_all"]')));
2629

2730
constructor(locator: Locator) {
2831
super(locator);
@@ -169,6 +172,10 @@ export class SmartTable extends BaseElement {
169172
return this.bulkEditRow.clickAction();
170173
}
171174

175+
public deleteAll() {
176+
return this.deleteAllButton.click();
177+
}
178+
172179
public async getCreationTextFieldValue(columnName: string) {
173180
const columnIndex = await this.getColumnIndex(columnName);
174181
if (await this.isCreationOpened()) {
@@ -368,6 +375,10 @@ export class SmartTable extends BaseElement {
368375
const row = await this.getRow(searchValue, searchColumn);
369376
return row.removeMultiselectValueByColumnIndex(value, index);
370377
}
378+
379+
public isSelectorAvailable(): Promise<boolean> {
380+
return this.selectAllCheckbox.isPresent();
381+
}
371382

372383
private isCreationOpened() {
373384
return this.creationRow.isPresent();

e2e/helpers/project.helper.ts

Lines changed: 10 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,15 @@ export class ProjectHelper {
7676

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

0 commit comments

Comments
 (0)