All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.n2oapp.framework.autotest.impl.collection.N2oCells Maven / Gradle / Ivy

package net.n2oapp.framework.autotest.impl.collection;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.SelenideElement;
import com.codeborne.selenide.WebElementCondition;
import net.n2oapp.framework.autotest.Colors;
import net.n2oapp.framework.autotest.api.collection.Cells;
import net.n2oapp.framework.autotest.api.component.cell.Cell;
import net.n2oapp.framework.autotest.api.component.cell.TextCell;


import static net.n2oapp.framework.autotest.N2oSelenide.component;

public class N2oCells extends N2oComponentsCollection implements Cells {

    private static final String ROW_CLICK_ATTRIBUTE = "data-has-click";

    @Override
    public TextCell cell(int index) {
        return component(elements().get(index), TextCell.class);
    }

    @Override
    public  T cell(int index, Class componentClass) {
        return component(elements().get(index), componentClass);
    }

    @Override
    public  T cell(WebElementCondition findBy, Class componentClass) {
        return component(elements().findBy(findBy), componentClass);
    }

    @Override
    public void click() {
        row().click();
    }

    @Override
    public void hover() {
        row().hover();
    }

    @Override
    public void shouldHaveColor(Colors color) {
        row().shouldHave(Condition.cssClass(color.name("bg-")));
    }

    protected SelenideElement row() {
        return elements().get(0).parent();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy