mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-6954] Refactored search playwright tests (#3700)
* Refactored search playwright tests
This commit is contained in:
@@ -366,11 +366,4 @@ export class DataTableComponent extends BaseComponent {
|
||||
}
|
||||
return sitesInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to wait for values to be loaded in the table
|
||||
*/
|
||||
async waitForTable(): Promise<void> {
|
||||
await this.getRowLocator.nth(0).waitFor({timeout:5000});
|
||||
}
|
||||
}
|
||||
|
@@ -28,16 +28,13 @@ import { timeouts } from '../../../utils';
|
||||
|
||||
export class SearchInputComponent extends BaseComponent {
|
||||
private static rootElement = 'aca-page-layout';
|
||||
public searchOptionsArea = this.page.locator('mat-checkbox');
|
||||
public searchInput = this.getChild('input[id="app-control-input"]');
|
||||
public searchButton = this.getChild('.app-search-button');
|
||||
public searchInput = this.page.locator('#app-control-input');
|
||||
public searchButton = this.page.locator('.app-search-button');
|
||||
public searchButtonWindow = this.page.locator('#app-search-button');
|
||||
public searchInputWindow = this.page.locator('.app-search-control');
|
||||
public searchInputWindowInput = this.page.locator('.app-search-control input');
|
||||
public searchOptions = this.page.locator('#search-options');
|
||||
public searchFilesOption = this.searchOptionsArea.getByText(' Files ');
|
||||
public searchLibrariesOption = this.searchOptionsArea.getByText(' Libraries ');
|
||||
public searchFoldersOption = this.searchOptionsArea.getByText(' Folders ');
|
||||
public searchFilesOption = this.page.locator('#content')
|
||||
public searchLibrariesOption = this.page.locator('#libraries')
|
||||
public searchFoldersOption = this.page.locator('#folder')
|
||||
|
||||
|
||||
getIconByName = (name: string): Locator => this.getChild('.mat-icon', { hasText: name });
|
||||
@@ -121,9 +118,9 @@ export class SearchInputComponent extends BaseComponent {
|
||||
}
|
||||
|
||||
async searchFor(text: string) {
|
||||
await this.searchInputWindow.click();
|
||||
await this.searchInputWindowInput.clear();
|
||||
await this.searchInputWindow.type(text);
|
||||
await this.searchInput.click({force: true});
|
||||
await this.searchInput.clear({force: true});
|
||||
await this.searchInput.fill(text, {force: true});
|
||||
await this.searchButtonWindow.click();
|
||||
}
|
||||
}
|
||||
|
@@ -28,6 +28,8 @@ import { DataTableComponent, MatMenuComponent, ViewerComponent, SearchInputCompo
|
||||
import { AcaHeader } from '../components/aca-header.component';
|
||||
import { AdfConfirmDialogComponent, AdfFolderDialogComponent } from '../components/dialogs';
|
||||
|
||||
type SearchType = 'files' | 'folders' | 'filesAndFolders' | 'libraries';
|
||||
|
||||
export class SearchPage extends BasePage {
|
||||
private static pageUrl = 'search';
|
||||
|
||||
@@ -44,4 +46,27 @@ export class SearchPage extends BasePage {
|
||||
public searchOverlay = new SearchOverlayComponent(this.page);
|
||||
public sidenav = new SidenavComponent(this.page);
|
||||
public confirmDialogComponent = new AdfConfirmDialogComponent(this.page);
|
||||
|
||||
async searchWithin(searchText: string, searchType: SearchType): Promise<void> {
|
||||
await this.acaHeader.searchButton.click();
|
||||
await this.searchInput.searchButton.click();
|
||||
switch (searchType) {
|
||||
case 'files':
|
||||
await this.searchInput.checkOnlyFiles();
|
||||
break;
|
||||
case 'folders':
|
||||
await this.searchInput.checkOnlyFolders();
|
||||
break;
|
||||
case 'filesAndFolders':
|
||||
await this.searchInput.checkFilesAndFolders();
|
||||
break;
|
||||
case 'libraries':
|
||||
await this.searchInput.checkLibraries();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
await this.searchInput.searchFor(searchText);
|
||||
await this.dataTable.progressBarWaitForReload();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user