Skip to content

Instantly share code, notes, and snippets.

@maksimlaptev
Created June 19, 2023 11:51
Show Gist options
  • Save maksimlaptev/85b1ecd7f3d7dd511be1c21d940cdf59 to your computer and use it in GitHub Desktop.
Save maksimlaptev/85b1ecd7f3d7dd511be1c21d940cdf59 to your computer and use it in GitHub Desktop.
Working with steps (2 examples of step descriptions for the Allure report)
import io.qameta.allure.Step;
import screens.MainScreenLocators;
import static com.codeborne.selenide.Selenide.page;
import static io.qameta.allure.Allure.step;
import static org.testng.Assert.assertEquals;
/** This class describes the action steps for the Calculator screen. Step descriptions appear in the report for each test. **/
public class MainScreenSteps {
MainScreenLocators mainPage = page(MainScreenLocators.class);
@Step("Click on the Login button")
public void stepClickEquals(){
mainPage.equalsBtn.click();
}
public void stepClickOnNumber(String numb) {
step("Click on number "+ numb +"", ()-> { mainPage.numberBtn(numb).click();});
};
public void stepClickClearBtn() {
step("Click on Clear btn", ()-> { mainPage.clearBtn.click();});
}
public void stepVerifyFinalResult(String expectedResult){
step("Check final result", () -> {
assertEquals(mainPage.resultFinalField.getText(), expectedResult, "Final result must be correct.");
});
}
// Operation's btn
public void stepClickPlusBtn() {
step("Click on Plus btn", ()-> { mainPage.plusBtn.click();});
}
public void stepClickMinusBtn() {
step("Click on Minus btn", ()-> { mainPage.minusBtn.click();});
}
public void stepClickMultiplyBtn() {
step("Click on Multiply btn", ()-> { mainPage.multiplyBtn.click();});
}
public void stepClickDivideBtn() {
step("Click on Divide btn", ()-> { mainPage.divideBtn.click();});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment