import { DewButton } from "../components/dewButton"; import { lmt } from '../Helpers/readI18NProp'; import { logger } from '../Logger/logger'; import { TextField } from "./textfield"; /** * Text filter class */ export class TextFilter { /** * To Apply filter on Input Box * * ```js * * TextFilter.filterByText("PO Number","Po_1234") * ``` * * @param {String} filterLabel // Enter The Label of the input element * @param {String} textValue // The value you need to enter in the input box * */ static async filterByText(filterLabel: string, textValue: string | number) { try { await TextField.enterTextUsingLocator(`.//div[label[text()='${filterLabel}']]/following-sibling::div//input| .//input[preceding-sibling::label[contains(text(),'${filterLabel}')]]| .//dew-text-filter[label[text()='${filterLabel}']]//input`, textValue); await DewButton.click(await lmt.getLabel(`Apply`)); } catch (error) { logger.log(`Issue while performing operation in DDCC: Error while applying text filter`); throw error; } } }