Skip to content

Commit

Permalink
[Visualization] Visual testing in scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
mialeska authored Mar 15, 2023
1 parent 5e6eb18 commit 739fdb9
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
}
}
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<dependencies>
<dependency>
<groupId>com.github.aquality-automation</groupId>
<artifactId>aquality-appium-mobile</artifactId>
<version>3.1.2</version>
<artifactId>aquality-appium-mobile</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
Expand Down

0 comments on commit 739fdb9

Please sign in to comment.