
export default class ElementsActions {
    static async checkElementExistsAndIsDisplayed(element, pageName, elementName, waitTime = 3000) {
        await expect(element).toBeExisting({ wait: waitTime, message: '<' + pageName + '> ' + elementName + ' is not existing.' });
        await element.scrollIntoView();
        await expect(element).toBeDisplayed({ message: '<' + pageName + '> ' + elementName + ' is not displayed.' });
    }

    static async clickElement(element, pageName, elementName, waitTime = 1000) {
        await expect(element).toBeClickable({ wait: waitTime, message: '<' + pageName + '> ' + elementName + ' is not clickable.' });
        await element.click();
    }
    static async checkElementToHaveTextContaining(element, txt, elementName, waitTime = 1000) {
        await expect(element).toHaveTextContaining(txt, { wait: waitTime, message: '<' + elementName + '> contains a different text then expected one: ' + txt + ' ' });
    }
    static async checkElementToHaveText(element, txt, elementName, waitTime = 1000) {
        await expect(element).toHaveText(txt, { wait: waitTime, message: '<' + elementName + '> contains a different text then expected one: ' + txt + ' ' });
    }
}