[ACA-2116] search results available actions (#895)

* add item.id to File Libraries

* add method to wait for node to be indexed

* create separate methods in queries API to wait for sites or wait for nodes

* improvements, renaming

* renaming

* fix

* add tests for actions on search results

* add wait and use new method

* fix

* another fix

* use correct method

* more fixes

* create method for clickView button

* fixes

* no message
This commit is contained in:
Adina Parpalita
2019-01-19 18:47:12 +02:00
committed by Denys Vuika
parent 0471b783a4
commit d2e0f688e8
36 changed files with 919 additions and 257 deletions

View File

@@ -23,9 +23,10 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, browser, by, until, protractor } from 'protractor';
import { ElementFinder, browser, by, until, protractor, ExpectedConditions as EC } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Component } from '../component';
import { Utils } from '../../utilities/utils';
export class SearchInput extends Component {
private static selectors = {
@@ -35,27 +36,36 @@ export class SearchInput extends Component {
searchControl: '.app-search-control',
searchInput: 'app-control-input',
searchOptionsArea: 'search-options',
optionCheckbox: '.mat-checkbox'
optionCheckbox: '.mat-checkbox',
clearButton: '.app-clear-icon'
};
searchButton: ElementFinder = this.component.element(by.css(SearchInput.selectors.searchButton));
searchContainer: ElementFinder = browser.element(by.css(SearchInput.selectors.searchContainer));
searchControl: ElementFinder = browser.element(by.css(SearchInput.selectors.searchControl));
searchBar: ElementFinder = browser.element(by.id(SearchInput.selectors.searchInput));
searchOptionsArea: ElementFinder = browser.element(by.id(SearchInput.selectors.searchOptionsArea));
searchFilesOption: ElementFinder = this.searchOptionsArea.element(by.cssContainingText(SearchInput.selectors.optionCheckbox, 'Files'));
searchFoldersOption: ElementFinder = this.searchOptionsArea.element(by.cssContainingText(SearchInput.selectors.optionCheckbox, 'Folders'));
searchLibrariesOption: ElementFinder = this.searchOptionsArea.element(by.cssContainingText(SearchInput.selectors.optionCheckbox, 'Libraries'));
clearSearchButton: ElementFinder = this.searchContainer.$(SearchInput.selectors.clearButton);
constructor(ancestor?: ElementFinder) {
super(SearchInput.selectors.root, ancestor);
}
async waitForSearchControl() {
return await browser.wait(EC.presenceOf(this.searchControl), BROWSER_WAIT_TIMEOUT, '--- timeout waitForSearchControl ---');
}
async isSearchContainerDisplayed() {
return (await this.searchContainer.isDisplayed()) && (await this.searchButton.isDisplayed());
}
async clickSearchButton() {
await Utils.waitUntilElementClickable(this.searchButton);
await this.searchButton.click();
await this.waitForSearchControl();
}
async isOptionsAreaDisplayed() {
@@ -117,6 +127,16 @@ export class SearchInput extends Component {
}
}
async isClearSearchButtonPresent() {
return await browser.isElementPresent(this.clearSearchButton);
}
async clickClearSearchButton() {
if (await this.isClearSearchButtonPresent()) {
return await this.clearSearchButton.click();
}
}
async checkOnlyFiles() {
await this.clearOptions();
await this.clickFilesOption();
@@ -139,8 +159,14 @@ export class SearchInput extends Component {
}
async searchFor(text: string) {
await browser.wait(EC.elementToBeClickable(this.searchBar), BROWSER_WAIT_TIMEOUT, '---- timeout waiting for searchBar to be clickable');
await this.searchBar.clear();
await this.searchBar.sendKeys(text);
await this.searchBar.sendKeys(protractor.Key.ENTER);
}
async searchForTextAndCloseSearchOptions(text: string) {
await this.searchFor(text);
await Utils.pressEscape();
}
}