[ACA-1088] add tests for search results page and actions on search results (#1051)

* add tests for search results page and actions on search results

* fix selector and add more tests

* split unshare tests

* fix tests

* add more tests and TestRail ids
This commit is contained in:
Adina Parpalita
2019-04-03 20:49:34 +03:00
committed by Denys Vuika
parent b69ed7da28
commit deea3465e0
30 changed files with 1959 additions and 344 deletions

View File

@@ -57,7 +57,13 @@ export class DataTable extends Component {
emptyListTitle: '.adf-empty-content__title',
emptyListSubtitle: '.adf-empty-content__subtitle',
emptyListText: '.adf-empty-content__text'
emptyListText: '.adf-empty-content__text',
emptySearchText: '.empty-search__text',
searchResultsRow: 'aca-search-results-row',
searchResultsRowLine: '.line',
searchResultsNameLink: '.link'
};
head: ElementFinder = this.component.element(by.css(DataTable.selectors.head));
@@ -69,6 +75,8 @@ export class DataTable extends Component {
emptyListSubtitle: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListSubtitle));
emptyListText: ElementArrayFinder = this.component.all(by.css(DataTable.selectors.emptyListText));
emptySearchText: ElementFinder = this.component.element(by.css(DataTable.selectors.emptySearchText));
menu: Menu = new Menu();
constructor(ancestor?: ElementFinder) {
@@ -76,12 +84,12 @@ export class DataTable extends Component {
}
// Wait methods (waits for elements)
waitForHeader() {
return browser.wait(EC.presenceOf(this.head), BROWSER_WAIT_TIMEOUT, '--- timeout waitForHeader ---');
async waitForHeader() {
return await browser.wait(EC.presenceOf(this.head), BROWSER_WAIT_TIMEOUT, '--- timeout waitForHeader ---');
}
waitForBody() {
return browser.wait(EC.presenceOf(this.body), BROWSER_WAIT_TIMEOUT, '--- timeout waitForBody ---');
async waitForBody() {
return await browser.wait(EC.presenceOf(this.body), BROWSER_WAIT_TIMEOUT, '--- timeout waitForBody ---');
}
async waitForEmptyState() {
@@ -166,20 +174,28 @@ export class DataTable extends Component {
return this.body.element(by.cssContainingText(DataTable.selectors.row, name));
}
getRowCells(name: string, location: string = '') {
return this.getRowByName(name, location).all(by.css(DataTable.selectors.cell));
}
async getRowCellsCount(itemName: string) {
return await this.getRowCells(itemName).count();
}
getRowFirstCell(name: string, location: string = '') {
return this.getRowByName(name, location).all(by.css(DataTable.selectors.cell)).get(0);
return this.getRowCells(name, location).get(0);
}
getRowNameCell(name: string) {
return this.getRowByName(name).all(by.css(DataTable.selectors.cell)).get(1);
getRowNameCell(name: string, location: string = '') {
return this.getRowCells(name, location).get(1);
}
getRowNameCellText(name: string) {
return this.getRowNameCell(name).$('span');
getRowNameCellSpan(name: string, location: string = '') {
return this.getRowNameCell(name, location).$('span');
}
async getItemNameTooltip(name: string) {
return await this.getRowNameCellText(name).getAttribute('title');
async getItemNameTooltip(name: string, location: string = '') {
return await this.getRowNameCellSpan(name, location).getAttribute('title');
}
async hasCheckMarkIcon(itemName: string, location: string = '') {
@@ -266,7 +282,6 @@ export class DataTable extends Component {
}
async rightClickOnMultipleSelection() {
await this.wait();
const itemFromSelection = this.getSelectedRows().get(0);
await browser.actions().click(itemFromSelection, protractor.Button.RIGHT).perform();
}
@@ -330,6 +345,10 @@ export class DataTable extends Component {
}
}
async getEmptySearchResultsText() {
return await this.emptySearchText.getText();
}
async getCellsContainingName(name: string) {
const rows = this.getRows().all(by.cssContainingText(DataTable.selectors.cell, name));
return rows.map(async cell => await cell.getText());
@@ -370,4 +389,53 @@ export class DataTable extends Component {
}, {});
}
getSearchResultsRowByName(name: string, location: string = '') {
if (location) {
return this.body.all(by.cssContainingText(DataTable.selectors.searchResultsRow, name))
.filter(async (elem) => await browser.isElementPresent(elem.element(by.cssContainingText(DataTable.selectors.searchResultsRowLine, location))))
.first();
}
return this.body.element(by.cssContainingText(DataTable.selectors.searchResultsRow, name));
}
getSearchResultRowLines(name: string, location: string = '') {
return this.getSearchResultsRowByName(name, location).all(by.css(DataTable.selectors.searchResultsRowLine));
}
async getSearchResultLinesCount(name: string, location: string = '') {
return await this.getSearchResultRowLines(name, location).count();
}
getSearchResultNthLine(name: string, location: string = '', index: number) {
return this.getSearchResultRowLines(name, location).get(index);
}
async getSearchResultNameAndTitle(name: string, location: string = '') {
return await this.getSearchResultNthLine(name, location, 0).getText();
}
async getSearchResultDescription(name: string, location: string = '') {
return await this.getSearchResultNthLine(name, location, 1).getText();
}
async getSearchResultModified(name: string, location: string = '') {
return await this.getSearchResultNthLine(name, location, 2).getText();
}
async getSearchResultLocation(name: string, location: string = '') {
return await this.getSearchResultNthLine(name, location, 3).getText();
}
getSearchResultNameLink(itemName: string, location: string = '') {
return this.getSearchResultsRowByName(itemName, location).$(DataTable.selectors.searchResultsNameLink);
}
async hasLinkOnSearchResultName(itemName: string, location: string = '') {
return await this.getSearchResultNameLink(itemName, location).isPresent();
}
async clickSearchResultNameLink(itemName: string, location: string = '') {
await this.getSearchResultNameLink(itemName, location).click();
}
}

View File

@@ -109,7 +109,7 @@ export class ConfirmDialog extends Component {
}
async clickCancel() {
return await this.clickButton('Cancel');
return await this.cancelButton.click();
}
async clickKeep() {

View File

@@ -68,8 +68,8 @@ export class LoginComponent extends Component {
await this.enterPassword(password);
}
submit() {
return this.submitButton.click();
async submit() {
await this.submitButton.click();
}
async clickPasswordVisibility() {

View File

@@ -82,7 +82,6 @@ export class Menu extends Component {
}
async waitForMenuToOpen() {
await browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-backdrop'))), BROWSER_WAIT_TIMEOUT);
await browser.wait(EC.presenceOf(browser.element(by.css('.mat-menu-panel'))), BROWSER_WAIT_TIMEOUT);
await browser.wait(EC.visibilityOf(this.items.get(0)), BROWSER_WAIT_TIMEOUT);
}

View File

@@ -167,9 +167,4 @@ export class SearchInput extends Component {
await this.searchBar.sendKeys(text);
await this.searchBar.sendKeys(protractor.Key.ENTER);
}
async searchForTextAndCloseSearchOptions(text: string) {
await this.searchFor(text);
await Utils.pressEscape();
}
}