diff --git a/aquality-appium-mobile-template-cucumber/src/test/java/aquality/appium/mobile/template/cucumber/features/Demo.feature b/aquality-appium-mobile-template-cucumber/src/test/java/aquality/appium/mobile/template/cucumber/features/Demo.feature index b5e4b31..262d1f6 100644 --- a/aquality-appium-mobile-template-cucumber/src/test/java/aquality/appium/mobile/template/cucumber/features/Demo.feature +++ b/aquality-appium-mobile-template-cucumber/src/test/java/aquality/appium/mobile/template/cucumber/features/Demo.feature @@ -4,12 +4,15 @@ Feature: Demo @demo Scenario: I try to login with invalid credentials - Given I open 'Login Screen' view + When I open 'Login Screen' view Then Login Screen is opened - When I log in with data: + When I save Login Screen dump + And I log in with data: | Username | MyUsername | | Password | InVal1dPa$$w0rd | Then 'Invalid login credentials, please try again' alert appears + When I accept the alert + Then Login Screen dump is different @demo Scenario Outline: ScenarioContext demo diff --git a/aquality-appium-mobile-template-cucumber/src/test/java/aquality/appium/mobile/template/cucumber/stepdefinitions/ChooseViewSteps.java b/aquality-appium-mobile-template-cucumber/src/test/java/aquality/appium/mobile/template/cucumber/stepdefinitions/ChooseViewSteps.java index f6f547e..1c5c2e6 100644 --- a/aquality-appium-mobile-template-cucumber/src/test/java/aquality/appium/mobile/template/cucumber/stepdefinitions/ChooseViewSteps.java +++ b/aquality-appium-mobile-template-cucumber/src/test/java/aquality/appium/mobile/template/cucumber/stepdefinitions/ChooseViewSteps.java @@ -2,7 +2,7 @@ import aquality.appium.mobile.screens.screenfactory.IScreenFactory; import aquality.appium.mobile.template.screens.chooseview.ChooseViewScreen; -import io.cucumber.java.en.Given; +import io.cucumber.java.en.When; import javax.inject.Inject; @@ -15,7 +15,7 @@ public ChooseViewSteps(IScreenFactory screenFactory) { chooseViewScreen = screenFactory.getScreen(ChooseViewScreen.class); } - @Given("I open '{}' view") + @When("I open '{}' view") public void iOpenView(String viewName) { chooseViewScreen.openView(viewName); } diff --git a/aquality-appium-mobile-template-cucumber/src/test/java/aquality/appium/mobile/template/cucumber/stepdefinitions/CommonSteps.java b/aquality-appium-mobile-template-cucumber/src/test/java/aquality/appium/mobile/template/cucumber/stepdefinitions/CommonSteps.java index 5843327..721253e 100644 --- a/aquality-appium-mobile-template-cucumber/src/test/java/aquality/appium/mobile/template/cucumber/stepdefinitions/CommonSteps.java +++ b/aquality-appium-mobile-template-cucumber/src/test/java/aquality/appium/mobile/template/cucumber/stepdefinitions/CommonSteps.java @@ -5,6 +5,7 @@ import aquality.appium.mobile.template.screens.Alert; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; import io.qameta.allure.Allure; import io.qameta.allure.model.Parameter; @@ -42,4 +43,9 @@ public void alertAppears(String alertMessage) { assertTrue(alert.state().waitForDisplayed(), "Alert appeared"); assertEquals(alert.getMessage(), alertMessage, "Alert message is correct"); } + + @When("I accept the alert") + public void acceptAlert() { + alert.tapOk(); + } } diff --git a/aquality-appium-mobile-template-cucumber/src/test/java/aquality/appium/mobile/template/cucumber/stepdefinitions/LoginSteps.java b/aquality-appium-mobile-template-cucumber/src/test/java/aquality/appium/mobile/template/cucumber/stepdefinitions/LoginSteps.java index 69b3aae..bc571dd 100644 --- a/aquality-appium-mobile-template-cucumber/src/test/java/aquality/appium/mobile/template/cucumber/stepdefinitions/LoginSteps.java +++ b/aquality-appium-mobile-template-cucumber/src/test/java/aquality/appium/mobile/template/cucumber/stepdefinitions/LoginSteps.java @@ -31,4 +31,14 @@ public void iFillInLoginForm(@Transpose LoginModel loginModel) { public void loginScreenIsOpened() { assertTrue(loginScreen.state().waitForDisplayed(), "Login Screen is opened"); } + + @When("I save Login Screen dump") + public void saveLoginScreenDump() { + loginScreen.dump().save(); + } + + @Then("Login Screen dump is different") + public void loginScreenDumpIsDifferent() { + assertTrue(loginScreen.dump().compare() > 0, "The form dump should differ"); + } } diff --git a/aquality-appium-mobile-template/src/main/resources/settings.json b/aquality-appium-mobile-template/src/main/resources/settings.json index d106b42..74a0ba6 100644 --- a/aquality-appium-mobile-template/src/main/resources/settings.json +++ b/aquality-appium-mobile-template/src/main/resources/settings.json @@ -64,5 +64,13 @@ "verticalOffset": 0.2, "horizontalOffset": 0.5 } + }, + "visualization": { + "imageExtension": "png", + "maxFullFileNameLength": 255, + "defaultThreshold": 0.012, + "comparisonWidth": 16, + "comparisonHeight": 16, + "pathToDumps": "./src/test/resources/visualDumps/" } } diff --git a/pom.xml b/pom.xml index 9be1312..76c5cdb 100644 --- a/pom.xml +++ b/pom.xml @@ -29,8 +29,8 @@ com.github.aquality-automation - aquality-appium-mobile - 3.1.2 + aquality-appium-mobile + 4.0.0 org.projectlombok