package ru.colibri.ui.steps.general;


import org.jbehave.core.annotations.Named;
import org.jbehave.core.annotations.When;
import org.springframework.stereotype.Component;
import ru.colibri.ui.core.steps.AbsSteps;
import ru.yandex.qatools.allure.annotations.Step;

@Component
public class ButtonsSteps extends AbsSteps {

    @Step
    @When("выполнено нажатие на \"$button\"")
    public void buttonClick(@Named("$button") String button) {
        getWebElementByName(button).click();
    }

    @Step
    @When("(Optional) выполнено нажатие на \"$button\"")
    public void optionalButtonClick(@Named("$button") String button) {
        try {
            buttonClick(button);
        } catch (Exception ignored) {
            System.out.println("Не нажато");
        }

    }
}

@@ -32,16 +32,58 @@
 eral;%0A%0A%0A
+import io.appium.java_client.TouchAction;%0A
 import o
@@ -117,16 +117,16 @@
 .Named;%0A
-
 import o
@@ -159,16 +159,55 @@
 s.When;%0A
+import org.openqa.selenium.WebElement;%0A
 import o
@@ -243,24 +243,67 @@
 .Component;%0A
+import ru.colibri.ui.core.fields.IElement;%0A
 import ru.co
@@ -383,16 +383,40 @@
 .Step;%0A%0A
+import java.util.List;%0A%0A
 @Compone
@@ -919,11 +919,672 @@
 %7D%0A%0A    %7D
+%0A%0A    @Step%0A    @When(%22%D0%B2%D1%8B%D0%BF%D0%BE%D0%BB%D0%BD%D0%B5%D0%BD %D0%BB%D0%BE%D0%BD%D0%B3%D1%82%D0%B0%D0%BF %D0%BD%D0%B0 %5C%22$button%5C%22%22)%0A    public void buttonLongtap(@Named(%22$button%22) String button) %7B%0A        new TouchAction(driver).longPress(getWebElementByName(button)).release().perform();%0A    %7D%0A%0A    @Step%0A    @When(%22%D0%B2%D1%8B%D0%BF%D0%BE%D0%BB%D0%BD%D0%B5%D0%BD %D0%BB%D0%BE%D0%BD%D0%B3%D1%82%D0%B0%D0%BF %D0%BD%D0%B0 %D1%8D%D0%BB%D0%B5%D0%BC%D0%B5%D0%BD%D1%82 %5C%22$fieldName%5C%22 %D1%81 %D0%B8%D0%BD%D0%B4%D0%B5%D0%BA%D1%81%D0%BE%D0%BC %5C%22$index%5C%22%22)%0A    public void listItemLongtap(String fieldName, int index) %7B%0A        IElement element = getCurrentPage().getElementByName(fieldName);%0A        List%3CWebElement%3E elementsFound = finder.findWebElements(element);%0A        WebElement firstElement = elementsFound.get(index);%0A        new TouchAction(driver).longPress(firstElement).release().perform();%0A    %7D
 %0A%7D%0A

add longtap steps