import { DewCheckbox } from "../dewCheckbox"; import { TextField } from "../textfield"; import { Wait } from "../dewWait"; /** * EProcValueFilter class */ export class EProcValueFilter { /** * To select all EProcValueFilteres * @param {String} filterHeader name of the checkbox collection header */ static async selectAll(filterHeader: string) { await within(`//div[div/div[contains(text(),'${filterHeader}')]]/following-sibling::div/eproc-value-filter`, async () => { await DewCheckbox.selectAll(); }); } /** * To Search and select a EProcValueFilter * @param {String} filterHeader name of the checkbox collection header * @param {String} filterToSelect name of the filter to select */ static async searchSelect(filterHeader: string, filterToSelect: string) { await within(`//div[div/div[contains(text(),'${filterHeader}')]]/following-sibling::div/eproc-value-filter`, async () => { // Enter name of EProcValueFilter to select in the search field await TextField.enterTextUsingLocator(`//input[@aria-label='Search And Select']`, filterToSelect); // Wait for 5 seconds to reduce the listed EProcValueFilteres list to EProcValueFilter(es) as per entered criteria await Wait.waitForDefaultTimeout(5); // TODO - verify listed EProcValueFilteres list reduces to EProcValueFilter(es) as per entered criteria await DewCheckbox.selectCheckbox(filterToSelect); }); } /** * To select a particular EProcValueFilter directly without searching * @param {String} filterHeader name of the checkbox collection header * @param {String} filterToSelect name of the filter to select */ static async directSelect(filterHeader: string, filterToSelect: string) { await within(`//div[div/div[contains(text(),'${filterHeader}')]]/following-sibling::div/eproc-value-filter`, async () => { await DewCheckbox.selectCheckbox(filterToSelect); }); } }