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

com.epam.jdi.bdd.BDDUtils Maven / Gradle / Ivy

There is a newer version: 1.6.0
Show newest version
package com.epam.jdi.bdd;

import com.epam.jdi.light.asserts.core.IsAssert;
import com.epam.jdi.light.asserts.generic.*;
import com.epam.jdi.light.elements.common.Label;
import com.epam.jdi.light.elements.common.UIElement;
import com.epam.jdi.light.elements.interfaces.base.HasLabel;
import com.epam.jdi.light.elements.interfaces.common.IsInput;
import com.jdiai.tools.map.MapArray;
import cucumber.api.DataTable;

import static com.epam.jdi.light.elements.init.entities.collection.EntitiesCollection.getUI;

/**
 * Created by Roman Iovlev on 26.09.2019
 * Email: [email protected]; Skype: roman.iovlev
 */
public final class BDDUtils {
    private BDDUtils() {
    }

    public static MapArray getMapFromTable(DataTable table) {
        return new MapArray<>(table.getGherkinRows(),
                r -> r.getCells().get(0), r -> r.getCells().get(1));
    }

    public static UIElement core(String name) {
        return getUI(name).core();
    }

    public static IsAssert isAssert(String name) {
        return getUI(name).core().is();
    }

    public static SelectedAssert selectedAssert(String name) {
        return ((HasAssert) getAssert(name)).is();
    }

    public static CommonAssert uiAssert(String name) {
        return ((HasAssert) getAssert(name)).is();
    }

    public static UISelectAssert selectAssert(String name) {
        return ((HasAssert) getAssert(name)).is();
    }

    static HasAssert getAssert(String name) {
        return getUI(name, HasAssert.class);
    }

    public static IsInput input(String name) {
        return getUI(name, IsInput.class);
    }

    public static Label label(String name) {
        return getUI(name, HasLabel.class).label();
    }

    public static ITextAssert textAssert(String name) {
        return (ITextAssert) getUI(name, HasAssert.class).is();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy