From 6110536cf44b381d41e4ff208bae3cc79fa24961 Mon Sep 17 00:00:00 2001 From: AEkaterina Date: Mon, 2 Oct 2023 14:26:48 +0400 Subject: [PATCH] updated maven, pom, added locator for allure --- .github/workflows/maven.yml | 25 ++++++++++++++++-------- pom.xml | 27 ++++++++++++++++---------- src/test/java/features/Search.feature | 2 +- src/test/java/runners/TestRunner.java | 14 ++++++------- src/test/java/screens/AlertScreen.java | 10 +++++++--- src/test/resources/cucumber.properties | 1 + 6 files changed, 50 insertions(+), 29 deletions(-) create mode 100644 src/test/resources/cucumber.properties diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index c7b6c29..6fa27ae 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -47,15 +47,24 @@ jobs: run: mvn clean test -Daquality.buildName="${{github.event.inputs.build_name}}" -DdriverSettings.${{github.event.inputs.platform_name}}.deviceKey=${{github.event.inputs.device_name_and_version}} -Daquality.suiteName="${{github.event.inputs.platform_name}} - ${{github.event.inputs.test_tag}}" -Daquality.environment="${{github.event.inputs.platform_name}}" -Dcredentials.LYRASISReads."ios".${{secrets.BookCardLyrasis1}}=${{secrets.BookPinLyrasis1}} -Dcredentials.LYRASISReads."ios".${{secrets.BookCardLyrasis2}}=${{secrets.BookPinLyrasis2}} -Dcredentials.LYRASISReads."ios".${{secrets.BookCardLyrasis3}}=${{secrets.BookPinLyrasis3}} -Dcredentials.LYRASISReads."ios".${{secrets.BookCardLyrasis4}}=${{secrets.BookPinLyrasis4}} -Dcredentials.LYRASISReads."android".${{secrets.BookCardLyrasis1}}=${{secrets.BookPinLyrasis1}} -Dcredentials.LYRASISReads."android".${{secrets.BookCardLyrasis2}}=${{secrets.BookPinLyrasis2}} -Dcredentials.LYRASISReads."android".${{secrets.BookCardLyrasis3}}=${{secrets.BookPinLyrasis3}} -Dcredentials.LYRASISReads."android".${{secrets.BookCardLyrasis4}}=${{secrets.BookPinLyrasis4}} -Dcredentials.A1QATestLibrary."ios".${{secrets.BookCardLyrasis1}}=${{secrets.BookPinLyrasis1}} -Dcredentials.A1QATestLibrary."ios".${{secrets.BookCardLyrasis2}}=${{secrets.BookPinLyrasis2}} -Dcredentials.A1QATestLibrary."ios".${{secrets.BookCardLyrasis3}}=${{secrets.BookPinLyrasis3}} -Dcredentials.A1QATestLibrary."ios".${{secrets.BookCardLyrasis4}}=${{secrets.BookPinLyrasis4}} -Dcredentials.A1QATestLibrary."android".${{secrets.BookCardLyrasis1}}=${{secrets.BookPinLyrasis1}} -Dcredentials.A1QATestLibrary."android".${{secrets.BookCardLyrasis2}}=${{secrets.BookPinLyrasis2}} -Dcredentials.A1QATestLibrary."android".${{secrets.BookCardLyrasis3}}=${{secrets.BookPinLyrasis3}} -Dcredentials.A1QATestLibrary."android".${{secrets.BookCardLyrasis4}}=${{secrets.BookPinLyrasis4}} -DremoteConnectionUrl=${{secrets.remoteConnectionUrl}} -DdriverSettings.${{github.event.inputs.platform_name}}.capabilities."browserstack.user"=${{secrets.BROWSERSTACK_USER}} -DdriverSettings.${{github.event.inputs.platform_name}}.capabilities."browserstack.key"=${{secrets.BROWSERSTACK_KEY}} -DplatformName=${{github.event.inputs.platform_name}} -DdriverSettings.${{github.event.inputs.platform_name}}.capabilities.app=${{github.event.inputs.bs_app_link}} -Dcucumber.options="--tags '(${{github.event.inputs.test_tag}} and not @ignore) and not @exclude_${{github.event.inputs.platform_name}}'" continue-on-error: true - - name: Generate Allure Report - uses: AEkaterina/action-allure-report@v0.1.1 - if: success() || failure() - - name: Upload report - uses: actions/upload-artifact@v3 + - name: Generate Cucumber JSON Report + run: mvn exec:java -Dexec.mainClass="io.cucumber.core.cli.Main" -Dexec.args="--plugin json:target/cucumber-report.json src/test/resources" + + - name: Upload Cucumber JSON Report + uses: actions/upload-artifact@v2 with: - name: allure-report - path: allure-report/ - if: success() || failure() + name: cucumber-report + path: target/cucumber-report.json + +# - name: Generate Allure Report +# uses: AEkaterina/action-allure-report@v0.1.1 +# if: success() || failure() +# - name: Upload report +# uses: actions/upload-artifact@v3 +# with: +# name: allure-report +# path: allure-report/ +# if: success() || failure() # - name: Get Allure history # uses: actions/checkout@v3 diff --git a/pom.xml b/pom.xml index a496c21..6eaf76d 100644 --- a/pom.xml +++ b/pom.xml @@ -28,11 +28,11 @@ - - io.qameta.allure - allure-maven - 2.10.0 - + + + + + org.apache.maven.plugins @@ -106,11 +106,11 @@ ${cucumber.version} - - io.qameta.allure - allure-cucumber5-jvm - 2.13.2 - + + + + + com.squareup.retrofit2 @@ -154,5 +154,12 @@ 1.3.1 + + net.masterthought + cucumber-reporting + 5.7.6 + test + + \ No newline at end of file diff --git a/src/test/java/features/Search.feature b/src/test/java/features/Search.feature index be0384e..48073d6 100644 --- a/src/test/java/features/Search.feature +++ b/src/test/java/features/Search.feature @@ -1,6 +1,6 @@ Feature: Search module - @allure + @cucumber Scenario: Find a library and delete it When Close tutorial screen And Close welcome screen diff --git a/src/test/java/runners/TestRunner.java b/src/test/java/runners/TestRunner.java index 0fe1d01..50c9111 100644 --- a/src/test/java/runners/TestRunner.java +++ b/src/test/java/runners/TestRunner.java @@ -15,10 +15,10 @@ "hooks", "stepdefinitions" }, - plugin = { - "io.qameta.allure.cucumber5jvm.AllureCucumber5Jvm" - }, - tags = "@allure" +// plugin = { +// "io.qameta.allure.cucumber5jvm.AllureCucumber5Jvm" +// }, + tags = "@cucumber" ) public class TestRunner { @@ -26,9 +26,9 @@ public class TestRunner { @BeforeClass public static void setup() { AqualityServices.getLogger().info("Start getting books"); - XMLUtil xmlUtil = new XMLUtil(); - GettingBookUtil.setXmlUtil(xmlUtil); - GettingBookUtil.printDistributorsInfo(); +// XMLUtil xmlUtil = new XMLUtil(); +// GettingBookUtil.setXmlUtil(xmlUtil); +// GettingBookUtil.printDistributorsInfo(); AqualityServices.getLogger().info("end getting books"); } } diff --git a/src/test/java/screens/AlertScreen.java b/src/test/java/screens/AlertScreen.java index 950bf6d..658089f 100644 --- a/src/test/java/screens/AlertScreen.java +++ b/src/test/java/screens/AlertScreen.java @@ -14,8 +14,10 @@ public class AlertScreen extends Screen{ private static final String UNIQUE_ELEMENT_LOCATOR_IOS = "//XCUIElementTypeAlert"; private static final String ACTION_BUTTON_LOCATOR_IOS = UNIQUE_ELEMENT_LOCATOR_IOS + "//XCUIElementTypeButton[@name=\"%s\"]"; + private static final String ACTION_BUTTON_LOCATOR_ANDROID = "//android.widget.LinearLayout/android.widget.Button[@text=\"%s\"]"; + private final ILabel lblAlertMessage = getElementFactory().getLabel(LocatorUtils.getLocator( - new AndroidLocator(By.xpath("")), + new AndroidLocator(By.id("permission_message")), new IosLocator(By.xpath(UNIQUE_ELEMENT_LOCATOR_IOS + "//XCUIElementTypeScrollView/XCUIElementTypeOther/XCUIElementTypeStaticText[1]"))), "Alert message"); private final ILabel lblNotificationAlert = getElementFactory().getLabel(LocatorUtils.getLocator( new AndroidLocator(By.xpath("")), @@ -23,12 +25,14 @@ public class AlertScreen extends Screen{ public AlertScreen() { super(LocatorUtils.getLocator( - new AndroidLocator(By.xpath("")), + new AndroidLocator(By.xpath("//android.widget.LinearLayout[contains(@resource-id, \"grant_dialog\")]")), new IosLocator(By.xpath("//XCUIElementTypeAlert"))), "Alert screen"); } public void waitAndPerformAlertActionIfDisplayed(ActionButtonsForBooksAndAlertsKeys actionButtonNamesAlertKeys) { - IButton actionButton = getElementFactory().getButton(By.xpath(String.format(ACTION_BUTTON_LOCATOR_IOS, actionButtonNamesAlertKeys.getDefaultLocalizedValue())), String.format("%s Action button alert", actionButtonNamesAlertKeys.getDefaultLocalizedValue())); + IButton actionButton = getElementFactory().getButton(LocatorUtils.getLocator( + new AndroidLocator(By.xpath(String.format(ACTION_BUTTON_LOCATOR_ANDROID, actionButtonNamesAlertKeys.getDefaultLocalizedValue()))), + new IosLocator(By.xpath(String.format(ACTION_BUTTON_LOCATOR_IOS, actionButtonNamesAlertKeys.getDefaultLocalizedValue())))), String.format("%s Action button alert", actionButtonNamesAlertKeys.getDefaultLocalizedValue())); if(actionButton.state().waitForDisplayed()){ actionButton.click(); } diff --git a/src/test/resources/cucumber.properties b/src/test/resources/cucumber.properties new file mode 100644 index 0000000..d1a5355 --- /dev/null +++ b/src/test/resources/cucumber.properties @@ -0,0 +1 @@ +cucumber.options=--plugin json:target/cucumber-report.json