[ACS-7466] [E2E] Added e2e tests for search highlighting (#4115)

This commit is contained in:
Adam Świderski
2024-09-12 16:22:10 +02:00
committed by GitHub
parent 2fc0a01bce
commit 8bef22b323
2 changed files with 95 additions and 0 deletions

View File

@@ -58,6 +58,10 @@ export class DataTableComponent extends BaseComponent {
lockOwner = this.page.locator('.aca-locked-by--name');
uncheckedCheckbox = this.page.locator('.mat-mdc-checkbox');
checkedCheckbox = this.page.locator('.mat-mdc-checkbox-checked');
highlightedText = '.aca-highlight';
searchFileName = '.search-file-name';
searchFileDescription = '[data-automation-id="search-results-entry-description"]';
searchFileContent = '.aca-result-content';
/** Locator for row (or rows) */
getRowLocator = this.page.getByRole('rowgroup').nth(1).locator('adf-datatable-row');
@@ -379,4 +383,15 @@ export class DataTableComponent extends BaseComponent {
const row = this.getRowByName(itemName);
return row.locator(this.lockOwner).innerText();
}
async hasHighlightedText(location: 'name' | 'description' | 'content'): Promise<boolean> {
switch (location) {
case 'name':
return this.page.locator(this.searchFileName).locator(this.highlightedText).isVisible();
case 'description':
return this.page.locator(this.searchFileDescription).locator(this.highlightedText).isVisible();
case 'content':
return this.page.locator(this.searchFileContent).locator(this.highlightedText).isVisible();
}
}
}