[ACS-7333] [E2E] search filters - properties tests migrated to Playwright (#3756)

* [ACS-7333] [E2E] search filters - properties tests migrated to Playwright

* [ACS-7333] review fix 1

* [ACS-7333] review fix 2

* [ACS-7333] review fix 3

* [ACS-7333] [E2E] search filters - properties tests migrated to Playwright
This commit is contained in:
Adam Świderski
2024-04-04 11:57:45 +02:00
committed by GitHub
parent f3c4e05e33
commit 2f9cc8075f
6 changed files with 168 additions and 8 deletions

View File

@@ -39,9 +39,9 @@ export class SearchFilters extends BaseComponent {
public locationFilter = this.page.locator('adf-search-widget-chip', { hasText: 'Location' });
public tagsFilter = this.page.locator('adf-search-widget-chip', { hasText: 'Tags' });
public categoriesFilter = this.page.locator('adf-search-widget-chip', { hasText: 'Categories' });
public resetButton = this.getChild('button' , { hasText: 'Reset' });
public menuCardTitle = this.getChild('.adf-search-filter-title');
public menuCardClose = this.getChild('.adf-search-filter-title-action');
public menuCardClear = this.getChild('#cancel-filter-button');
public menuCardApply = this.getChild('#apply-filter-button');
public resetButton = this.page.locator('button' , { hasText: 'Reset' });
public menuCardTitle = this.page.locator('.adf-search-filter-title');
public menuCardClose = this.page.locator('.adf-search-filter-title-action');
public menuCardClear = this.page.locator('#cancel-filter-button');
public menuCardApply = this.page.locator('#apply-filter-button');
}

View File

@@ -24,6 +24,7 @@
import { BaseComponent } from '../../base.component';
import { Page } from '@playwright/test';
import { SearchPage } from '@alfresco/playwright-shared';
export class SearchFiltersProperties extends BaseComponent {
private static rootElement = '.adf-search-filter-menu-card';
@@ -33,7 +34,66 @@ export class SearchFiltersProperties extends BaseComponent {
}
public operatorButton = this.getChild(`.adf-search-properties-file-size-operator`);
public fileSizeInput = this.getChild(`[placeholder$='Results will match all words entered here']`);
public fileSizeInput = this.getChild(`[placeholder$='Enter file size']`);
public unitButton = this.getChild(`.adf-search-properties-file-size-unit`);
public fileTypeInput = this.getChild(`[placeholder$='Results will exclude matches with these words']`);
public fileTypeInput = this.getChild(`[placeholder$='File Type']`);
public atLeastOption = this.page.locator(`.mat-option`, { hasText: 'At Least' });
public atMostOption = this.page.locator(`.mat-option`, { hasText: 'At Most' });
public exactlyOption = this.page.locator(`.mat-option`, { hasText: 'Exactly' });
public kbUnit = this.page.locator(`.mat-option`, { hasText: 'KB' });
public mbUnit = this.page.locator(`.mat-option`, { hasText: 'MB' });
public gbUnit = this.page.locator(`.mat-option`, { hasText: 'GB' });
public dropdownOptions = this.page.locator(`.mat-option`);
async setPropertiesParameters(
page: SearchPage,
operator?: 'At Least' | 'At Most' | 'Exactly',
unit?: 'KB' | 'MB' | 'GB',
fileSizeInputText?: string,
fileTypeInputText?: string
): Promise<void> {
await page.searchFilters.propertiesFilter.click();
if (operator) {
await this.operatorButton?.click();
switch (operator) {
case 'At Least':
await this.atLeastOption?.click();
break;
case 'At Most':
await this.atMostOption?.click();
break;
case 'Exactly':
await this.exactlyOption?.click();
break;
}
}
if (unit) {
await this.unitButton?.click();
switch (unit) {
case 'KB':
await this.kbUnit?.click();
break;
case 'MB':
await this.mbUnit?.click();
break;
case 'GB':
await this.gbUnit?.click();
break;
}
}
if (fileSizeInputText) {
await this.fileSizeInput?.fill(fileSizeInputText);
}
if (fileTypeInputText) {
await this.fileTypeInput?.fill(fileTypeInputText);
await this.dropdownOptions.first().click();
}
await page.searchFilters.menuCardApply.click();
await page.dataTable.progressBarWaitForReload();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

@@ -65,6 +65,10 @@ export const TEST_FILES = {
path: resolve(__dirname, 'file-jpg.jpg'),
name: 'file-jpg'
},
JPG_FILE_1MB: {
path: resolve(__dirname, 'file-jpg-1mb.jpg'),
name: 'file-jpg-1mb'
},
PDF_PROTECTED2: {
path: resolve(__dirname, 'protected.pdf'),
name: 'file-protected',