-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework test name listener to correct name in allure report
- Loading branch information
Showing
7 changed files
with
60 additions
and
72 deletions.
There are no files selected for viewing
2 changes: 0 additions & 2 deletions
2
...ate-cucumber/src/test/java/aquality/appium/mobile/template/cucumber/features/Demo.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...er/src/test/java/aquality/appium/mobile/template/cucumber/stepdefinitions/AlertSteps.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package aquality.appium.mobile.template.cucumber.stepdefinitions; | ||
|
||
import aquality.appium.mobile.screens.screenfactory.IScreenFactory; | ||
import aquality.appium.mobile.template.screens.Alert; | ||
import io.cucumber.java.en.Then; | ||
import io.cucumber.java.en.When; | ||
|
||
import javax.inject.Inject; | ||
|
||
import static org.testng.Assert.assertEquals; | ||
import static org.testng.Assert.assertTrue; | ||
|
||
public class AlertSteps { | ||
|
||
private final Alert alert; | ||
|
||
@Inject | ||
public AlertSteps(IScreenFactory screenFactory) { | ||
alert = screenFactory.getScreen(Alert.class); | ||
} | ||
|
||
@Then("'{}' alert appears") | ||
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(); | ||
} | ||
} |
51 changes: 0 additions & 51 deletions
51
...r/src/test/java/aquality/appium/mobile/template/cucumber/stepdefinitions/CommonSteps.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 0 additions & 16 deletions
16
...stng/src/test/java/aquality/appium/mobile/template/testng/utilities/TestNameListener.java
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
...bile-template/src/main/java/aquality/appium/mobile/template/utilities/AllureListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package aquality.appium.mobile.template.utilities; | ||
|
||
import aquality.appium.mobile.application.AqualityServices; | ||
import io.qameta.allure.listener.TestLifecycleListener; | ||
import io.qameta.allure.model.Parameter; | ||
import io.qameta.allure.model.TestResult; | ||
|
||
import java.util.List; | ||
|
||
public class AllureListener implements TestLifecycleListener { | ||
|
||
public void afterTestStart(TestResult result) { | ||
List<Parameter> oldParameters = result.getParameters(); | ||
Parameter parameter = new Parameter(); | ||
parameter.setName("platform"); | ||
parameter.setValue(AqualityServices.getApplicationProfile().getPlatformName().toString()); | ||
oldParameters.add(parameter); | ||
result.setHistoryId(result.getHistoryId() + parameter.getValue()); | ||
String oldName = result.getFullName(); | ||
result.setFullName(String.format("%s: %s", oldName, parameter.getValue())); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...late/src/main/resources/META-INF/services/io.qameta.allure.listener.TestLifecycleListener
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
aquality.appium.mobile.template.utilities.AllureListener |