mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-5463] Rework Protractor tests - changes related to element/element… (#7284)
* ADF-5463 Rework Protractor tests - changes related to element/elements and duplication of locators * Fix one which I missed * Remove console.logs * Remove console.logs * Reverse the timeouts * Fixed things TSLint * Remove unused import * Fixed broken tests * Last test fixed
This commit is contained in:
@@ -15,23 +15,25 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Locator, browser, by, element, ElementFinder, protractor } from 'protractor';
|
||||
import { browser, ElementFinder, protractor, $ } from 'protractor';
|
||||
import { BrowserVisibility, BrowserActions, TestElement } from '@alfresco/adf-testing';
|
||||
|
||||
export class SearchBarPage {
|
||||
|
||||
searchIcon = element(by.css(`button[class*='adf-search-button']`));
|
||||
searchBar = element(by.css(`adf-search-control input`));
|
||||
searchIcon = $(`button[class*='adf-search-button']`);
|
||||
searchBar = $(`adf-search-control input`);
|
||||
searchBarExpanded: TestElement = TestElement.byCss(`adf-search-control mat-form-field[class*="mat-focused"] input`);
|
||||
noResultMessage = element(by.css(`p[class*='adf-search-fixed-text']`));
|
||||
rowsAuthor: Locator = by.css(`.mat-list-text p[class*='adf-search-fixed-text']`);
|
||||
completeName: Locator = by.css(`h4[class*='adf-search-fixed-text']`);
|
||||
highlightName: Locator = by.css(`.adf-highlight`);
|
||||
searchBarPage = element(by.css(`mat-list[id='autocomplete-search-result-list']`));
|
||||
noResultMessage = $(`p[class*='adf-search-fixed-text']`);
|
||||
rowsAuthor = `.mat-list-text p[class*='adf-search-fixed-text']`;
|
||||
completeName = `h4[class*='adf-search-fixed-text']`;
|
||||
highlightName = `.adf-highlight`;
|
||||
searchBarPage = $(`mat-list[id='autocomplete-search-result-list']`);
|
||||
|
||||
getRowByRowName = (name: string): ElementFinder => $(`mat-list-item[data-automation-id='autocomplete_for_${name}']`);
|
||||
|
||||
async pressDownArrowAndEnter(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.searchBar);
|
||||
await this.searchBar.sendKeys(protractor.Key.ARROW_DOWN);
|
||||
await BrowserActions.clearSendKeys(this.searchBar, protractor.Key.ARROW_DOWN);
|
||||
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
|
||||
}
|
||||
|
||||
@@ -80,20 +82,16 @@ export class SearchBarPage {
|
||||
await BrowserActions.click(this.getRowByRowName(fileName));
|
||||
}
|
||||
|
||||
getRowByRowName(name: string): ElementFinder {
|
||||
return element(by.css(`mat-list-item[data-automation-id='autocomplete_for_${name}']`));
|
||||
}
|
||||
|
||||
async getSpecificRowsHighlightName(fileName: string): Promise<string> {
|
||||
return BrowserActions.getText(this.getRowByRowName(fileName).element(this.highlightName));
|
||||
return BrowserActions.getText(this.getRowByRowName(fileName).$(this.highlightName));
|
||||
}
|
||||
|
||||
async getSpecificRowsCompleteName(fileName: string): Promise<string> {
|
||||
return BrowserActions.getText(this.getRowByRowName(fileName).element(this.completeName));
|
||||
return BrowserActions.getText(this.getRowByRowName(fileName).$(this.completeName));
|
||||
}
|
||||
|
||||
async getSpecificRowsAuthor(fileName: string): Promise<string> {
|
||||
return BrowserActions.getText(this.getRowByRowName(fileName).element(this.rowsAuthor));
|
||||
return BrowserActions.getText(this.getRowByRowName(fileName).$(this.rowsAuthor));
|
||||
}
|
||||
|
||||
async clearText(): Promise<void> {
|
||||
|
@@ -16,28 +16,28 @@
|
||||
*/
|
||||
|
||||
import { BrowserVisibility, DateRangeFilterPage, NumberRangeFilterPage, SearchCategoriesPage, SearchCheckListPage, SearchRadioPage, SearchSliderPage, SearchTextPage } from '@alfresco/adf-testing';
|
||||
import { by, element } from 'protractor';
|
||||
import { $, by } from 'protractor';
|
||||
|
||||
export class SearchFiltersPage {
|
||||
|
||||
searchCategoriesPage: SearchCategoriesPage = new SearchCategoriesPage();
|
||||
|
||||
searchFilters = element(by.css('adf-search-filter'));
|
||||
fileTypeFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.TYPE"]'));
|
||||
creatorFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.CREATOR"]'));
|
||||
fileSizeFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.SIZE"]'));
|
||||
nameFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Name"]'));
|
||||
checkListFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Check List"]'));
|
||||
createdDateRangeFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Created Date (range)"]'));
|
||||
typeFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Type"]'));
|
||||
sizeRangeFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Content Size (range)"]'));
|
||||
sizeSliderFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Content Size"]'));
|
||||
facetQueriesDefaultGroup = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_QUERIES.MY_FACET_QUERIES"],' +
|
||||
'mat-expansion-panel[data-automation-id="expansion-panel-My facet queries"]'));
|
||||
facetQueriesTypeGroup = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Type facet queries"]'));
|
||||
facetQueriesSizeGroup = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Size facet queries"]'));
|
||||
facetIntervalsByCreated = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-The Created"]'));
|
||||
facetIntervalsByModified = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-TheModified"]'));
|
||||
searchFilters = $('adf-search-filter');
|
||||
fileTypeFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.TYPE"]');
|
||||
creatorFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.CREATOR"]');
|
||||
fileSizeFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.SIZE"]');
|
||||
nameFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Name"]');
|
||||
checkListFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Check List"]');
|
||||
createdDateRangeFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Created Date (range)"]');
|
||||
typeFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Type"]');
|
||||
sizeRangeFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Content Size (range)"]');
|
||||
sizeSliderFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Content Size"]');
|
||||
facetQueriesDefaultGroup = $('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_QUERIES.MY_FACET_QUERIES"],' +
|
||||
'mat-expansion-panel[data-automation-id="expansion-panel-My facet queries"]');
|
||||
facetQueriesTypeGroup = $('mat-expansion-panel[data-automation-id="expansion-panel-Type facet queries"]');
|
||||
facetQueriesSizeGroup = $('mat-expansion-panel[data-automation-id="expansion-panel-Size facet queries"]');
|
||||
facetIntervalsByCreated = $('mat-expansion-panel[data-automation-id="expansion-panel-The Created"]');
|
||||
facetIntervalsByModified = $('mat-expansion-panel[data-automation-id="expansion-panel-TheModified"]');
|
||||
|
||||
async checkSearchFiltersIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.searchFilters);
|
||||
@@ -72,7 +72,7 @@ export class SearchFiltersPage {
|
||||
}
|
||||
|
||||
async checkCustomFacetFieldLabelIsDisplayed(fieldLabel: string): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(element(by.css(`mat-expansion-panel[data-automation-id="expansion-panel-${fieldLabel}"]`)));
|
||||
await BrowserVisibility.waitUntilElementIsVisible($(`mat-expansion-panel[data-automation-id="expansion-panel-${fieldLabel}"]`));
|
||||
}
|
||||
|
||||
sizeSliderFilterPage(): SearchSliderPage {
|
||||
|
@@ -16,12 +16,12 @@
|
||||
*/
|
||||
|
||||
import { BrowserVisibility, DataTableComponentPage, SearchSortingPickerPage } from '@alfresco/adf-testing';
|
||||
import { by, element } from 'protractor';
|
||||
import { $ } from 'protractor';
|
||||
import { ContentServicesPage } from '../../core/pages/content-services.page';
|
||||
|
||||
export class SearchResultsPage {
|
||||
|
||||
noResultsMessage = element(by.css('.app-no-result-message'));
|
||||
noResultsMessage = $('.app-no-result-message');
|
||||
dataTable = new DataTableComponentPage();
|
||||
searchSortingPicker = new SearchSortingPickerPage();
|
||||
contentServices = new ContentServicesPage();
|
||||
|
@@ -90,7 +90,7 @@ describe('Search Component - Multi-Select Facet', () => {
|
||||
|
||||
afterAll(async () => {
|
||||
await apiService.loginWithProfile('admin');
|
||||
|
||||
const sitesApi = new SitesApi(apiService.getInstance());
|
||||
await Promise.all([
|
||||
uploadActions.deleteFileOrFolder(jpgFile.entry.id),
|
||||
uploadActions.deleteFileOrFolder(jpgFileSite.entry.id),
|
||||
@@ -214,7 +214,7 @@ describe('Search Component - Multi-Select Facet', () => {
|
||||
await usersActions.createUser(acsUser);
|
||||
|
||||
await apiService.login(acsUser.username, acsUser.password);
|
||||
|
||||
const sitesApi = new SitesApi(apiService.getInstance());
|
||||
site = await sitesApi.createSite({
|
||||
title: StringUtil.generateRandomString(8),
|
||||
visibility: 'PUBLIC'
|
||||
@@ -236,7 +236,7 @@ describe('Search Component - Multi-Select Facet', () => {
|
||||
afterAll(async () => {
|
||||
await apiService.loginWithProfile('admin');
|
||||
await uploadActions.deleteFileOrFolder(txtFile.entry.id);
|
||||
|
||||
const sitesApi = new SitesApi(apiService.getInstance());
|
||||
await sitesApi.deleteSite(site.entry.id, { permanent: true });
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user