add components for search filters and search sorting

This commit is contained in:
Adina Parpalita 2020-01-05 18:58:07 +02:00
parent 4b7cd44001
commit 03bb0b139f
8 changed files with 641 additions and 25 deletions

View File

@ -0,0 +1,137 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, by, protractor } from 'protractor';
import { GenericFilterPanel } from './generic-filter-panel';
import { Utils } from '../../../utilities/utils';
export class CreatedDateFilter extends GenericFilterPanel {
constructor() {
super('Created date');
}
fromField: ElementFinder = this.panelExpanded.element(by.cssContainingText('.adf-search-date-range .mat-form-field', 'From'));
fromInput: ElementFinder = this.fromField.element(by.css(`[data-automation-id='date-range-from-input']`));
fromFieldError: ElementFinder = this.fromField.element(by.css(`[data-automation-id='date-range-from-error']`));
toField: ElementFinder = this.panelExpanded.element(by.cssContainingText('.adf-search-date-range .mat-form-field', 'To'));
toInput: ElementFinder = this.toField.element(by.css(`[data-automation-id='date-range-to-input']`))
toFieldError: ElementFinder = this.toField.element(by.css(`[data-automation-id='date-range-to-error']`))
clearButton: ElementFinder = this.panel.element(by.css('.adf-facet-buttons [data-automation-id="date-range-clear-btn"]'));
applyButton: ElementFinder = this.panel.element(by.css('.adf-facet-buttons [data-automation-id="date-range-apply-btn"]'));
async isFromFieldDisplayed(): Promise<boolean> {
return (await this.fromField.isPresent()) && (await this.fromField.isDisplayed());
}
async isFromErrorDisplayed(): Promise<boolean> {
return (await this.fromFieldError.isPresent()) && (await this.fromFieldError.isDisplayed());
}
async isToFieldDisplayed(): Promise<boolean> {
return (await this.toField.isPresent()) && (await this.toField.isDisplayed());
}
async isToErrorDisplayed(): Promise<boolean> {
return (await this.toFieldError.isPresent()) && (await this.toFieldError.isDisplayed());
}
async isClearButtonEnabled(): Promise<boolean> {
return await this.clearButton.isEnabled();
}
async isApplyButtonEnabled(): Promise<boolean> {
return await this.applyButton.isEnabled();
}
async clickClearButton(): Promise<void> {
if ( await this.isClearButtonEnabled() ) {
await this.clearButton.click();
}
}
async clickApplyButton(): Promise<void> {
if ( await this.isApplyButtonEnabled() ) {
await this.applyButton.click();
}
}
async getFromValue(): Promise<string> {
try {
const value = await this.fromInput.getAttribute('value');
return value;
} catch (error) {
return '';
}
}
async getFromError(): Promise<string> {
try {
const error = await this.fromFieldError.getText();
return error;
} catch (err) {
return '';
}
}
async getToValue(): Promise<string> {
try {
const value = await this.toInput.getAttribute('value');
return value;
} catch (err) {
return '';
}
}
async getToError(): Promise<string> {
try {
const error = await this.toFieldError.getText();
return error;
} catch (err) {
return '';
}
}
async resetPanel(): Promise<void> {
const fromValue = await this.getFromValue();
const toValue = await this.getToValue();
if ( fromValue.length > 0 || toValue.length > 0 ) {
await this.expandPanel();
await this.clickClearButton();
await this.collapsePanel();
}
}
async enterFromDate(date: string): Promise<void> {
await this.expandPanel();
await Utils.clearFieldWithBackspace(this.fromInput);
await this.fromInput.sendKeys(date, protractor.Key.TAB);
}
async enterToDate(date: string): Promise<void> {
await this.expandPanel();
await Utils.clearFieldWithBackspace(this.toInput);
await this.toInput.sendKeys(date, protractor.Key.TAB);
}
}

View File

@ -0,0 +1,94 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, ElementArrayFinder, by } from 'protractor';
import { GenericFilterPanel } from './generic-filter-panel';
export class FacetFilter extends GenericFilterPanel {
private readonly locators = {
checkbox: '.mat-checkbox',
checkboxChecked: '.mat-checkbox.mat-checkbox-checked',
button: '.adf-facet-buttons button',
categoryInput: 'input[placeholder="Filter category"',
facetsFilter: '.adf-facet-result-filter'
}
get facets(): ElementArrayFinder { return this.panelExpanded.all(by.css(this.locators.checkbox)); }
get selectedFacets(): ElementArrayFinder { return this.panel.all(by.css(this.locators.checkboxChecked)); }
get clearButton(): ElementFinder { return this.panel.element(by.cssContainingText(this.locators.button, 'Clear all')); }
get facetsFilter(): ElementFinder { return this.panelExpanded.element(by.css(this.locators.facetsFilter)); }
get filterCategoryInput(): ElementFinder { return this.facetsFilter.element(by.css(this.locators.categoryInput)); }
async getFiltersValues(): Promise<string[]> {
const list: string[] = await this.facets.map(option => {
return option.getText();
});
return list;
}
async getFiltersCheckedValues(): Promise<string[]> {
const list: string[] = await this.selectedFacets.map(option => {
return option.getText();
});
return list;
}
async resetPanel(): Promise<void> {
if ( (await this.selectedFacets.count()) > 0 ) {
await this.expandPanel();
await this.selectedFacets.each(async elem => {
await elem.click();
});
}
await this.expandPanel();
}
async isFilterFacetsDisplayed(): Promise<boolean> {
return await this.facetsFilter.isDisplayed();
}
async isClearButtonEnabled(): Promise<boolean> {
return await this.clearButton.isEnabled();
}
async clickClearButton(): Promise<void> {
if ( await this.isClearButtonEnabled() ) {
await this.clearButton.click();
}
}
async isFilterCategoryInputDisplayed(): Promise<boolean> {
return await this.filterCategoryInput.isDisplayed();
}
async checkCategory(name: string): Promise<void> {
const option = this.facets.filter(async (elem) => (await elem.getText()).includes(name)).first();
await option.click();
}
async filterCategoriesBy(name: string): Promise<void> {
await this.filterCategoryInput.sendKeys(name);
}
}

View File

@ -0,0 +1,71 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, by, browser } from 'protractor';
export class GenericFilterPanel {
private filterName: string;
constructor(filterName: string) {
this.filterName = filterName;
}
private readonly selectors = {
root: 'adf-search-filter',
panel: '.mat-expansion-panel',
panelExpanded: '.mat-expansion-panel.mat-expanded',
panelHeader: '.mat-expansion-panel-header'
}
get panel(): ElementFinder { return browser.element(by.cssContainingText(this.selectors.panel, this.filterName)); }
get panelExpanded(): ElementFinder { return browser.element(by.cssContainingText(this.selectors.panelExpanded, this.filterName)); }
get panelHeader(): ElementFinder { return this.panel.element(by.css(this.selectors.panelHeader)); }
async clickPanelHeader(): Promise<void> {
await this.panelHeader.click();
}
async isPanelDisplayed(): Promise<boolean> {
return (await browser.isElementPresent(this.panel)) && (await this.panel.isDisplayed());
}
async isPanelExpanded(): Promise<boolean> {
return (await this.panelExpanded.isPresent()) && (await this.panelExpanded.isDisplayed());
}
async expandPanel(): Promise<void> {
if ( !(await this.isPanelExpanded()) ) {
await this.clickPanelHeader();
}
}
async collapsePanel(): Promise<void> {
if ( await this.isPanelExpanded() ) {
await this.clickPanelHeader();
}
}
}

View File

@ -0,0 +1,92 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, by, ElementArrayFinder } from 'protractor';
import { GenericFilterPanel } from './generic-filter-panel';
export class SizeFilter extends GenericFilterPanel {
constructor() {
super('Size');
}
facets: ElementArrayFinder = this.panelExpanded.all(by.css('.mat-checkbox'));
selectedFacets: ElementArrayFinder = this.panel.all(by.css('.mat-checkbox.mat-checkbox-checked'));
clearButton: ElementFinder = this.panel.element(by.cssContainingText('.adf-facet-buttons button', 'Clear all'));
async getFiltersValues(): Promise<string[]> {
const list: string[] = await this.facets.map(option => {
return option.getText();
});
return list;
}
async getFiltersCheckedValues(): Promise<string[]> {
const list: string[] = await this.selectedFacets.map(option => {
return option.getText();
});
return list;
}
async resetPanel(): Promise<void> {
if ( (await this.selectedFacets.count()) > 0 ) {
await this.expandPanel();
await this.selectedFacets.each(async elem => {
await elem.click();
});
}
await this.collapsePanel();
}
async isClearButtonEnabled(): Promise<boolean> {
return await this.clearButton.isEnabled();
}
async clickClearButton(): Promise<void> {
if ( await this.isClearButtonEnabled() ) {
await this.clearButton.click();
}
}
async checkSizeSmall(): Promise<void> {
const small = this.facets.filter(async (elem) => await elem.getText() === 'Small').first();
await small.click();
}
async checkSizeMedium(): Promise<void> {
const medium = this.facets.filter(async (elem) => await elem.getText() === 'Medium').first();
await medium.click();
}
async checkSizeLarge(): Promise<void> {
const large = this.facets.filter(async (elem) => await elem.getText() === 'Large').first();
await large.click();
}
async checkSizeHuge(): Promise<void> {
const huge = this.facets.filter(async (elem) => await elem.getText() === 'Huge').first();
await huge.click();
}
}

View File

@ -0,0 +1,60 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, by, browser } from 'protractor';
import { Component } from '../component';
import { SizeFilter } from './filters/size-filter';
import { CreatedDateFilter } from './filters/created-date-filter';
import { FacetFilter } from './filters/facet-filter';
export class SearchFilters extends Component {
private static selectors = {
root: 'adf-search-filter',
};
mainPanel: ElementFinder = browser.element(by.css(SearchFilters.selectors.root));
resetAllButton: ElementFinder = this.component.element(by.cssContainingText('.mat-button', 'Reset all'));
size = new SizeFilter();
createdDate = new CreatedDateFilter();
fileType = new FacetFilter('File type');
creator = new FacetFilter('Creator');
modifier = new FacetFilter('Modifier');
location = new FacetFilter('Location');
modifiedDate = new FacetFilter('Modified date');
constructor(ancestor?: ElementFinder) {
super(SearchFilters.selectors.root, ancestor);
}
async isSearchFiltersPanelDisplayed(): Promise<boolean> {
return (await this.mainPanel.isPresent()) && (await this.mainPanel.isDisplayed());
}
async clickResetAllButton(): Promise<void> {
await this.resetAllButton.click();
}
}

View File

@ -34,7 +34,7 @@ export class SearchInput extends Component {
searchContainer: '.app-search-container',
searchButton: '.app-search-button',
searchControl: '.app-search-control',
searchInput: 'app-control-input',
searchInput: `input[id='app-control-input']`,
searchOptionsArea: 'search-options',
optionCheckbox: '.mat-checkbox',
clearButton: '.app-clear-icon'
@ -43,7 +43,7 @@ export class SearchInput extends Component {
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));
searchInput: ElementFinder = browser.element(by.css(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'));
@ -58,6 +58,10 @@ export class SearchInput extends Component {
await browser.wait(EC.presenceOf(this.searchControl), BROWSER_WAIT_TIMEOUT, '--- timeout waitForSearchControl ---');
}
async waitForSearchInputToBeInteractive() {
await browser.wait(EC.elementToBeClickable(this.searchControl), BROWSER_WAIT_TIMEOUT, '--- timeout waitForSearchControl ---');
}
async isSearchContainerDisplayed() {
return (await this.searchContainer.isDisplayed()) && (await this.searchButton.isDisplayed());
}
@ -162,9 +166,9 @@ 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);
await this.waitForSearchInputToBeInteractive();
await Utils.clearFieldWithBackspace(this.searchInput);
await this.searchInput.sendKeys(text);
await this.searchInput.sendKeys(protractor.Key.ENTER);
}
}

View File

@ -0,0 +1,141 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, by, browser, ExpectedConditions as EC, ElementArrayFinder } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Component } from '../component';
export class SearchSortingPicker extends Component {
private static selectors = {
root: 'adf-search-sorting-picker',
sortByOption: '.mat-option .mat-option-text'
};
sortOrderButton: ElementFinder = this.component.element(by.css('button[mat-icon-button]'));
sortByDropdownCollapsed: ElementFinder = this.component.element(by.css('.mat-select'));
sortByDropdownExpanded: ElementFinder = browser.element(by.css('.mat-select-panel'));
sortByList: ElementArrayFinder = this.sortByDropdownExpanded.all(by.css(SearchSortingPicker.selectors.sortByOption));
constructor(ancestor?: ElementFinder) {
super(SearchSortingPicker.selectors.root, ancestor);
}
async waitForSortByDropdownToExpand(): Promise<void> {
await browser.wait(EC.visibilityOf(this.sortByDropdownExpanded), BROWSER_WAIT_TIMEOUT, 'Timeout waiting for sortBy dropdown to expand');
}
async isSortOrderButtonDisplayed(): Promise<boolean> {
return (await this.sortOrderButton.isPresent()) && (await this.sortOrderButton.isDisplayed());
}
async getSortOrder(): Promise<'ASC' | 'DESC' | ''> {
const orderArrow = await this.sortOrderButton.getText();
if ( orderArrow.includes('upward') ) {
return 'ASC'
} else if ( orderArrow.includes('downward') ) {
return 'DESC'
} else {
return '';
}
}
async isSortByOptionDisplayed(): Promise<boolean> {
return (await this.sortByDropdownCollapsed.isPresent()) && (await this.sortByDropdownCollapsed.isDisplayed());
}
async isSortByDropdownExpanded(): Promise<boolean> {
return (await this.sortByDropdownExpanded.isPresent()) && (await this.sortByDropdownExpanded.isDisplayed());
}
async getSelectedSortByOption(): Promise<string> {
return await this.sortByDropdownCollapsed.getText();
}
async clickSortByDropdown(): Promise<void> {
await this.sortByDropdownCollapsed.click();
await this.waitForSortByDropdownToExpand();
}
async getSortByOptionsList(): Promise<string[]> {
const list: string[] = await this.sortByList.map(async option => {
return option.getText();
});
return list;
}
async sortByOption(option: string): Promise<void> {
if ( !(await this.isSortByDropdownExpanded()) ) {
await this.clickSortByDropdown();
}
const elem = browser.element(by.cssContainingText(SearchSortingPicker.selectors.sortByOption, option));
await elem.click();
}
async sortByName(): Promise<void> {
await this.sortByOption('Filename');
}
async sortByRelevance(): Promise<void> {
await this.sortByOption('Relevance');
}
async sortByTitle(): Promise<void> {
await this.sortByOption('Title');
}
async sortByModifiedDate(): Promise<void> {
await this.sortByOption('Modified date');
}
async sortByModifier(): Promise<void> {
await this.sortByOption('Modifier');
}
async sortByCreatedDate(): Promise<void> {
await this.sortByOption('Created date');
}
async sortBySize(): Promise<void> {
await this.sortByOption('Size');
}
async sortByType(): Promise<void> {
await this.sortByOption('Type');
}
async setSortOrderASC(): Promise<void> {
if ( (await this.getSortOrder()) !== 'ASC' ) {
await this.sortOrderButton.click();
}
}
async setSortOrderDESC(): Promise<void> {
if ( (await this.getSortOrder()) !== 'DESC' ) {
await this.sortOrderButton.click();
}
}
}

View File

@ -23,37 +23,54 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { browser, by } from 'protractor';
import { browser, by, By, ElementFinder, ElementArrayFinder } from 'protractor';
import { BrowsingPage } from './browsing-page';
import { SearchSortingPicker } from '../components/search/search-sorting-picker';
import { SearchFilters } from '../components/search/search-filters';
export class SearchResultsPage extends BrowsingPage {
private static selectors = {
root: 'aca-search-results',
filter: 'adf-search-filter',
expansionPanel: 'mat-expansion-panel',
size: '#expansion-panel-SEARCH.CATEGORIES.SIZE',
createdDate: '#expansion-panel-SEARCH.CATEGORIES.CREATED_DATE',
modifiedDate: '#expansion-panel-SEARCH.CATEGORIES.MODIFIED_DATE',
fileType: '#expansion-panel-SEARCH.FACET_FIELDS.FILE_TYPE',
creator: '#expansion-panel-SEARCH.CATEGORIES.CREATOR',
modifier: '#expansion-panel-SEARCH.CATEGORIES.MODIFIER',
location: '#expansion-panel-SEARCH.CATEGORIES.LOCATION',
resultsContent: 'adf-search-results__content',
resultsContentHeader: '.adf-search-results__content-header',
resultsInfoText: 'adf-search-results--info-text',
resultsFacets: 'adf-search-results__facets',
sortingPicker: 'adf-sorting-picker'
infoText: '.adf-search-results--info-text',
chipList: '.adf-search-chip-list',
chip: '.mat-chip',
chipCloseIcon: '.mat-chip-remove'
};
async waitForResults() {
root: ElementFinder = browser.element(by.css(SearchResultsPage.selectors.root));
chipList: ElementFinder = this.root.element(by.css(SearchResultsPage.selectors.chipList));
infoText: ElementFinder = this.root.element(by.css(SearchResultsPage.selectors.infoText));
sortingPicker = new SearchSortingPicker(this.root);
filters = new SearchFilters(this.root);
async waitForResults(): Promise<void> {
await this.dataTable.waitForBody();
}
async getResultsHeader() {
return browser.element(by.css(SearchResultsPage.selectors.resultsContentHeader)).getText();
async getResultsHeader(): Promise<string> {
return await browser.element(by.css(SearchResultsPage.selectors.resultsContentHeader)).getText();
}
async getResultsFoundText(): Promise<string> {
return await this.infoText.getText();
}
async getResultsChipsValues(): Promise<string[]> {
const chips: ElementArrayFinder = this.chipList.all(by.css(SearchResultsPage.selectors.chip));
const chipsValues: string[] = await chips.map(async elem => {
return (await elem.getText()).replace(`\ncancel`, '');
});
return chipsValues;
}
async removeChip(chipName: string): Promise<void> {
const chip: ElementFinder = browser.element(By.cssContainingText(SearchResultsPage.selectors.chip, chipName));
const closeChip: ElementFinder = chip.element(by.css(SearchResultsPage.selectors.chipCloseIcon));
await closeChip.click();
}
}