|
| 1 | +import selectors from "#selectors/filtering.js"; |
| 2 | + |
| 3 | +export class FilteringV1 { |
| 4 | + |
| 5 | + /** |
| 6 | + * Opens the filter dropdown for a specific column by triggering mouseover event |
| 7 | + * @param {number} column - Column index (default: 0) |
| 8 | + */ |
| 9 | + openFilter(column = 0){ |
| 10 | + cy.get(selectors.openFilter).eq(column).should('be.visible').trigger('mouseover') |
| 11 | + } |
| 12 | + |
| 13 | + /** |
| 14 | + * Displays the three dots filter menu for a specific column |
| 15 | + * @param {number} column - Column index (default: 0) |
| 16 | + */ |
| 17 | + displayDotFilter(column = 0){ |
| 18 | + cy.get(selectors.threeDots).eq(column).click({force:true}) |
| 19 | + } |
| 20 | + |
| 21 | + /** |
| 22 | + * Verifies that the filter modal is visible on the page |
| 23 | + */ |
| 24 | + filterModalIsVisible(){ |
| 25 | + cy.get(selectors.modalFilter).should('be.visible') |
| 26 | + } |
| 27 | + |
| 28 | + /** |
| 29 | + * Clicks a button within the filter modal |
| 30 | + * @param {string} buttonName - Button name to click ("Cancel"|"Apply"|"Clear", default: "Cancel") |
| 31 | + */ |
| 32 | + pressButtonModal(buttonName = "Cancel"){ |
| 33 | + cy.get(selectors.filterForm).within(() => { |
| 34 | + cy.contains('button', buttonName).click() |
| 35 | + }) |
| 36 | + } |
| 37 | + |
| 38 | + /** |
| 39 | + * Clicks the sort button with the specified action |
| 40 | + * @param {string} action - Sort action ("Sort Ascending"|"Sort Descending", default: "Sort Ascending") |
| 41 | + */ |
| 42 | + pressSortButton(action = "Sort Ascending"){ |
| 43 | + cy.get(selectors.sortButton).eq(0).contains('button', action).click() |
| 44 | + } |
| 45 | + |
| 46 | + /** |
| 47 | + * Fills the filter option dropdown for a specific row |
| 48 | + * @param {string} option - Filter option to select (default: "=") |
| 49 | + * @param {number} row - Row index (default: 0) |
| 50 | + */ |
| 51 | + fillFilter(option = "=", row = 0){ |
| 52 | + cy.get(selectors.optionFilter.replace('{row}', row)).select(option) |
| 53 | + } |
| 54 | + |
| 55 | + /** |
| 56 | + * Fills the filter value input field for a specific row |
| 57 | + * @param {string} value - Value to type in the input field (default: "") |
| 58 | + * @param {number} row - Row index (default: 0) |
| 59 | + */ |
| 60 | + fillValue(value = "", row = 0){ |
| 61 | + cy.get(selectors.valueFilter.replace('{row}', row)).type(value) |
| 62 | + |
| 63 | + } |
| 64 | + |
| 65 | + /** |
| 66 | + * Removes a filter for a specific row by clicking the remove button |
| 67 | + * @param {number} row - Row index (default: 0) |
| 68 | + */ |
| 69 | + removeFilter(row = 0){ |
| 70 | + cy.get(selectors.removeButtonModal.replace('{row}', row)).click() |
| 71 | + } |
| 72 | + |
| 73 | + /** |
| 74 | + * Adds a new filter row by clicking the add new filter button |
| 75 | + */ |
| 76 | + addNewFilter(){ |
| 77 | + cy.get(selectors.addNewFilterButton).parent().parent("button").click() |
| 78 | + } |
| 79 | +} |
0 commit comments