com.epam.jdi.bdd.stepdefs.MenuSteps Maven / Gradle / Ivy
package com.epam.jdi.bdd.stepdefs;
import com.epam.jdi.light.elements.complex.Menu;
import com.epam.jdi.light.elements.complex.WebList;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
import java.util.List;
import static com.epam.jdi.light.elements.init.entities.collection.EntitiesCollection.getList;
/**
* Created by Roman Iovlev on 26.09.2019
* Email: [email protected]; Skype: roman.iovlev
*/
public class MenuSteps {
public static WebList menu(String name) {
return getList(name, Menu.class);
}
@When("^(?:I |)select \"([^\"]*)\" in \"([^\"]*)\" menu$")
public void select(String value, String name) {
menu(name).select(value);
}
@When("^(?:I |)select items in \"([^\"]*)\" menu:$")
public void selectItems(String name, List values) {
for (String item : values)
menu(name).select(item);
}
@Then("^the \"([^\"]*)\" in \"([^\"]*)\" menu is selected$")
public void isSelected(String value, String name) {
menu(name).is().selected(value);
}
}