Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/interfaces/BO/catalog/files/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface BOFilesPageInterface extends BOBasePagePageInterface {

deleteFile(page: Page, row?: number): Promise<string>;
deleteFilesBulkActions(page: Page): Promise<string>;
filterByFileSize(page: Page, min: number|string, max: number|string): Promise<void>;
filterTable(page: Page, filterBy: string, value?: string): Promise<void>;
getAllRowsColumnContent(page: Page, column: string): Promise<string[]>;
getNumberOfElementInGrid(page: Page): Promise<number>;
Expand Down
19 changes: 19 additions & 0 deletions src/versions/develop/pages/BO/catalog/files/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ class BOFilesPage extends BOBasePage implements BOFilesPageInterface {

private readonly filterColumn: (filterBy: string) => string;

private readonly filterFileSizeMinInput: string;

private readonly filterFileSizeMaxInput: string;

private readonly filterSearchButton: string;

private readonly filterResetButton: string;
Expand Down Expand Up @@ -87,6 +91,8 @@ class BOFilesPage extends BOBasePage implements BOFilesPageInterface {

// Filters
this.filterColumn = (filterBy: string) => `${this.gridTable} #attachment_${filterBy}`;
this.filterFileSizeMinInput = `${this.gridTable} #attachment_file_size_min_field`;
this.filterFileSizeMaxInput = `${this.gridTable} #attachment_file_size_max_field`;
this.filterSearchButton = `${this.gridTable} .grid-search-button`;
this.filterResetButton = `${this.gridTable} .grid-reset-button`;

Expand Down Expand Up @@ -240,6 +246,19 @@ class BOFilesPage extends BOBasePage implements BOFilesPageInterface {
await this.clickAndWaitForURL(page, this.filterSearchButton);
}

/**
* Filter Files by size (bytes) using the min/max range inputs
* @param page {Page} Browser tab
* @param min {number|string} Minimum size in bytes (empty string to leave unset)
* @param max {number|string} Maximum size in bytes (empty string to leave unset)
* @return {Promise<void>}
*/
async filterByFileSize(page: Page, min: number|string, max: number|string): Promise<void> {
await page.locator(this.filterFileSizeMinInput).fill(min.toString());
await page.locator(this.filterFileSizeMaxInput).fill(max.toString());
await this.clickAndWaitForURL(page, this.filterSearchButton);
}

/**
* Delete all files in table with Bulk Actions
* @param page {Page} Browser tab
Expand Down
Loading