From a81d61c2cd1ab68e3b8fa1f018cbed4c2844a8e2 Mon Sep 17 00:00:00 2001 From: Olha Omelianchuk Date: Tue, 25 Oct 2022 09:43:51 +0200 Subject: [PATCH 01/17] update Neodymium version to 4.1.4 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1b52abb..498b71c 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ 2.22.2 1.9.6 2.10.0 - 4.1.3 + 4.1.4 2.0.21 From 6796a04710cac0b3610739fa36a1b0c344cb2913 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Oct 2022 07:44:42 +0000 Subject: [PATCH 02/17] Bump pdfbox from 2.0.21 to 2.0.24 Bumps pdfbox from 2.0.21 to 2.0.24. --- updated-dependencies: - dependency-name: org.apache.pdfbox:pdfbox dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 498b71c..13c1e11 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ 1.9.6 2.10.0 4.1.4 - 2.0.21 + 2.0.24 From 620c61d63b5c9a3eaf9d8a3568e01bbcf2cee6d6 Mon Sep 17 00:00:00 2001 From: Olha Omelianchuk Date: Wed, 14 Dec 2022 15:31:55 +0100 Subject: [PATCH 03/17] bump Neodymium to 4.1.5 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 13c1e11..f25ca71 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ 2.22.2 1.9.6 2.10.0 - 4.1.4 + 4.1.5 2.0.24 From a10578310136eb3ac7d9ee0f968ca1292dfc1295 Mon Sep 17 00:00:00 2001 From: Olha Omelianchuk Date: Tue, 25 Jun 2024 11:48:41 +0200 Subject: [PATCH 04/17] bump to Neodymium 5.0.0 --- pom.xml | 18 ++++++++++++------ .../showcase/neodymium/tests/AbstractTest.java | 9 +-------- .../data/AccessDataViaDataObjectsTest.java | 8 ++++---- .../AccessDataViaDataSetAnnotationTest.java | 9 +++++---- .../tests/data/AccessDataViaDataUtilsTest.java | 13 ++++++------- .../tests/data/AccessDataViaJsonPathTest.java | 15 +++++++-------- .../tests/data/DataFilePriotityTest.java | 7 +++---- .../iframe/SelenideSwitchToFrameTest.java | 5 ++--- .../NeodymiumLocalizationTest.java | 5 ++--- .../tests/logging/LoggingFirstTest.java | 9 ++++----- .../tests/logging/LoggingSecondTest.java | 6 +++--- .../tests/pdf/PdfTextContentCheckTest.java | 4 ++-- .../tests/random/FixedRandomTest.java | 9 ++++----- .../tests/random/RandomJobOffersTest.java | 8 ++++---- .../tests/random/RandomProbabilityTest.java | 6 +++--- .../tests/responsive/MobileDeviceTest.java | 7 +++---- .../tests/shadowdom/ShadowDomCheckboxTest.java | 3 ++- .../tests/shadowdom/ShadowDomTextTest.java | 5 ++--- .../neodymium/tests/slider/SliderTest.java | 5 +++-- .../neodymium/tests/xcmailr/XCMailrTest.java | 16 ++++++++-------- 20 files changed, 80 insertions(+), 87 deletions(-) diff --git a/pom.xml b/pom.xml index f25ca71..1cf96be 100644 --- a/pom.xml +++ b/pom.xml @@ -25,12 +25,12 @@ UTF-8 - 11 - 11 + 17 + 17 2.22.2 - 1.9.6 - 2.10.0 - 4.1.5 + 1.9.21 + 2.12.0 + 5.0.0 2.0.24 @@ -89,7 +89,7 @@ - 11 + 17 @@ -117,6 +117,12 @@ neodymium-plugin-xcmailr 1.1.3 + + org.apache.logging.log4j + log4j-slf4j2-impl + 2.23.1 + test + diff --git a/src/test/java/showcase/neodymium/tests/AbstractTest.java b/src/test/java/showcase/neodymium/tests/AbstractTest.java index aa36eec..4d4a0ec 100644 --- a/src/test/java/showcase/neodymium/tests/AbstractTest.java +++ b/src/test/java/showcase/neodymium/tests/AbstractTest.java @@ -1,14 +1,7 @@ package showcase.neodymium.tests; -import org.junit.runner.RunWith; +import com.xceptance.neodymium.common.browser.Browser; -import com.xceptance.neodymium.NeodymiumRunner; -import com.xceptance.neodymium.module.statement.browser.multibrowser.Browser; - -/** - * @author pfotenhauer - */ -@RunWith(NeodymiumRunner.class) @Browser("Chrome_1024x768") public abstract class AbstractTest { diff --git a/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataObjectsTest.java b/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataObjectsTest.java index f34c703..aaf2c50 100644 --- a/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataObjectsTest.java +++ b/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataObjectsTest.java @@ -1,7 +1,7 @@ package showcase.neodymium.tests.data; +import static com.codeborne.selenide.CollectionCondition.size; import static com.codeborne.selenide.Condition.matchText; -import static com.codeborne.selenide.Condition.matchesText; import static com.codeborne.selenide.Selenide.$; import static com.codeborne.selenide.Selenide.$$; @@ -49,13 +49,13 @@ public void test() for (ServiceTile serviceTile : testDataHomePage.getServiceTiles()) { // check heading with its position - $$(".caption .icon>h2").get(serviceTile.getPosition()).should(matchesText(serviceTile.getHeading())); + $$(".caption .icon>h2").get(serviceTile.getPosition()).should(matchText(serviceTile.getHeading())); // check explanation text with its position - $$(".caption > p").get(serviceTile.getPosition()).should(matchesText(serviceTile.getExplanation())); + $$(".caption > p").get(serviceTile.getPosition()).should(matchText(serviceTile.getExplanation())); } // check the number of services - $$(".caption").shouldHaveSize(testDataHomePage.getNumberServices()); + $$(".caption").shouldHave(size(testDataHomePage.getNumberServices())); } } diff --git a/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataSetAnnotationTest.java b/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataSetAnnotationTest.java index c17708a..a86cbaa 100644 --- a/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataSetAnnotationTest.java +++ b/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataSetAnnotationTest.java @@ -6,8 +6,9 @@ import org.junit.Test; import com.codeborne.selenide.Selenide; -import com.xceptance.neodymium.module.statement.testdata.DataSet; -import com.xceptance.neodymium.module.statement.testdata.SuppressDataSets; +import com.xceptance.neodymium.common.testdata.DataSet; +import com.xceptance.neodymium.common.testdata.SuppressDataSets; +import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.DataUtils; import io.qameta.allure.Description; @@ -33,7 +34,7 @@ public void noDataSets() $(".landing-intro>h1").should(matchText("Committed to Software Quality")); } - @Test + @NeodymiumTest // overrides the class level @SuppressDataSets to run only the first data set @DataSet(1) public void onlyFirstDataSet() @@ -46,7 +47,7 @@ public void onlyFirstDataSet() $(".landing-intro>p").should(matchText(DataUtils.asString("description"))); } - @Test + @NeodymiumTest // overrides the class level @SuppressDataSets to run all data sets @DataSet public void allDataSets() diff --git a/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataUtilsTest.java b/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataUtilsTest.java index f7a495c..3fc23ae 100644 --- a/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataUtilsTest.java +++ b/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataUtilsTest.java @@ -1,13 +1,12 @@ package showcase.neodymium.tests.data; +import static com.codeborne.selenide.CollectionCondition.size; import static com.codeborne.selenide.Condition.matchText; -import static com.codeborne.selenide.Condition.matchesText; import static com.codeborne.selenide.Selenide.$; import static com.codeborne.selenide.Selenide.$$; -import org.junit.Test; - import com.codeborne.selenide.Selenide; +import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.DataUtils; import io.qameta.allure.Description; @@ -23,7 +22,7 @@ @Tag("direct test data access") public class AccessDataViaDataUtilsTest extends AbstractTest { - @Test + @NeodymiumTest @Description(value = "Get test data using DataUtils methods") public void test() { @@ -41,16 +40,16 @@ public void test() while (DataUtils.exists("serviceTile_" + i + "_heading")) { // check heading text - $$(".caption .icon>h2").get(i).should(matchesText(DataUtils.asString("serviceTile_" + i + "_heading"))); + $$(".caption .icon>h2").get(i).should(matchText(DataUtils.asString("serviceTile_" + i + "_heading"))); // check explanation text - $$(".caption > p").get(i).should(matchesText(DataUtils.asString("serviceTile_" + i + "_explanation"))); + $$(".caption > p").get(i).should(matchText(DataUtils.asString("serviceTile_" + i + "_explanation"))); // next serviceTile i++; } // check the number of services using an integer value provided by DataUtils - $$(".caption").shouldHaveSize(DataUtils.asInt("numberServices")); + $$(".caption").shouldHave(size(DataUtils.asInt("numberServices"))); } } diff --git a/src/test/java/showcase/neodymium/tests/data/AccessDataViaJsonPathTest.java b/src/test/java/showcase/neodymium/tests/data/AccessDataViaJsonPathTest.java index ca05e78..2a0c5f0 100644 --- a/src/test/java/showcase/neodymium/tests/data/AccessDataViaJsonPathTest.java +++ b/src/test/java/showcase/neodymium/tests/data/AccessDataViaJsonPathTest.java @@ -1,14 +1,13 @@ package showcase.neodymium.tests.data; +import static com.codeborne.selenide.CollectionCondition.size; import static com.codeborne.selenide.Condition.matchText; -import static com.codeborne.selenide.Condition.matchesText; import static com.codeborne.selenide.Selenide.$; import static com.codeborne.selenide.Selenide.$$; -import org.junit.Test; - import com.codeborne.selenide.Selenide; -import com.xceptance.neodymium.module.statement.testdata.DataFile; +import com.xceptance.neodymium.common.testdata.DataFile; +import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.DataUtils; import io.qameta.allure.Description; @@ -30,7 +29,7 @@ public class AccessDataViaJsonPathTest extends AbstractTest { - @Test + @NeodymiumTest @Description(value = "Get test data using DataUtils.get method with jsonPath") public void test() { @@ -48,15 +47,15 @@ public void test() ServiceTile serviceTile = DataUtils.get("$.serviceTiles[2]", ServiceTile.class); // check the heading with the right text - $$(".caption .icon>h2").get(2).should(matchesText(serviceTile.getHeading())); + $$(".caption .icon>h2").get(2).should(matchText(serviceTile.getHeading())); // check explanation with the right text - $$(".caption > p").get(2).should(matchesText(serviceTile.getExplanation())); + $$(".caption > p").get(2).should(matchText(serviceTile.getExplanation())); // get integer test data using DataUtils.get() via JsonPath int numberServices = DataUtils.get("$.numberServices", Integer.class); // check the number of services - $$(".caption").shouldHaveSize(numberServices); + $$(".caption").shouldHave(size(numberServices)); } } diff --git a/src/test/java/showcase/neodymium/tests/data/DataFilePriotityTest.java b/src/test/java/showcase/neodymium/tests/data/DataFilePriotityTest.java index db171d7..94c57d8 100644 --- a/src/test/java/showcase/neodymium/tests/data/DataFilePriotityTest.java +++ b/src/test/java/showcase/neodymium/tests/data/DataFilePriotityTest.java @@ -3,10 +3,9 @@ import static com.codeborne.selenide.Condition.matchText; import static com.codeborne.selenide.Selenide.$; -import org.junit.Test; - import com.codeborne.selenide.Selenide; -import com.xceptance.neodymium.module.statement.testdata.DataSet; +import com.xceptance.neodymium.common.testdata.DataSet; +import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.Neodymium; import io.qameta.allure.Description; @@ -24,7 +23,7 @@ @Tag("direct test data access") public class DataFilePriotityTest extends AbstractTest { - @Test + @NeodymiumTest @Description(value = "Get test data using Neodymium.dataValue method") // these data sets are defined in DataFilePriotityTest.csv not in DataFilePriotityTest.json @DataSet(id = "en/CSV test data access using Neodymium.dataValue method") diff --git a/src/test/java/showcase/neodymium/tests/iframe/SelenideSwitchToFrameTest.java b/src/test/java/showcase/neodymium/tests/iframe/SelenideSwitchToFrameTest.java index cae384b..fff9b4d 100644 --- a/src/test/java/showcase/neodymium/tests/iframe/SelenideSwitchToFrameTest.java +++ b/src/test/java/showcase/neodymium/tests/iframe/SelenideSwitchToFrameTest.java @@ -4,10 +4,9 @@ import static com.codeborne.selenide.Selenide.$; import static com.codeborne.selenide.Selenide.switchTo; -import org.junit.Test; - import com.codeborne.selenide.Selenide; import com.codeborne.selenide.SelenideElement; +import com.xceptance.neodymium.junit5.NeodymiumTest; import io.qameta.allure.Description; import io.qameta.allure.junit4.Tag; @@ -20,7 +19,7 @@ @Tag("iFrame") public class SelenideSwitchToFrameTest extends AbstractTest { - @Test + @NeodymiumTest @Description(value = "Showcase for iFrames.") public void test() { diff --git a/src/test/java/showcase/neodymium/tests/localization/NeodymiumLocalizationTest.java b/src/test/java/showcase/neodymium/tests/localization/NeodymiumLocalizationTest.java index 5ff2378..9b8eb2e 100644 --- a/src/test/java/showcase/neodymium/tests/localization/NeodymiumLocalizationTest.java +++ b/src/test/java/showcase/neodymium/tests/localization/NeodymiumLocalizationTest.java @@ -4,10 +4,9 @@ import static com.codeborne.selenide.Condition.visible; import static com.codeborne.selenide.Selenide.$; -import org.junit.Test; - import com.codeborne.selenide.Selenide; import com.codeborne.selenide.SelenideElement; +import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.Neodymium; import io.qameta.allure.Description; @@ -32,7 +31,7 @@ @Tag("localization") public class NeodymiumLocalizationTest extends AbstractTest { - @Test + @NeodymiumTest @Description(value = "Neodymium localization show case") public void test() { diff --git a/src/test/java/showcase/neodymium/tests/logging/LoggingFirstTest.java b/src/test/java/showcase/neodymium/tests/logging/LoggingFirstTest.java index 90c0bcb..443a28a 100644 --- a/src/test/java/showcase/neodymium/tests/logging/LoggingFirstTest.java +++ b/src/test/java/showcase/neodymium/tests/logging/LoggingFirstTest.java @@ -2,9 +2,9 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.junit.Test; -import com.xceptance.neodymium.module.statement.browser.multibrowser.SuppressBrowsers; +import com.xceptance.neodymium.common.browser.SuppressBrowsers; +import com.xceptance.neodymium.junit5.NeodymiumTest; import io.qameta.allure.Description; import showcase.neodymium.tests.AbstractTest; @@ -20,9 +20,9 @@ @SuppressBrowsers public class LoggingFirstTest extends AbstractTest { - private static final Logger logger = LogManager.getLogger(LoggingFirstTest.class); + private static final Logger logger = LogManager.getLogger(LoggingSecondTest.class); - @Test + @NeodymiumTest @Description("Showcase for logging with log4j2.") public void testFirstLogging() { @@ -32,6 +32,5 @@ public void testFirstLogging() logger.info("LoggingFirstTest - Info"); logger.warn("LoggingFirstTest - Warn"); logger.error("LoggingFirstTest - Error"); - logger.fatal("LoggingFirstTest - Fatal"); } } diff --git a/src/test/java/showcase/neodymium/tests/logging/LoggingSecondTest.java b/src/test/java/showcase/neodymium/tests/logging/LoggingSecondTest.java index 26748aa..ef0f478 100644 --- a/src/test/java/showcase/neodymium/tests/logging/LoggingSecondTest.java +++ b/src/test/java/showcase/neodymium/tests/logging/LoggingSecondTest.java @@ -2,9 +2,9 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.junit.Test; -import com.xceptance.neodymium.module.statement.browser.multibrowser.SuppressBrowsers; +import com.xceptance.neodymium.common.browser.SuppressBrowsers; +import com.xceptance.neodymium.junit5.NeodymiumTest; import io.qameta.allure.Description; import showcase.neodymium.tests.AbstractTest; @@ -17,7 +17,7 @@ public class LoggingSecondTest extends AbstractTest { private static final Logger logger = LogManager.getLogger(LoggingSecondTest.class); - @Test + @NeodymiumTest @Description("Showcase for logging with log4j2.") public void testSecondLogging() { diff --git a/src/test/java/showcase/neodymium/tests/pdf/PdfTextContentCheckTest.java b/src/test/java/showcase/neodymium/tests/pdf/PdfTextContentCheckTest.java index cb191f3..3b9e6a4 100644 --- a/src/test/java/showcase/neodymium/tests/pdf/PdfTextContentCheckTest.java +++ b/src/test/java/showcase/neodymium/tests/pdf/PdfTextContentCheckTest.java @@ -7,9 +7,9 @@ import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.text.PDFTextStripper; import org.junit.Assert; -import org.junit.Test; import com.codeborne.selenide.Selenide; +import com.xceptance.neodymium.junit5.NeodymiumTest; import io.qameta.allure.Description; import io.qameta.allure.Owner; @@ -32,7 +32,7 @@ @Tag("pdf") public class PdfTextContentCheckTest extends AbstractTest { - @Test + @NeodymiumTest @Description("Showcase for testing PDF text content") public void test() throws IOException, InterruptedException, URISyntaxException { diff --git a/src/test/java/showcase/neodymium/tests/random/FixedRandomTest.java b/src/test/java/showcase/neodymium/tests/random/FixedRandomTest.java index e275e6c..14bb3e2 100644 --- a/src/test/java/showcase/neodymium/tests/random/FixedRandomTest.java +++ b/src/test/java/showcase/neodymium/tests/random/FixedRandomTest.java @@ -5,10 +5,9 @@ import java.util.Random; import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import com.xceptance.neodymium.module.statement.browser.multibrowser.SuppressBrowsers; +import com.xceptance.neodymium.common.browser.SuppressBrowsers; +import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.Neodymium; import io.qameta.allure.Description; @@ -29,7 +28,7 @@ @SuppressBrowsers public class FixedRandomTest extends AbstractTest { - @Before + @NeodymiumTest public void configurationCheck() { // by setting the neodymium.context.random.initialValue, the random result can be kept constant @@ -38,7 +37,7 @@ public void configurationCheck() Long.valueOf("123456789"), Neodymium.configuration().initialRandomValue()); } - @Test + @NeodymiumTest @Description(value = "Showcase for usage of Neodymium#getRandom.") public void testFixedRandom() { diff --git a/src/test/java/showcase/neodymium/tests/random/RandomJobOffersTest.java b/src/test/java/showcase/neodymium/tests/random/RandomJobOffersTest.java index 955584f..6b8fc20 100644 --- a/src/test/java/showcase/neodymium/tests/random/RandomJobOffersTest.java +++ b/src/test/java/showcase/neodymium/tests/random/RandomJobOffersTest.java @@ -5,10 +5,10 @@ import static com.codeborne.selenide.Selenide.$$; import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; import com.codeborne.selenide.ElementsCollection; +import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.Neodymium; import com.xceptance.neodymium.util.NeodymiumRandom; @@ -32,7 +32,7 @@ */ public class RandomJobOffersTest extends AbstractTest { - @Before + @BeforeEach public void configurationCheck() { // by setting the neodymium.context.random.initialValue, the random result can be kept constant @@ -41,7 +41,7 @@ public void configurationCheck() Neodymium.configuration().initialRandomValue()); } - @Test + @NeodymiumTest @Description(value = "Showcase for clicking a random element in the list of current job offers.") public void testRandomJobs() { diff --git a/src/test/java/showcase/neodymium/tests/random/RandomProbabilityTest.java b/src/test/java/showcase/neodymium/tests/random/RandomProbabilityTest.java index c480b3e..ac20e4d 100644 --- a/src/test/java/showcase/neodymium/tests/random/RandomProbabilityTest.java +++ b/src/test/java/showcase/neodymium/tests/random/RandomProbabilityTest.java @@ -2,9 +2,9 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.junit.Test; -import com.xceptance.neodymium.module.statement.browser.multibrowser.SuppressBrowsers; +import com.xceptance.neodymium.common.browser.SuppressBrowsers; +import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.NeodymiumRandom; import io.qameta.allure.Description; @@ -23,7 +23,7 @@ public class RandomProbabilityTest extends AbstractTest { private static final Logger logger = LogManager.getLogger(LoggingFirstTest.class); - @Test + @NeodymiumTest @Description(value = "Showcase for usage of NeodymiumRandom#nextBoolean(int trueCaseProbability).") public void testRandomProbability() { diff --git a/src/test/java/showcase/neodymium/tests/responsive/MobileDeviceTest.java b/src/test/java/showcase/neodymium/tests/responsive/MobileDeviceTest.java index f2170aa..d650fb8 100644 --- a/src/test/java/showcase/neodymium/tests/responsive/MobileDeviceTest.java +++ b/src/test/java/showcase/neodymium/tests/responsive/MobileDeviceTest.java @@ -4,10 +4,9 @@ import static com.codeborne.selenide.Condition.visible; import static com.codeborne.selenide.Selenide.$; -import org.junit.Test; - import com.codeborne.selenide.Selenide; -import com.xceptance.neodymium.module.statement.browser.multibrowser.Browser; +import com.xceptance.neodymium.common.browser.Browser; +import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.Neodymium; import showcase.neodymium.tests.AbstractTest; @@ -24,7 +23,7 @@ @Browser("Chrome_iPhoneX") public class MobileDeviceTest extends AbstractTest { - @Test + @NeodymiumTest public void testProductListPageIsResponsive() { // go to the web page diff --git a/src/test/java/showcase/neodymium/tests/shadowdom/ShadowDomCheckboxTest.java b/src/test/java/showcase/neodymium/tests/shadowdom/ShadowDomCheckboxTest.java index ff8d8e3..f5ded3c 100644 --- a/src/test/java/showcase/neodymium/tests/shadowdom/ShadowDomCheckboxTest.java +++ b/src/test/java/showcase/neodymium/tests/shadowdom/ShadowDomCheckboxTest.java @@ -12,6 +12,7 @@ import com.codeborne.selenide.Selectors; import com.codeborne.selenide.Selenide; import com.codeborne.selenide.SelenideElement; +import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.Neodymium; import io.qameta.allure.Description; @@ -35,7 +36,7 @@ @DisplayName("Checkboxtest") public class ShadowDomCheckboxTest extends AbstractTest { - @Test + @NeodymiumTest @Description(value = "Showcase for nested shadow DOM.") public void testNestedShadowDOM() { diff --git a/src/test/java/showcase/neodymium/tests/shadowdom/ShadowDomTextTest.java b/src/test/java/showcase/neodymium/tests/shadowdom/ShadowDomTextTest.java index c041d77..3d37d35 100644 --- a/src/test/java/showcase/neodymium/tests/shadowdom/ShadowDomTextTest.java +++ b/src/test/java/showcase/neodymium/tests/shadowdom/ShadowDomTextTest.java @@ -7,10 +7,9 @@ import static com.codeborne.selenide.Selenide.$$; import static com.codeborne.selenide.Selenide.switchTo; -import org.junit.Test; - import com.codeborne.selenide.Selectors; import com.codeborne.selenide.Selenide; +import com.xceptance.neodymium.junit5.NeodymiumTest; import io.qameta.allure.Description; import io.qameta.allure.Owner; @@ -33,7 +32,7 @@ @DisplayName("Texttest") public class ShadowDomTextTest extends AbstractTest { - @Test + @NeodymiumTest @Description(value = "Check that text field exists and control text") public void testTextField() { diff --git a/src/test/java/showcase/neodymium/tests/slider/SliderTest.java b/src/test/java/showcase/neodymium/tests/slider/SliderTest.java index 70b5acc..99e36c4 100644 --- a/src/test/java/showcase/neodymium/tests/slider/SliderTest.java +++ b/src/test/java/showcase/neodymium/tests/slider/SliderTest.java @@ -10,6 +10,7 @@ import com.codeborne.selenide.Selenide; import com.codeborne.selenide.SelenideElement; import com.codeborne.selenide.ex.ElementNotFound; +import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.SelenideAddons; import io.qameta.allure.Description; @@ -37,7 +38,7 @@ public class SliderTest extends AbstractTest private static final int INTERACTION_PAUSE = 3000; - @Test + @NeodymiumTest @Description(value = "Showcase for a horizontal drag and drop of a web slider to the right side.") public void testHorizontalRightMovement() { @@ -103,7 +104,7 @@ public void testVerticalUpMovement() SelenideAddons.dragAndDropUntilCondition(elementUnderTest, elementUnderTest, 0, -10, INTERACTION_PAUSE, MAX_RETRIES, attribute("aria-valuenow", "16")); } - @Test + @NeodymiumTest @Description(value = "Showcase for a vertical drag and drop of a web slider to the bottom.") public void testVerticalDownMovement() { diff --git a/src/test/java/showcase/neodymium/tests/xcmailr/XCMailrTest.java b/src/test/java/showcase/neodymium/tests/xcmailr/XCMailrTest.java index 68f29c2..8435162 100644 --- a/src/test/java/showcase/neodymium/tests/xcmailr/XCMailrTest.java +++ b/src/test/java/showcase/neodymium/tests/xcmailr/XCMailrTest.java @@ -3,14 +3,14 @@ import java.io.IOException; import org.apache.hc.client5.http.ClientProtocolException; -import org.junit.After; import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; import com.codeborne.selenide.Condition; import com.codeborne.selenide.Selenide; +import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.plugin.xcmailr.XcMailrApi; import com.xceptance.neodymium.util.SelenideAddons; @@ -67,7 +67,7 @@ public class XCMailrTest extends AbstractTest // Define a test email address which is used through out the test protected final static String receiverEmail = ""; - @BeforeClass + @BeforeAll public static void configureApiToken() throws ClientProtocolException, IOException { // required configuration checks @@ -81,21 +81,21 @@ public static void configureApiToken() throws ClientProtocolException, IOExcepti receiverEmail); } - @Before + @BeforeEach public void createTempEmailAndSendEmail() { // Create temporary email with the XcMailrApi XcMailrApi.createTemporaryEmail(receiverEmail, false); } - @After + @AfterEach public void deleteTempEmail() { // Delete temporary email with the XcMailrApi XcMailrApi.deleteMailbox(receiverEmail); } - @Test + @NeodymiumTest public void testRetrieveLastEmail() { // Get the mail From b6f116ce994855b8e33e8dbdeed23507095dda2d Mon Sep 17 00:00:00 2001 From: Jonas Hoyer Date: Tue, 16 Jul 2024 16:39:01 +0200 Subject: [PATCH 05/17] neo version update --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 1cf96be..5b44c8d 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.xceptance.neodymium.project neodymium-showcase - 4.1.0-SNAPSHOT + 5.0.1 jar neodymium-showcase @@ -30,7 +30,7 @@ 2.22.2 1.9.21 2.12.0 - 5.0.0 + 5.0.1 2.0.24 From 05872a85a42b93cd65c30792cfa4ca5648743e34 Mon Sep 17 00:00:00 2001 From: Jonas Hoyer Date: Wed, 31 Jul 2024 07:39:58 +0200 Subject: [PATCH 06/17] update neo version to 5.0.2 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 5b44c8d..04457dc 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.xceptance.neodymium.project neodymium-showcase - 5.0.1 + 5.0.2 jar neodymium-showcase @@ -30,7 +30,7 @@ 2.22.2 1.9.21 2.12.0 - 5.0.1 + 5.0.2 2.0.24 From ee9bf73681f51787dfa36a2f368d9c9b22f9a6b4 Mon Sep 17 00:00:00 2001 From: RobertAvemarg Date: Wed, 11 Dec 2024 20:53:50 +0100 Subject: [PATCH 07/17] WIP: added new showcases and fixed typos --- .gitignore | 2 + README.md | 135 +++++++-- config/localization.yaml | 4 +- config/neodymium.properties | 30 +- pom.xml | 260 +++++++++--------- .../java/showcase/flows/PropertiesFlow.java | 85 ++++++ ...LocalProxyBasicAuthenticationHostTest.java | 2 +- ...miumLocalProxyBasicAuthenticationTest.java | 6 +- ...calProxyCertificateAuthenticationTest.java | 6 +- ...GenerateCertificateAuthenticationTest.java | 4 +- .../SelenideBasicAuthenticationTest.java | 4 +- .../DifferentBrowserSessionTest.java | 60 ++++ .../SameBrowserSessionTest.java | 52 ++++ .../data/AccessDataViaDataObjectsTest.java | 2 +- .../AccessDataViaDataSetAnnotationTest.java | 2 +- .../data/AccessDataViaDataUtilsTest.java | 2 +- .../tests/data/AccessDataViaJsonPathTest.java | 4 +- ...ityTest.java => DataFilePriorityTest.java} | 6 +- .../iframe/SelenideSwitchToFrameTest.java | 2 +- .../jsonassertion/JsonAssertionTest.java | 67 +++++ .../tests/lighthouse/LighthouseTest.java | 36 +++ .../NeodymiumLocalizationTest.java | 8 +- .../tests/pdf/PdfTextContentCheckTest.java | 4 +- .../tests/popupblocker/PopupBlockerTest.java | 56 ++++ .../tests/random/FixedRandomTest.java | 2 +- .../tests/random/RandomJobOffersTest.java | 2 +- .../tests/random/RandomProbabilityTest.java | 2 +- .../tests/responsive/MobileDeviceTest.java | 2 +- .../screenshot/AdvancedScreenshotTest.java | 78 ++++++ .../shadowdom/ShadowDomCheckboxTest.java | 4 +- .../tests/shadowdom/ShadowDomTextTest.java | 4 +- .../neodymium/tests/slider/SliderTest.java | 6 +- .../UrlValidationExcludeTest.java | 76 +++++ .../UrlValidationIncludeTest.java | 82 ++++++ .../neodymium/tests/xcmailr/XCMailrTest.java | 2 +- ...otityTest.csv => DataFilePriorityTest.csv} | 0 ...ityTest.json => DataFilePriorityTest.json} | 0 .../neodymium/tests/jsonassertion/actual.json | 25 ++ .../tests/jsonassertion/expected.json | 25 ++ 39 files changed, 937 insertions(+), 212 deletions(-) create mode 100644 src/test/java/showcase/flows/PropertiesFlow.java create mode 100644 src/test/java/showcase/neodymium/tests/browsersession/DifferentBrowserSessionTest.java create mode 100644 src/test/java/showcase/neodymium/tests/browsersession/SameBrowserSessionTest.java rename src/test/java/showcase/neodymium/tests/data/{DataFilePriotityTest.java => DataFilePriorityTest.java} (86%) create mode 100644 src/test/java/showcase/neodymium/tests/jsonassertion/JsonAssertionTest.java create mode 100644 src/test/java/showcase/neodymium/tests/lighthouse/LighthouseTest.java create mode 100644 src/test/java/showcase/neodymium/tests/popupblocker/PopupBlockerTest.java create mode 100644 src/test/java/showcase/neodymium/tests/screenshot/AdvancedScreenshotTest.java create mode 100644 src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationExcludeTest.java create mode 100644 src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationIncludeTest.java rename src/test/resources/showcase/neodymium/tests/data/{DataFilePriotityTest.csv => DataFilePriorityTest.csv} (100%) rename src/test/resources/showcase/neodymium/tests/data/{DataFilePriotityTest.json => DataFilePriorityTest.json} (100%) create mode 100644 src/test/resources/showcase/neodymium/tests/jsonassertion/actual.json create mode 100644 src/test/resources/showcase/neodymium/tests/jsonassertion/expected.json diff --git a/.gitignore b/.gitignore index 9e70fae..708a318 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ build /.allure/ dev-*.properties +temp-*.properties +.idea diff --git a/README.md b/README.md index ba5a6fa..0810ae6 100644 --- a/README.md +++ b/README.md @@ -1,57 +1,98 @@ # Introduction -This repository is a Showcase project to demonstrate the usage of several features of the [Neodymium Library](https://github.com/Xceptance/neodymium-library). -To use Neodymium features in test development as intended from the very beginning on without struggling around with several required configurations each show case explains the approach technology, the implementation options as well as the belonging configuration next to where it is implemented. The reader gets also some recommendation about when an approach should be used or even not. +This repository is a Showcase project to demonstrate the usage of several features of +the [Neodymium Library](https://github.com/Xceptance/neodymium-library). +To use Neodymium features in test development as intended from the very beginning on without struggling around with +several required configurations each showcase explains the approach technology, the implementation options as well as +the belonging configuration next to where it is implemented. The reader gets also some recommendation about when an +approach should be used or even not. -# Show cases -Below is a summary of the show cases. Deeper documentation can be found in the show case code next to each show case. It is also possible to execute a show case after [setting up the Chrome WebDriver](https://github.com/Xceptance/neodymium-library/wiki/How-to-set-up-a-WebDriver). Just run the show case of interest as a JUnit test from with the IDE. +# Showcases + +Below is a summary of the showcases. Deeper documentation can be found in the showcase code next to each showcase. It is +also possible to execute them +after [setting up the Chrome WebDriver](https://github.com/Xceptance/neodymium-library/wiki/How-to-set-up-a-WebDriver). +Just run the showcase of interest as a JUnit test from with the IDE. ## 1. Shadow DOM -The `showcase.neodymium.tests.shadowdom` package contains use cases for the shadow DOM automation. Please also have a look at our [wiki](https://github.com/Xceptance/neodymium-library/wiki/Shadow-DOM-Testing) for more information. + +The `showcase.neodymium.tests.shadowdom` package contains use cases for the shadow DOM automation. Please also have a +look at our [wiki](https://github.com/Xceptance/neodymium-library/wiki/Shadow-DOM-Testing) for more information. * `ShadowDomTextTest.java` demonstrates a simple use case on how to automatically test shadow DOM elements. * `ShadowDomCheckboxTest.java` contains more sophisticated use cases for shadow DOM including nested shadow DOMs. ## 2. Localization -The tests in the `showcase.neodymium.tests.localization` package highlight how the [localization](https://github.com/Xceptance/neodymium-library/wiki/Localization) feature of Neodymium is used. Note that all the translated wordings and their keys can be found in the `config/localization.yaml` file. + +The tests in the `showcase.neodymium.tests.localization` package highlight how +the [localization](https://github.com/Xceptance/neodymium-library/wiki/Localization) feature of Neodymium is used. Note +that all the translated wordings and their keys can be found in the `config/localization.yaml` file. ## 3. PDF Download -In the `showcase.neodymium.tests.pdf` package is a basic test for downloading and checking a PDF file. In this test, we use the PDFBox framework for handling a PDF file. To download such a file, we use Selenide's `download` function It downloads a file directly via a given link. -Afterwards, the PDF file is loaded with the PDFBox framework, so we can access the text and verify it. -## 4. Web slider -The `showcase.neodymium.tests.slider` package contains use cases to drag and drop a web slider into different directions e.g. horizontal and vertical. The function provided by Neodymium can also be used to drag and drop any element that supports this. +In the `showcase.neodymium.tests.pdf` package is a basic test for downloading and checking a PDF file. In this test, we +use the PDFBox framework for handling a PDF file. To download such a file, we use Selenide's `download` function It +downloads a file directly via a given link. +Afterward, the PDF file is loaded with the PDFBox framework, so we can access the text and verify it. + +## 4. Web slider + +The `showcase.neodymium.tests.slider` package contains use cases to drag and drop a web slider into different directions +e.g. horizontal and vertical. The function provided by Neodymium can also be used to drag and drop any element that +supports this. + +## 5. Basic authentication + +The `showcase.neodymium.tests.basicauth` package contains several approaches how to set up basic authentication within +your test automation project. -## 5. Basic authentication -The `showcase.neodymium.tests.basicauth` package contains several approaches how to setup basic authentication within your test automation project. - * `SelenideBasicAuthenticationTest.java` demonstrates how to perform a standard basic authentication via URL. -* `NeodymiumLocalProxyBasicAuthenticationTest.java` shows what is needed to perform an automatic authentication via the embedded local proxy provided by Neodymium. -* `NeodymiumLocalProxyBasicAuthenticationHostTest.java` shows what is needed to perform a manual authentication via the embedded local proxy provided by Neodymium. -* `NeodymiumLocalProxyGenerateCertificateAuthenticationTest.java` shows how to secure the traffic with an automatic generated certificate via the embedded local proxy provided by Neodymium. -* `NeodymiumLocalProxyCertificateAuthenticationTest.java` shows how to secure the traffic by providing an own certificate via the embedded local proxy provided by Neodymium. +* `NeodymiumLocalProxyBasicAuthenticationTest.java` shows what is needed to perform an automatic authentication via the + embedded local proxy provided by Neodymium. +* `NeodymiumLocalProxyBasicAuthenticationHostTest.java` shows what is needed to perform a manual authentication via the + embedded local proxy provided by Neodymium. +* `NeodymiumLocalProxyGenerateCertificateAuthenticationTest.java` shows how to secure the traffic with an automatic + generated certificate via the embedded local proxy provided by Neodymium. +* `NeodymiumLocalProxyCertificateAuthenticationTest.java` shows how to secure the traffic by providing an own + certificate via the embedded local proxy provided by Neodymium. ## 6. XcMailr Plugin -The `showcase.neodymium.tests.xcmailr` package contains a simple test case for the XcMailr plugin for Neodymium. You can find more information about it by consulting the `README.md` of the XcMailr plugin which can be found [here](https://github.com/Xceptance/neodymium-plugin-xcmailr). -This test case requires some effort in setting up the test environment since there is no publicly free XcMailr service available. Hence you need to set up an instance of the [XCMailr](https://github.com/Xceptance/XCMailr) on your own or get in contact with [Xceptance](https://www.xceptance.com/en/contact/) if you are in need for using such a service within your test. The remaining setup is described within the test case and shouldn't be to challenging. + +The `showcase.neodymium.tests.xcmailr` package contains a simple test case for the XcMailr plugin for Neodymium. You can +find more information about it by consulting the `README.md` of the XcMailr plugin which can be +found [here](https://github.com/Xceptance/neodymium-plugin-xcmailr). +This test case requires some effort in setting up the test environment since there is no publicly free XcMailr service +available. Hence, you need to set up an instance of the [XCMailr](https://github.com/Xceptance/XCMailr) on your own or +get in contact with [Xceptance](https://www.xceptance.com/en/contact/) if you are in need for using such a service +within your test. The remaining setup is described within the test case and shouldn't be to challenging. ## 7. Mobile Test -In the `showcase.neodymium.tests.responsive` package is a basic test case to test a mobile device. In order to test a cell phone for example, the emulation of various mobile devices integrated in Chrome can be used. -## 8. Random test data +In the `showcase.neodymium.tests.responsive` package is a basic test case to test a mobile device. In order to test a +cell phone for example, the emulation of various mobile devices integrated in Chrome can be used. + +## 8. Random test data + The `showcase.neodymium.tests.random` package contains the selection of random web elements from a website under test. - + * `FixedRandomTest.java` shows how a random test can be run again in the same way. -* `RandomJobOffersTest.java` demonstrates the selection of different job offers. +* `RandomJobOffersTest.java` demonstrates the selection of different job offers. + +## 9. Logging with log4j2 -## 9. Logging with log4j2 -The `showcase.neodymium.tests.logging` package shows how log4j2 can be used for logging. The configuration is specified in the log4j2.properties file. Logging can be set differently for console output and log files. With two test cases it is shown that it is even possible to define the logging per test. +The `showcase.neodymium.tests.logging` package shows how log4j2 can be used for logging. The configuration is specified +in the log4j2.properties file. Logging can be set differently for console output and log files. With two test cases it +is shown that it is even possible to define the logging per test. ## 10. iFrame -This show case in the `showcase.neodymium.tests.iframe` package explains with an example implementation how to test a web site using frames. Selenide offers a straight forward approach to handle such frames and within Neodymium this is simply applied. + +This showcase in the `showcase.neodymium.tests.iframe` package explains with an example implementation how to test a +website using frames. Selenide offers a straight forward approach to handle such frames and within Neodymium this is +simply applied. ## 11. Test data access + The various options for providing test data are shown in the package `showcase.neodymium.tests.data`. * `AccessDataViaDataObjectsTest.java` demonstrates how to perform a data access via POJO. @@ -60,6 +101,46 @@ The various options for providing test data are shown in the package `showcase.n * `AccessDataViaJsonPathTest.java` shows data access by means of Json Path. * `DataFilePriotityTest.java` shows the priority when accessing different file formats. +## 12. Separate browser sessions + +In the package `showcase.neodymium.tests.browsersession` are two tests demonstrating the different session handling for +the setup und cleanup for a test, where `DifferentBrowserSessionTest.java` uses different sessions for each and +`SameBrowserSessionTest.java` uses the same session. +For more information take a look at our [wiki](https://github.com/Xceptance/neodymium/wiki/Seperate-Browser-Sessions). + +## 13. JSON assertions + +`showcase.neodymium.tests.jsonassertion.JsonAssertionTest.java` shows how to compare JSON files and demonstrates the +improved visibility of the differences in the allure report. More information are in +the [reports section](https://github.com/Xceptance/neodymium/wiki/Reports#add-json-compare-to-report) of our wiki. + +## 14. Lighthouse reports + +Due to the steadily increasing importance of accessibility Google Lighthouse is now part of our test framework and can +be used to get an accessibility score for the desired websites. To demonstrate the usage the showcase +`showcase.neodymium.tests.lighthouse.LighthouseTest.java` was created. +Further reading: [lighthouse section](https://github.com/Xceptance/neodymium/wiki/Reports#lighthouse) + +## 15. Popup blocker + +Since random popups can be annoying for test automation, the showcase +`showcase.neodymium.tests.popupblocker.PopupBlockerTest.java` demonstrates the popup blocker of Neodymium. For more +information see the +[popup blocker](https://github.com/Xceptance/neodymium/wiki/Popup-Blocker) wiki section. + +## 16. Advanced screenshots + +Neodymium gives testers the opportunity to customize screenshots, like taking full page screenshots and changing the +colour of the highlighting. In [advanced screenshots](https://github.com/Xceptance/neodymium/wiki/Advanced-Screenshots) +the feature is documented and the usage is shown in the showcase +`showcase.neodymium.tests.screenshot.AdvancedScreenshotTest.java`. + +## 17. URL validation + +To prevent the test automation to reach sites that are out of scope or should not be tested, it is possible to define +include and exclude lists in the `neodymium.config`. The setup and usage of those lists is demonstrated in the showcases +in the package `showcase.neodymium.tests.urlvalidation`. ## License -MIT \ No newline at end of file + +MIT diff --git a/config/localization.yaml b/config/localization.yaml index 6563590..0fbfd5f 100644 --- a/config/localization.yaml +++ b/config/localization.yaml @@ -1,5 +1,5 @@ COMMENT: - DESCRIPTION: This comment section is added for the show case only to explain how to use Neodymium Localization. + DESCRIPTION: This comment section is added for the showcase only to explain how to use Neodymium Localization. RELATED SHOWCASE: NeodymiumLocalizationShowcase default: @@ -15,4 +15,4 @@ de: de_AT: homepage: - subtitle: Wir begleiten Sie auf Ihrem Weg zum besten Produkt. \ No newline at end of file + subtitle: Wir begleiten Sie auf Ihrem Weg zum besten Produkt. diff --git a/config/neodymium.properties b/config/neodymium.properties index 11ec346..6a3bd7e 100644 --- a/config/neodymium.properties +++ b/config/neodymium.properties @@ -6,33 +6,31 @@ # MANDATORY SETTINGS # # Chrome WebDriver -# To run any show case the Chrome WebDriver must be installed before. +# To run any showcase the Chrome WebDriver must be installed before. # See: https://github.com/Xceptance/neodymium-library/wiki/How-to-set-up-a-WebDriver # Configure # neodymium.webDriver.chrome.pathToDriverServer = c:/path/to/chromedriver.exe # # The following long value will be use to initialize Neodymiums Random instance. #neodymium.context.random.initialValue = 123456789 - # Neodymium allows to set a default locale to support the most common test cases # - NeodymiumLocalizationTest -neodymium.locale = en_US - +neodymium.locale=en_US # Neodymium can run an embedded proxy in the test execution process # HTTP Basic access Authentication information is automatically added to the HTTP header -# RELATED SHOW CASES: +# RELATED SHOWCASES: # - NeodymiumLocalProxyBasicAuthentication # - SelenideBasicAuthentication # - NeodymiumLocalProxyCertificateAuthentication # - NeodymiumLocalProxyCertificateAuthenticationHost -neodymium.localproxy = false -neodymium.url.host = authenticationtest.com -neodymium.basicauth.username = User -neodymium.basicauth.password = Pass -neodymium.localproxy.certificate = true -neodymium.localproxy.certificate.generate = true -neodymium.localproxy.certificate.archiveFile = ./config/Certificate.pfx -neodymium.localproxy.certificate.archivetype = PKCS12 -neodymium.localproxy.certificate.name = e6f60fbd-f9f3-436f-aba5-452861ae4570 -neodymium.localproxy.certificate.password = MITMCertificatePassword -# \ No newline at end of file +neodymium.localproxy=false +neodymium.url.host=authenticationtest.com +neodymium.basicauth.username=User +neodymium.basicauth.password=Pass +neodymium.localproxy.certificate=true +neodymium.localproxy.certificate.generate=true +neodymium.localproxy.certificate.archiveFile=./config/Certificate.pfx +neodymium.localproxy.certificate.archivetype=PKCS12 +neodymium.localproxy.certificate.name=e6f60fbd-f9f3-436f-aba5-452861ae4570 +neodymium.localproxy.certificate.password=MITMCertificatePassword +# diff --git a/pom.xml b/pom.xml index 04457dc..ec87971 100644 --- a/pom.xml +++ b/pom.xml @@ -1,137 +1,139 @@ - 4.0.0 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 - com.xceptance.neodymium.project - neodymium-showcase - 5.0.2 - jar + com.xceptance.neodymium.project + neodymium-showcase + 5.1.1 + jar - neodymium-showcase - https://github.com/Xceptance/neodymium-showcase - - Xceptance Software Technologies - https://www.xceptance.com/ - + neodymium-showcase + https://github.com/Xceptance/neodymium-showcase + + Xceptance Software Technologies + https://www.xceptance.com/ + - - - MIT - https://opensource.org/licenses/MIT - repo - - + + + MIT + https://opensource.org/licenses/MIT + repo + + - - UTF-8 - 17 - 17 - 2.22.2 - 1.9.21 - 2.12.0 - 5.0.2 - 2.0.24 - + + UTF-8 + 17 + 17 + 2.22.2 + 1.9.21 + 2.12.0 + 5.1.1 + 2.0.24 + - - - - org.apache.maven.plugins - maven-surefire-plugin - ${surefire.version} - - 1 - true - - - showcase/neodymium/tests/**/*Test.java - - -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar" - - - listener - io.qameta.allure.junit4.AllureJunit4 - - - - ${project.build.directory}/allure-results - ${project.build.directory}/selenide-results - - - - - org.aspectj - aspectjweaver - ${aspectj.version} - - - - - io.qameta.allure - allure-maven - ${allure.version} - - ${allure.version} - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.2.0 - - - attach-javadocs - - jar - test-jar - - - - - 17 - - - - + + + + org.apache.maven.plugins + maven-surefire-plugin + ${surefire.version} + + 1 + true + + + showcase/neodymium/tests/**/*Test.java + + + -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar" + + + + listener + io.qameta.allure.junit4.AllureJunit4 + + + + ${project.build.directory}/allure-results + ${project.build.directory}/selenide-results + + + + + org.aspectj + aspectjweaver + ${aspectj.version} + + + + + io.qameta.allure + allure-maven + ${allure.version} + + 2.27.0 + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + + attach-javadocs + + jar + test-jar + + + + + 17 + + + + - - - com.xceptance - neodymium-library - ${neodymium.version} - test - - - - org.apache.pdfbox - pdfbox - ${pdfbox.version} - - - - com.xceptance - neodymium-plugin-xcmailr - 1.1.3 - - - org.apache.logging.log4j - log4j-slf4j2-impl - 2.23.1 - test - - + + + com.xceptance + neodymium-library + ${neodymium.version} + test + + + + org.apache.pdfbox + pdfbox + ${pdfbox.version} + + + + com.xceptance + neodymium-plugin-xcmailr + 1.1.3 + + + org.apache.logging.log4j + log4j-slf4j2-impl + 2.23.1 + test + + - - - - org.apache.maven.plugins - maven-surefire-report-plugin - ${surefire.version} - - - - \ No newline at end of file + + + + org.apache.maven.plugins + maven-surefire-report-plugin + ${surefire.version} + + + + diff --git a/src/test/java/showcase/flows/PropertiesFlow.java b/src/test/java/showcase/flows/PropertiesFlow.java new file mode 100644 index 0000000..c88c5f5 --- /dev/null +++ b/src/test/java/showcase/flows/PropertiesFlow.java @@ -0,0 +1,85 @@ +package showcase.flows; + +import com.xceptance.neodymium.util.Neodymium; +import org.aeonbits.owner.ConfigFactory; +import org.apache.commons.io.FileUtils; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Map; +import java.util.stream.Collectors; + +public class PropertiesFlow +{ + /** + * Helper method to add properties to a temporary properties file in the config directory. Can e.g. be used to define excluded URLs in a file named + * 'temp-UrlValidationExcludeTest-neodymium.properties' like follows: + *
addTempProperty("temp-UrlValidationExcludeTest-neodymium.properties",
+     * Map.of("neodymium.url.excludeList", "https://www.xceptance.com/en/"));
+ *
+ * Attention: needs to be run in the @BeforeAll method, because if the test runner is already started, the new properties + * are not applied. + * + * @param filename + * the name of the property file to create + * @param properties + * a map containing all the properties and values that should be written + */ + public static void addTempProperty(String filename, Map properties) + { + // define and set the properties + for (String key : properties.keySet()) + { + Neodymium.configuration().setProperty(key, properties.get(key)); + } + + String propertiesString = properties.entrySet().stream() + .map(entry -> entry.getKey() + "=" + entry.getValue()) + .collect(Collectors.joining(System.lineSeparator())); + + // create a temp properties file with the value + String fileLocation = "config/" + filename; + File tempConfigFile = new File("./" + fileLocation); + + try + { + FileUtils.writeStringToFile(tempConfigFile, propertiesString, StandardCharsets.UTF_8); + } + catch (IOException e) + { + throw new RuntimeException(e); + } + + ConfigFactory.setProperty(Neodymium.TEMPORARY_CONFIG_FILE_PROPERTY_NAME, "file:" + fileLocation); + } + + /** + * Helper method to delete the temp properties file with the given name in the default config folder ./config/. Example usage in the + * {@link showcase.neodymium.tests.urlvalidation.UrlValidationIncludeTest} to not block all sites except the included: + *

+     *     @AfterAll
+     *     public static void cleanUp()
+     *     {
+     *         deleteTempPropertiesFile(TEMP_PROPERTIES_FILE);
+     *     }
+ * + * @param filename + * the name of the temp properties file to delete + */ + public static void deleteTempPropertiesFile(String filename) + { + Path fileToDeletePath = Paths.get("./config/" + filename); + try + { + Files.delete(fileToDeletePath); + } + catch (IOException e) + { + throw new RuntimeException(e); + } + } +} diff --git a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationHostTest.java b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationHostTest.java index b5728fa..7f7f4d8 100644 --- a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationHostTest.java +++ b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationHostTest.java @@ -22,7 +22,7 @@ /** * If the system under test requires HTTP Basic Authentication then using an embedded local proxy provided by Neodymium * is one possible approach.
- * Especially if the standard way (see: {@link SelenideBasicAuthenticationTest} show case) is not applicable due to + * Especially if the standard way (see: {@link SelenideBasicAuthenticationTest} showcase) is not applicable due to * restrictions of the used WebDriver. The proxy is created on the fly and passed to the WebDriver.
* All requests running in the Neodymium test execution process are automatically routed through this proxy. The local * proxy provided by Neodymium can perform automatic authorizations.
diff --git a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationTest.java b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationTest.java index 9090b37..4aa3e91 100644 --- a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationTest.java +++ b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationTest.java @@ -21,18 +21,18 @@ /** * If the system under test requires HTTP Basic Authentication then using an embedded local proxy provided by Neodymium * is one possible approach.
- * Especially if the standard way (see: {@link SelenideBasicAuthenticationTest} show case) is not applicable due to + * Especially if the standard way (see: {@link SelenideBasicAuthenticationTest} showcase) is not applicable due to * restrictions of the used WebDriver. The proxy is created on the fly and passed to the WebDriver.
* All requests running in the Neodymium test execution process are automatically routed through this proxy. The local * proxy provided by Neodymium can perform automatic authorizations.
* The host, username and password settings (from the Neodymium configuration) are taken by default to invoke the auto * authorization via the proxy for this host. It is also possible to configure this manually and add additional systems - * during runtime (see: {@link NeodymiumLocalProxyBasicAuthenticationHostTest} show case).
+ * during runtime (see: {@link NeodymiumLocalProxyBasicAuthenticationHostTest} showcase).
*
* REQUIRED CONFIGURATION: config/neodymium.properties *
    *
  • neodymium.localproxy = true # to activate the local proxy
  • - *
  • neodymium.basicauth.username = User # HTTP basic authorization user name
  • + *
  • neodymium.basicauth.username = User # HTTP basic authorization username
  • *
  • neodymium.basicauth.password = Pass # HTTP basic authorization password
  • *
  • neodymium.url.host = authenticationtest.com # HTTP basic authorization host (taken by default)
  • *
diff --git a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyCertificateAuthenticationTest.java b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyCertificateAuthenticationTest.java index ab684c3..8a57c3b 100644 --- a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyCertificateAuthenticationTest.java +++ b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyCertificateAuthenticationTest.java @@ -25,10 +25,10 @@ * this.
* Therefore Neodymium provides a way to configure a certificate that will be used to authenticate the communication * between the parties involved. All requests running in the Neodymium test execution process are automatically routed - * through this proxy which acts as an certified MITM (Man in the Middle). The advantage of this approach is that an + * through this proxy which acts as a certified MITM (Man in the Middle). The advantage of this approach is that an * officially signed certificate can be used to secure the communication.
- * If a self signed certificate is sufficient for your test case the can be automatically generated by Neodymium (see: - * {@link NeodymiumLocalProxyGenerateCertificateAuthenticationTest} show case).
+ * If a self-signed certificate is sufficient for your test case this can be automatically generated by Neodymium (see: + * {@link NeodymiumLocalProxyGenerateCertificateAuthenticationTest} showcase).
*
* REQUIRED CONFIGURATION: config/neodymium.properties *
    diff --git a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyGenerateCertificateAuthenticationTest.java b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyGenerateCertificateAuthenticationTest.java index 31b2388..da24481 100644 --- a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyGenerateCertificateAuthenticationTest.java +++ b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyGenerateCertificateAuthenticationTest.java @@ -25,10 +25,10 @@ * this.
    * Therefore Neodymium provides a way to configure a certificate that will be used to authenticate the communication * between the parties involved. All requests running in the Neodymium test execution process are automatically routed - * through this proxy which acts as an certified MITM (Man in the Middle). The advantage of this approach is that an + * through this proxy which acts as a certified MITM (Man in the Middle). The advantage of this approach is that an * officially signed certificate can be used to secure the communication.
    * If a certificate is required that is signed by an authority for your test case this can be configured using Neodymium - * (see: {@link NeodymiumLocalProxyCertificateAuthenticationTest} show case)
    + * (see: {@link NeodymiumLocalProxyCertificateAuthenticationTest} showcase)
    *
    * REQUIRED CONFIGURATION: config/neodymium.properties *
      diff --git a/src/test/java/showcase/neodymium/tests/basicauth/SelenideBasicAuthenticationTest.java b/src/test/java/showcase/neodymium/tests/basicauth/SelenideBasicAuthenticationTest.java index 2c562fc..acfe5a6 100644 --- a/src/test/java/showcase/neodymium/tests/basicauth/SelenideBasicAuthenticationTest.java +++ b/src/test/java/showcase/neodymium/tests/basicauth/SelenideBasicAuthenticationTest.java @@ -22,12 +22,12 @@ * If the system under test requires HTTP Basic Authentication then using Selenide together with the Neodymium * configuration is a possible approach. The basic authentication credentials can be set within the Neodymium * configuration and used when calling - * {@link Selenide#open(String relativeOrAbsoluteUrl, String domain, String login, String password)} as this show case + * {@link Selenide#open(String relativeOrAbsoluteUrl, String domain, String login, String password)} as this showcase * demonstrates.
      * Selenide prefixes the basic authentication credentials to the URL. Due to security reasons this method is not * supported for all browsers (e.g. Edge) anymore. Some browsers require enabling this method before it can be used. If * your test project needs testing with such a browser you can consider the usage of the embedded local proxy provided - * by Neodymium as a solution (see: {@link NeodymiumLocalProxyBasicAuthenticationHostTest} show case).
      + * by Neodymium as a solution (see: {@link NeodymiumLocalProxyBasicAuthenticationHostTest} showcase).
      *
      * REQUIRED CONFIGURATION: config/neodymium.properties *
        diff --git a/src/test/java/showcase/neodymium/tests/browsersession/DifferentBrowserSessionTest.java b/src/test/java/showcase/neodymium/tests/browsersession/DifferentBrowserSessionTest.java new file mode 100644 index 0000000..7be3d83 --- /dev/null +++ b/src/test/java/showcase/neodymium/tests/browsersession/DifferentBrowserSessionTest.java @@ -0,0 +1,60 @@ +package showcase.neodymium.tests.browsersession; + +import com.xceptance.neodymium.common.browser.StartNewBrowserForCleanUp; +import com.xceptance.neodymium.common.browser.StartNewBrowserForSetUp; +import com.xceptance.neodymium.junit5.NeodymiumTest; +import com.xceptance.neodymium.util.Neodymium; +import io.qameta.allure.junit4.Tag; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import showcase.neodymium.tests.AbstractTest; + +import static com.codeborne.selenide.Selenide.open; + +/** + * To start the test with a fresh, clean browser its is possible to use a different browser for the setup and also for the cleanup. this can be done with the + * + * @StartNewBrowserForSetUp and the @StartNewBrowserForCleanUp annotation as demonstrated in this showcase. + */ +@Tag("BrowserSession") +public class DifferentBrowserSessionTest extends AbstractTest +{ + private String setUpWindowHandle; + + private String testWindowHandle; + + private String cleanUpWindowHandle; + + // annotation to force a new browser for setup + @StartNewBrowserForSetUp + @BeforeEach + public void setUp() + { + // Setup code using dedicated browser + open("https://www.xceptance.com/en/"); + setUpWindowHandle = Neodymium.getDriver().getWindowHandle(); + } + + @NeodymiumTest + public void testDifferentBrowserSession() + { + open("https://www.xceptance.com/en/"); + testWindowHandle = Neodymium.getDriver().getWindowHandle(); + } + + // annotation to force a new browser for cleanup + @StartNewBrowserForCleanUp + @AfterEach + public void cleanUp() + { + // Cleanup code using dedicated browser + open("https://www.xceptance.com/en/"); + cleanUpWindowHandle = Neodymium.getDriver().getWindowHandle(); + + // different browsers should generate different window handles + Assertions.assertNotEquals(setUpWindowHandle, testWindowHandle); + Assertions.assertNotEquals(setUpWindowHandle, cleanUpWindowHandle); + Assertions.assertNotEquals(testWindowHandle, cleanUpWindowHandle); + } +} diff --git a/src/test/java/showcase/neodymium/tests/browsersession/SameBrowserSessionTest.java b/src/test/java/showcase/neodymium/tests/browsersession/SameBrowserSessionTest.java new file mode 100644 index 0000000..4452529 --- /dev/null +++ b/src/test/java/showcase/neodymium/tests/browsersession/SameBrowserSessionTest.java @@ -0,0 +1,52 @@ +package showcase.neodymium.tests.browsersession; + +import com.xceptance.neodymium.junit5.NeodymiumTest; +import com.xceptance.neodymium.util.Neodymium; +import io.qameta.allure.junit4.Tag; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import showcase.neodymium.tests.AbstractTest; + +import static com.codeborne.selenide.Selenide.open; + +/** + * It is also possible to reuse the same browser thought the whole test including setup and cleanup. This is demonstrated here and the default behaviour. + */ +@Tag("BrowserSession") +public class SameBrowserSessionTest extends AbstractTest +{ + private String setUpWindowHandle; + + private String testWindowHandle; + + private String cleanUpWindowHandle; + + @BeforeEach + public void setUp() + { + // Setup code using dedicated browser + open("https://www.xceptance.com/en/"); + setUpWindowHandle = Neodymium.getDriver().getWindowHandle(); + } + + @NeodymiumTest + public void testSameBrowserSession() + { + open("https://www.xceptance.com/en/"); + testWindowHandle = Neodymium.getDriver().getWindowHandle(); + } + + @AfterEach + public void cleanUp() + { + // Cleanup code using dedicated browser + open("https://www.xceptance.com/en/"); + cleanUpWindowHandle = Neodymium.getDriver().getWindowHandle(); + + // using the same browsers and same tab should not generate different window handles + Assertions.assertEquals(setUpWindowHandle, testWindowHandle); + Assertions.assertEquals(setUpWindowHandle, cleanUpWindowHandle); + Assertions.assertEquals(testWindowHandle, cleanUpWindowHandle); + } +} diff --git a/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataObjectsTest.java b/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataObjectsTest.java index aaf2c50..f169c96 100644 --- a/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataObjectsTest.java +++ b/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataObjectsTest.java @@ -17,7 +17,7 @@ import showcase.neodymium.tests.data.dataobjects.ServiceTile; /** - * This is a show case to explain how to deal with test data using the Neodymium built-in features.
        + * This is a showcase to explain how to deal with test data using the Neodymium built-in features.
        * The example focuses on test data retrieval based on data objects.
        * In this case the test data are converted from a JSON file into Java POJOs HomePageTestData and ServiceTile.
        * This is an example for working with a more complex test object that contains a list of serviceTiles. diff --git a/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataSetAnnotationTest.java b/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataSetAnnotationTest.java index a86cbaa..6aea4f0 100644 --- a/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataSetAnnotationTest.java +++ b/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataSetAnnotationTest.java @@ -15,7 +15,7 @@ import showcase.neodymium.tests.AbstractTest; /** - * This is a show case to explain how to deal with test data using the Neodymium built-in features.
        + * This is a showcase to explain how to deal with test data using the Neodymium built-in features.
        * The example shows how to select test data with @DataSet annotation */ // disables data set support for the whole class diff --git a/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataUtilsTest.java b/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataUtilsTest.java index 3fc23ae..24624c1 100644 --- a/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataUtilsTest.java +++ b/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataUtilsTest.java @@ -14,7 +14,7 @@ import showcase.neodymium.tests.AbstractTest; /** - * This is a show case to explain how to deal with test data using the Neodymium built-in features.
        + * This is a showcase to explain how to deal with test data using the Neodymium built-in features.
        * The example focuses on the very basic direct test data retrieval.
        * In this case the test data are taken from the XML file.
        * The method DataUtils.asString() is used diff --git a/src/test/java/showcase/neodymium/tests/data/AccessDataViaJsonPathTest.java b/src/test/java/showcase/neodymium/tests/data/AccessDataViaJsonPathTest.java index 2a0c5f0..b03dc47 100644 --- a/src/test/java/showcase/neodymium/tests/data/AccessDataViaJsonPathTest.java +++ b/src/test/java/showcase/neodymium/tests/data/AccessDataViaJsonPathTest.java @@ -16,7 +16,7 @@ import showcase.neodymium.tests.data.dataobjects.ServiceTile; /** - * This show case explains how to access test data using the features built into the Neodymium framework.
        + * This showcase explains how to access test data using the features built into the Neodymium framework.
        * By default, Neodymium looks for a data file that has the same name as the test case and is located in the same * package in the resources folder.
        * This example shows the reading from a JSON file that does not meet the naming conventions.
        @@ -24,7 +24,7 @@ * The method DataUtils.get() uses the JsonPath here. */ @Tag("data object test data access") -// tell Neodymium to use a different than standard named data file under src/test/ressources/ +// tell Neodymium to use a different named data file under src/test/resources/ instead the standard one @DataFile("showcase/neodymium/tests/data/TestDataFileWithDifferentName.json") public class AccessDataViaJsonPathTest extends AbstractTest { diff --git a/src/test/java/showcase/neodymium/tests/data/DataFilePriotityTest.java b/src/test/java/showcase/neodymium/tests/data/DataFilePriorityTest.java similarity index 86% rename from src/test/java/showcase/neodymium/tests/data/DataFilePriotityTest.java rename to src/test/java/showcase/neodymium/tests/data/DataFilePriorityTest.java index 94c57d8..98afce9 100644 --- a/src/test/java/showcase/neodymium/tests/data/DataFilePriotityTest.java +++ b/src/test/java/showcase/neodymium/tests/data/DataFilePriorityTest.java @@ -13,7 +13,7 @@ import showcase.neodymium.tests.AbstractTest; /** - * This show case explains how to access test data using the features built into the Neodymium framework.
        + * This showcase explains how to access test data using the features built into the Neodymium framework.
        * By default, Neodymium looks for a data file that has the same name as the test case and is located in the same * package in the resources folder.
        * This example shows the reading from a CSV file, although a matching JSON file exists.
        @@ -21,11 +21,11 @@ * The use of the method Neodymium.dataValue() is shown here. */ @Tag("direct test data access") -public class DataFilePriotityTest extends AbstractTest +public class DataFilePriorityTest extends AbstractTest { @NeodymiumTest @Description(value = "Get test data using Neodymium.dataValue method") - // these data sets are defined in DataFilePriotityTest.csv not in DataFilePriotityTest.json + // these data sets are defined in DataFilePriorityTest.csv not in DataFilePriorityTest.json @DataSet(id = "en/CSV test data access using Neodymium.dataValue method") @DataSet(id = "de/CSV test data access using Neodymium.dataValue method") public void test() diff --git a/src/test/java/showcase/neodymium/tests/iframe/SelenideSwitchToFrameTest.java b/src/test/java/showcase/neodymium/tests/iframe/SelenideSwitchToFrameTest.java index fff9b4d..401cd98 100644 --- a/src/test/java/showcase/neodymium/tests/iframe/SelenideSwitchToFrameTest.java +++ b/src/test/java/showcase/neodymium/tests/iframe/SelenideSwitchToFrameTest.java @@ -13,7 +13,7 @@ import showcase.neodymium.tests.AbstractTest; /** - * This show case explains with an example implementation how to test a web site using frames (iframe).
        + * This showcase explains with an example implementation how to test a website using frames (iframe).
        * Selenide offers a straight forward approach to handle such frames and within Neodymium this is simply applied.
        */ @Tag("iFrame") diff --git a/src/test/java/showcase/neodymium/tests/jsonassertion/JsonAssertionTest.java b/src/test/java/showcase/neodymium/tests/jsonassertion/JsonAssertionTest.java new file mode 100644 index 0000000..7ea2a5d --- /dev/null +++ b/src/test/java/showcase/neodymium/tests/jsonassertion/JsonAssertionTest.java @@ -0,0 +1,67 @@ +package showcase.neodymium.tests.jsonassertion; + +import com.xceptance.neodymium.junit5.NeodymiumTest; +import com.xceptance.neodymium.util.JsonAssert; +import io.qameta.allure.junit4.Tag; +import org.skyscreamer.jsonassert.JSONCompareMode; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +/** + * Comparing JSON files can be hard sometimes. To simplify it, JSONAssert was used and the differences between the files are added to the allure report. This + * showcase is used to demonstrate basic examples of comparing JSON files, where one shows the errors, which can be easily seen in the allure report. + */ +@Tag("JsonAssertion") +public class JsonAssertionTest +{ + // TODO fix nullpointer for getWebDriver if no browser is used or prevent start of browser which is not necessary here + + @NeodymiumTest + public void testEqualOnDifferingFiles() throws IOException + { + // read the JSON files to compare + Path expectedJsonPath = Path.of("src/test/resources/showcase/neodymium/tests/jsonassertion/expected.json"); + String expectedJson = Files.readString(expectedJsonPath, StandardCharsets.UTF_8); + + Path actualJsonPath = Path.of("src/test/resources/showcase/neodymium/tests/jsonassertion/actual.json"); + String actualJson = Files.readString(actualJsonPath, StandardCharsets.UTF_8); + + // check that the files are equal + // expected error is caught to make the test pass + // the differences are still added to the report and can be seen + AssertionError exception = assertThrows(AssertionError.class, () -> { + JsonAssert.assertEquals(expectedJson, actualJson, JSONCompareMode.STRICT_ORDER); + }); + assertEquals("java.lang.AssertionError: both json's are not equal (see attachment 'Json Compare') glossary.GlossDiv.GlossList.GlossEntry\n" + + "Expected: Acronym\n" + + " but none found\n" + + " ; glossary.GlossDiv.GlossList.GlossEntry.GlossDef.GlossSeeAlso[]: Expected 2 values but got 3 ; glossary.GlossDiv.title\n" + + "Expected: S\n" + + " got: T\n" + + " ; glossary.title\n" + + "Expected: example glossary\n" + + " got: example glosary\n" + + "\n" + + "(Timeout: 0 ms.)", exception.getMessage()); + } + + @NeodymiumTest + public void testNotEqualOnDifferingFiles() throws IOException + { + // read the JSON files to compare + Path expectedJsonPath = Path.of("src/test/resources/showcase/neodymium/tests/jsonassertion/expected.json"); + String expectedJson = Files.readString(expectedJsonPath, StandardCharsets.UTF_8); + + Path actualJsonPath = Path.of("src/test/resources/showcase/neodymium/tests/jsonassertion/actual.json"); + String actualJson = Files.readString(actualJsonPath, StandardCharsets.UTF_8); + + // check that the files are different + JsonAssert.assertNotEquals(expectedJson, actualJson, JSONCompareMode.STRICT_ORDER); + } +} diff --git a/src/test/java/showcase/neodymium/tests/lighthouse/LighthouseTest.java b/src/test/java/showcase/neodymium/tests/lighthouse/LighthouseTest.java new file mode 100644 index 0000000..ac2f7b8 --- /dev/null +++ b/src/test/java/showcase/neodymium/tests/lighthouse/LighthouseTest.java @@ -0,0 +1,36 @@ +package showcase.neodymium.tests.lighthouse; + +import com.codeborne.selenide.Selenide; +import com.xceptance.neodymium.junit5.NeodymiumTest; +import com.xceptance.neodymium.util.LighthouseUtils; +import io.qameta.allure.junit4.Tag; +import showcase.neodymium.tests.AbstractTest; + +/** + * Since accessibility and WCAG gets more important and is also enforced by the law, it is good to have a metric to quantify the accessibility of a website. + * Googles Lighthouse provides a tool to calculate this metric. This showcase demonstrates a very basic example how to use Lighthouse and generate a report. + */ +@Tag("WCAG") +@Tag("accessibility") +@Tag("Lighthouse") +public class LighthouseTest extends AbstractTest +{ + @NeodymiumTest + public void testLighthouse() + { + Selenide.open("https://www.xceptance.com/en/"); + + try + { + // calling createLightHouseReport() will create a Lighthouse report for the current page + // this will open a new tab and open the same page again in the new tab + // after generating the report, the additional tab will be closed and the test automatically proceeds with the initial tab + // ATTENTION: can currently cause problems for unique sites tied to a session like order confirmation pages for logged in customers + LighthouseUtils.createLightHouseReport("testReport"); + } + catch (Exception e) + { + throw new RuntimeException(e); + } + } +} diff --git a/src/test/java/showcase/neodymium/tests/localization/NeodymiumLocalizationTest.java b/src/test/java/showcase/neodymium/tests/localization/NeodymiumLocalizationTest.java index 9b8eb2e..6089c41 100644 --- a/src/test/java/showcase/neodymium/tests/localization/NeodymiumLocalizationTest.java +++ b/src/test/java/showcase/neodymium/tests/localization/NeodymiumLocalizationTest.java @@ -18,11 +18,11 @@ import showcase.pageobjects.components.Title; /** - * Most web sites provide their content in different languages to address different users. Due to the fact test + * Most websites provide their content in different languages to address different users. Due to the fact test * automation has often to work with localized content or even validate that general localized formats (e.G. the price - * format) are correct. Neodymium provides support to handle this. This show case demonstrates a possible approach.
        + * format) are correct. Neodymium provides support to handle this. This showcase demonstrates a possible approach.
        * The localization file is config/localization.yaml and Neodymium introduces a override mechanism. The most - * specific definition for a key and a locale will be taken. Otherwise a default value is taken or an exception is + * specific definition for a key and a locale will be taken. Otherwise, a default value is taken or an exception is * raised if no value for the key could be found within the localization file. *
      */ @@ -32,7 +32,7 @@ public class NeodymiumLocalizationTest extends AbstractTest { @NeodymiumTest - @Description(value = "Neodymium localization show case") + @Description(value = "Neodymium localization showcase") public void test() { /* diff --git a/src/test/java/showcase/neodymium/tests/pdf/PdfTextContentCheckTest.java b/src/test/java/showcase/neodymium/tests/pdf/PdfTextContentCheckTest.java index 3b9e6a4..337a045 100644 --- a/src/test/java/showcase/neodymium/tests/pdf/PdfTextContentCheckTest.java +++ b/src/test/java/showcase/neodymium/tests/pdf/PdfTextContentCheckTest.java @@ -22,9 +22,9 @@ * In some test cases may need to check the content of a PDF file provided by the system under test. Since Neodymium is * implemented in Java and the execution environment is configured with Maven any available 3rd party technology can be * added to the test automation.
      - * This show case gives an basic example how to implement an PDF content check using PDFbox.
      + * This showcase gives a basic example how to implement an PDF content check using PDFbox.
      * In order to use PDFbox you would need to add a dependency for org.apache.pdfbox to your project's - * pom.xml file. For this show case project we already prepared this and you can have a look if you're struggling + * pom.xml file. For this showcase project we already prepared this, and you can have a look if you're struggling * with the setup.>
      */ @Severity(SeverityLevel.NORMAL) diff --git a/src/test/java/showcase/neodymium/tests/popupblocker/PopupBlockerTest.java b/src/test/java/showcase/neodymium/tests/popupblocker/PopupBlockerTest.java new file mode 100644 index 0000000..09e8a3d --- /dev/null +++ b/src/test/java/showcase/neodymium/tests/popupblocker/PopupBlockerTest.java @@ -0,0 +1,56 @@ +package showcase.neodymium.tests.popupblocker; + +import com.codeborne.selenide.Selenide; +import com.xceptance.neodymium.junit5.NeodymiumTest; +import io.qameta.allure.junit4.Tag; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import showcase.neodymium.tests.AbstractTest; + +import java.util.Map; + +import static com.codeborne.selenide.Condition.visible; +import static com.codeborne.selenide.Selenide.$; +import static showcase.flows.PropertiesFlow.addTempProperty; +import static showcase.flows.PropertiesFlow.deleteTempPropertiesFile; + +/** + * For test automation some popups can cause problems, if they don't behave deterministically enough to be handled without drawbacks like too long waiting + * times. For this a JavaScript based popup blocker was implemented. An example usage can be seen in the following showcase. To use it the css selector of the + * close button for the specific popups have to be defined in the neodymium.properties or temp.properties starting with 'neodymium.popup.' and followed by an + * identifier for the popup like 'neodymium.popup.cookieBanner' in the example. + */ +@Tag("PopupBlocker") +public class PopupBlockerTest extends AbstractTest +{ + + public static final String TEMP_PROPERTIES_FILE = "temp-PopupBlockerTest-neodymium.properties"; + + @BeforeAll + public static void addPopupBlockerSelectorToTempProperties() + { + /* + * In general the properties should be defined directly in the neodymium.properties, but for the showcase to see some example values this is done + * here. + * The following call will create a temp properties file with the values: + * + * neodymium.popup.cookieBanner = #privacy-message .close + */ + addTempProperty(TEMP_PROPERTIES_FILE, + Map.of("neodymium.popup.cookieBanner", "#privacy-message .close")); + } + + @NeodymiumTest + public void testPopUpIsBlocked() + { + Selenide.open("https://www.xceptance.com/"); + Selenide.sleep(1500); + $("#privacy-message .close").shouldNotBe(visible); + } + + @AfterAll + public static void cleanUp() + { + deleteTempPropertiesFile(TEMP_PROPERTIES_FILE); + } +} diff --git a/src/test/java/showcase/neodymium/tests/random/FixedRandomTest.java b/src/test/java/showcase/neodymium/tests/random/FixedRandomTest.java index 14bb3e2..89dab1b 100644 --- a/src/test/java/showcase/neodymium/tests/random/FixedRandomTest.java +++ b/src/test/java/showcase/neodymium/tests/random/FixedRandomTest.java @@ -14,7 +14,7 @@ import showcase.neodymium.tests.AbstractTest; /** - * This show case shows the use of the Neodymium.getRandom() method.
      + * This showcase shows the use of the Neodymium.getRandom() method.
      * Random values are useful to run different test cases with different values.
      * In some cases it is necessary to be able to repeat a test with the same random value (e.g. debugging).
      * Here you can see how a fixed random value can be used.
      diff --git a/src/test/java/showcase/neodymium/tests/random/RandomJobOffersTest.java b/src/test/java/showcase/neodymium/tests/random/RandomJobOffersTest.java index 6b8fc20..566067e 100644 --- a/src/test/java/showcase/neodymium/tests/random/RandomJobOffersTest.java +++ b/src/test/java/showcase/neodymium/tests/random/RandomJobOffersTest.java @@ -17,7 +17,7 @@ import showcase.neodymium.tests.AbstractTest; /** - * This show case shows the use of the Neodymium.getRandom() method.
      + * This showcase shows the use of the Neodymium.getRandom() method.
      * Random values are useful to run different test cases with different values.
      * It is also useful to test a web application with different paths like a real user would.
      * The NeodymiumRandom class extends the functionality of java.util.Random.
      diff --git a/src/test/java/showcase/neodymium/tests/random/RandomProbabilityTest.java b/src/test/java/showcase/neodymium/tests/random/RandomProbabilityTest.java index ac20e4d..5eea85a 100644 --- a/src/test/java/showcase/neodymium/tests/random/RandomProbabilityTest.java +++ b/src/test/java/showcase/neodymium/tests/random/RandomProbabilityTest.java @@ -58,7 +58,7 @@ public void testRandomProbability() logger.error("Count of true: " + trueCount + " Count of false: " + falseCount); // Part 3: create a random boolean with probability 80 - // this means the ratio of true and false should be approximately about 80 to 20 in favor of true + // this means the ratio of true and false should be approximately 80 to 20 in favor of true trueCount = 0; falseCount = 0; logger.error("Part 3: Probability = 80 - 80% true and 20% false will be returned"); diff --git a/src/test/java/showcase/neodymium/tests/responsive/MobileDeviceTest.java b/src/test/java/showcase/neodymium/tests/responsive/MobileDeviceTest.java index d650fb8..1b90338 100644 --- a/src/test/java/showcase/neodymium/tests/responsive/MobileDeviceTest.java +++ b/src/test/java/showcase/neodymium/tests/responsive/MobileDeviceTest.java @@ -12,7 +12,7 @@ import showcase.neodymium.tests.AbstractTest; /** - * Most web sites provide their content in different resolutions for different devices.
      + * Most websites provide their content in different resolutions for different devices.
      * In order to test a cell phone for example, the emulation of various mobile devices integrated in Chrome can be * used.
      * Browser profiles are defined in the config/browser.properties file.
      diff --git a/src/test/java/showcase/neodymium/tests/screenshot/AdvancedScreenshotTest.java b/src/test/java/showcase/neodymium/tests/screenshot/AdvancedScreenshotTest.java new file mode 100644 index 0000000..3f4fac8 --- /dev/null +++ b/src/test/java/showcase/neodymium/tests/screenshot/AdvancedScreenshotTest.java @@ -0,0 +1,78 @@ +package showcase.neodymium.tests.screenshot; + +import com.codeborne.selenide.Selenide; +import com.codeborne.selenide.ex.ElementNotFound; +import com.xceptance.neodymium.junit5.NeodymiumTest; +import com.xceptance.neodymium.util.Neodymium; +import io.qameta.allure.junit4.Tag; +import org.aeonbits.owner.ConfigFactory; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import showcase.neodymium.tests.AbstractTest; + +import java.util.Map; + +import static com.codeborne.selenide.Condition.visible; +import static com.codeborne.selenide.Selenide.$; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static showcase.flows.PropertiesFlow.addTempProperty; +import static showcase.flows.PropertiesFlow.deleteTempPropertiesFile; + +/** + * This showcase demonstrates how to take full page screenshots and how to customise them. + */ +@Tag("AdvancedScreenshot") +@Tag("FullPageScreenshot") +public class AdvancedScreenshotTest extends AbstractTest +{ + public static final String TEMP_PROPERTIES_FILE = "temp-ScreenshotTest-neodymium.properties"; + + @BeforeAll + public static void addPopupBlockerSelectorToTempProperties() + { + /* + * In general the properties should be defined directly in the neodymium.properties, but for the showcase to see some example values this is done + * here. + * The following call will create a temp properties file with the values: + * + * neodymium.screenshots.enableAdvancedScreenshots=true + * neodymium.screenshots.fullpagecapture.enable=true + * neodymium.screenshots.fullpagecapture.highlightViewport=true + * neodymium.screenshots.fullpagecapture.highlightColor=#735369 + */ + addTempProperty(TEMP_PROPERTIES_FILE, + Map.of( + "neodymium.screenshots.enableAdvancedScreenshots", "true", + "neodymium.screenshots.fullpagecapture.enable", "true", + "neodymium.screenshots.fullpagecapture.highlightViewport", "true", + "neodymium.screenshots.fullpagecapture.highlightColor", "#735369" + )); + } + + @NeodymiumTest + public void testAdvancedScreenshots() + { + + // TODO fix screenshot + + ConfigFactory.setProperty(Neodymium.TEMPORARY_CONFIG_FILE_PROPERTY_NAME, "file:config/" + TEMP_PROPERTIES_FILE); + + Selenide.open("https://www.xceptance.com/en/"); + + ElementNotFound exception = assertThrows(ElementNotFound.class, () -> { + $("#notExistingSelector42").shouldBe(visible); + }); + Assertions.assertEquals( + "Element not found {#notExistingSelector42}\n" + + "Expected: visible\n" + + "(Timeout: 3 s.)", + exception.getMessage()); + } + + @AfterAll + public static void cleanUp() + { + deleteTempPropertiesFile(TEMP_PROPERTIES_FILE); + } +} diff --git a/src/test/java/showcase/neodymium/tests/shadowdom/ShadowDomCheckboxTest.java b/src/test/java/showcase/neodymium/tests/shadowdom/ShadowDomCheckboxTest.java index f5ded3c..b2775ba 100644 --- a/src/test/java/showcase/neodymium/tests/shadowdom/ShadowDomCheckboxTest.java +++ b/src/test/java/showcase/neodymium/tests/shadowdom/ShadowDomCheckboxTest.java @@ -26,9 +26,9 @@ /** * Shadow DOM is a technique for encapsulation. It allows the user to create a separate and independent DOM. This second - * DOM can be nested into the DOM tree of a web site without any side effects. This approach is used to build reusable + * DOM can be nested into the DOM tree of a website without any side effects. This approach is used to build reusable * components which can be integrated on every page without introducing side effect.
      - * This show case provides possible approaches how to perform tests for Shadow DOM elements.
      + * This showcase provides possible approaches how to perform tests for Shadow DOM elements.
      */ @Severity(SeverityLevel.TRIVIAL) @Owner("Test Developer") diff --git a/src/test/java/showcase/neodymium/tests/shadowdom/ShadowDomTextTest.java b/src/test/java/showcase/neodymium/tests/shadowdom/ShadowDomTextTest.java index 3d37d35..72c3df6 100644 --- a/src/test/java/showcase/neodymium/tests/shadowdom/ShadowDomTextTest.java +++ b/src/test/java/showcase/neodymium/tests/shadowdom/ShadowDomTextTest.java @@ -22,9 +22,9 @@ /** * Shadow DOM is a technique for encapsulation. It allows the user to create a separate and independent DOM. This second - * DOM can be nested into the DOM tree of a web site without any side effects. This approach is used to build reusable + * DOM can be nested into the DOM tree of a website without any side effects. This approach is used to build reusable * components which can be integrated on every page without introducing side effect.
      - * This show case provides possible approaches how to perform tests for Shadow DOM elements.
      + * This showcase provides possible approaches how to perform tests for Shadow DOM elements.
      */ @Severity(SeverityLevel.TRIVIAL) @Owner("Test Developer") diff --git a/src/test/java/showcase/neodymium/tests/slider/SliderTest.java b/src/test/java/showcase/neodymium/tests/slider/SliderTest.java index 99e36c4..b179be5 100644 --- a/src/test/java/showcase/neodymium/tests/slider/SliderTest.java +++ b/src/test/java/showcase/neodymium/tests/slider/SliderTest.java @@ -24,9 +24,9 @@ /** * Sliders are control elements to give the user the opportunity to select a value on a web page. Mostly there are used * horizontally but there are also vertical sliders. Manipulation of slider can be a little tricky using the pure - * Selenium API. Therefore Neodymium provides an approach that requires less knowledge about Selenium's paradigms.
      - * This show case provides possible approaches how to handle and interact with sliders and they indicators. The first - * and the second test demonstrate horizontal while the other tests show case vertical movements. + * Selenium API. Therefore, Neodymium provides an approach that requires less knowledge about Selenium's paradigms.
      + * This showcase provides possible approaches how to handle and interact with sliders and they indicators. The first + * and the second test demonstrate horizontal while the other tests showcase vertical movements. */ @Severity(SeverityLevel.TRIVIAL) @Owner("Test Developer") diff --git a/src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationExcludeTest.java b/src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationExcludeTest.java new file mode 100644 index 0000000..7c00a01 --- /dev/null +++ b/src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationExcludeTest.java @@ -0,0 +1,76 @@ +package showcase.neodymium.tests.urlvalidation; + +import com.codeborne.selenide.Selenide; +import com.xceptance.neodymium.junit5.NeodymiumTest; +import io.qameta.allure.junit4.Tag; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.opentest4j.AssertionFailedError; +import showcase.neodymium.tests.AbstractTest; + +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertThrows; +import static showcase.flows.PropertiesFlow.addTempProperty; +import static showcase.flows.PropertiesFlow.deleteTempPropertiesFile; + +/** + * Sometimes it can be useful to limit the test automation to certain URLs, especially if it does random navigation or if there could be misconfigured link. To + * prevent that the tests wandering off into the wild west of the web, URL exclude lists can be defined and used as demonstrated in this showcase. If any of the + * excluded URLs is opened the test will fail immediately. + */ +@Tag("UrlValidation") +public class UrlValidationExcludeTest extends AbstractTest +{ + public static final String TEMP_PROPERTIES_FILE = "temp-UrlValidationExcludeTest-neodymium.properties"; + + @BeforeAll + public static void setExcludeList() + { + /* + * In general the properties should be defined directly in the neodymium.properties, but for the showcase to see some example values this is done + * here. + * The following call will create a temp properties file with the values: + * + * neodymium.url.excludeList=https://posters.xceptance.io:8443.*Dining https://www.xceptance.com/en/ + * + * NOTE: The URLs needs to be provided as Regular Expressions, so be aware of special regex relevant characters! + * + * List of excluded URLS separated by whitespaces + * neodymium.url.excludeList = ^http://prod.example.com/[?]testmode=true ^https://stg.example.com + */ + addTempProperty(TEMP_PROPERTIES_FILE, + Map.of("neodymium.url.excludeList", "https://posters.xceptance.io:8443.*Dining https://www.xceptance.com/en/")); + } + + @NeodymiumTest + public void testExcludeList() + { + Selenide.open("https://posters.xceptance.io:8443/"); + Selenide.sleep(1000); + + // after opening the ULR it is validated if the URL is excluded and if so, an assertion error will be thrown and the test is stopped + // expected error is caught to make the test pass + AssertionFailedError exceptionRegex = assertThrows(AssertionFailedError.class, () -> { + Selenide.open("https://posters.xceptance.io:8443/topCategory/Dining?categoryId=2"); + }); + Assertions.assertEquals( + "Opened Link was to forbidden site: https://posters.xceptance.io:8443/topCategory/Dining?categoryId=2 ==> expected: but was: ", + exceptionRegex.getMessage()); + + // expected error is caught to make the test pass + AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { + Selenide.open("https://www.xceptance.com/en/"); + }); + Assertions.assertEquals( + "Opened Link was to forbidden site: https://www.xceptance.com/en/ ==> expected: but was: ", + exception.getMessage()); + } + + @AfterAll + public static void cleanUp() + { + deleteTempPropertiesFile(TEMP_PROPERTIES_FILE); + } +} diff --git a/src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationIncludeTest.java b/src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationIncludeTest.java new file mode 100644 index 0000000..335fa9a --- /dev/null +++ b/src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationIncludeTest.java @@ -0,0 +1,82 @@ +package showcase.neodymium.tests.urlvalidation; + +import com.codeborne.selenide.Selenide; +import com.xceptance.neodymium.junit5.NeodymiumTest; +import io.qameta.allure.junit4.Tag; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.opentest4j.AssertionFailedError; +import showcase.neodymium.tests.AbstractTest; + +import java.util.Map; + +import static com.codeborne.selenide.Selenide.$; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static showcase.flows.PropertiesFlow.addTempProperty; +import static showcase.flows.PropertiesFlow.deleteTempPropertiesFile; + +/** + * Sometimes it can be useful to limit the test automation to certain URLs, especially if it does random navigation or if there could be misconfigured link. To + * prevent that the tests wandering off into the wild west of the web, URL include lists can be defined and used as demonstrated in this showcase. If any URL + * which is not contained in the include list is opened, the test will fail immediately. + */ +@Tag("UrlValidation") +public class UrlValidationIncludeTest extends AbstractTest +{ + public static final String TEMP_PROPERTIES_FILE = "temp-UrlValidationIncludeTest-neodymium.properties"; + + @BeforeAll + public static void setIncludeList() + { + /* + * In general the properties should be defined directly in the neodymium.properties, but for the showcase to see some example values this is done + * here. + * The following call will create a temp properties file with the values: + * + * neodymium.url.includeList=https://posters.xceptance.io:8443 https://www.xceptance.com/en/$ + * + * NOTE: The URLs needs to be provided as Regular Expressions, so be aware of special regex relevant characters! + * + * List of included URLS separated by whitespaces + * neodymium.url.includeList = ^http://dev.example.com ^https://stg.example.com + */ + addTempProperty(TEMP_PROPERTIES_FILE, + Map.of("neodymium.url.includeList", "https://posters.xceptance.io:8443 https://www.xceptance.com/en/$")); + } + + @NeodymiumTest + public void testIncludeList() + { + Selenide.open("https://posters.xceptance.io:8443/"); + Selenide.sleep(1000); + + $(".navbar-toggler").click(); + $(".nav-link[href*='Dining']").click(); + + Selenide.open("https://www.xceptance.com/en/"); + + // after opening the ULR it is validated if the URL is included and if not, an assertion error will be thrown and the test is stopped + // clicking a link to a not included URL creates an error + AssertionFailedError exceptionClick = assertThrows(AssertionFailedError.class, () -> { + $("#navigation a[href*='xlt']").click(); + }); + Assertions.assertEquals( + "Opened Link was outside permitted URLs: https://www.xceptance.com/en/xlt/ ==> expected: but was: ", + exceptionClick.getMessage()); + + // opening a not included URL creates an error + AssertionFailedError exceptionOpenUrl = assertThrows(AssertionFailedError.class, () -> { + Selenide.open("https://github.com/Xceptance/neodymium"); + }); + Assertions.assertEquals( + "Opened Link was outside permitted URLs: https://github.com/Xceptance/neodymium ==> expected: but was: ", + exceptionOpenUrl.getMessage()); + } + + @AfterAll + public static void cleanUp() + { + deleteTempPropertiesFile(TEMP_PROPERTIES_FILE); + } +} diff --git a/src/test/java/showcase/neodymium/tests/xcmailr/XCMailrTest.java b/src/test/java/showcase/neodymium/tests/xcmailr/XCMailrTest.java index 8435162..772df4c 100644 --- a/src/test/java/showcase/neodymium/tests/xcmailr/XCMailrTest.java +++ b/src/test/java/showcase/neodymium/tests/xcmailr/XCMailrTest.java @@ -64,7 +64,7 @@ public class XCMailrTest extends AbstractTest // the text of the first email protected final static String textToSend = "This is the text you should send."; - // Define a test email address which is used through out the test + // Define a test email address which is used throughout the test protected final static String receiverEmail = ""; @BeforeAll diff --git a/src/test/resources/showcase/neodymium/tests/data/DataFilePriotityTest.csv b/src/test/resources/showcase/neodymium/tests/data/DataFilePriorityTest.csv similarity index 100% rename from src/test/resources/showcase/neodymium/tests/data/DataFilePriotityTest.csv rename to src/test/resources/showcase/neodymium/tests/data/DataFilePriorityTest.csv diff --git a/src/test/resources/showcase/neodymium/tests/data/DataFilePriotityTest.json b/src/test/resources/showcase/neodymium/tests/data/DataFilePriorityTest.json similarity index 100% rename from src/test/resources/showcase/neodymium/tests/data/DataFilePriotityTest.json rename to src/test/resources/showcase/neodymium/tests/data/DataFilePriorityTest.json diff --git a/src/test/resources/showcase/neodymium/tests/jsonassertion/actual.json b/src/test/resources/showcase/neodymium/tests/jsonassertion/actual.json new file mode 100644 index 0000000..09cbdf6 --- /dev/null +++ b/src/test/resources/showcase/neodymium/tests/jsonassertion/actual.json @@ -0,0 +1,25 @@ +{ + "glossary": { + "title": "example glosary", + "GlossDiv": { + "title": "T", + "GlossList": { + "GlossEntry": { + "ID": "SGML", + "SortAs": "SGML", + "GlossTerm": "Standard Generalized Markup Language", + "Abbrev": "ISO 8879:1986", + "GlossDef": { + "para": "A meta-markup language, used to create markup languages such as DocBook.", + "GlossSeeAlso": [ + "GML", + "XML", + "JSON" + ] + }, + "GlossSee": "markup" + } + } + } + } +} diff --git a/src/test/resources/showcase/neodymium/tests/jsonassertion/expected.json b/src/test/resources/showcase/neodymium/tests/jsonassertion/expected.json new file mode 100644 index 0000000..080288e --- /dev/null +++ b/src/test/resources/showcase/neodymium/tests/jsonassertion/expected.json @@ -0,0 +1,25 @@ +{ + "glossary": { + "title": "example glossary", + "GlossDiv": { + "title": "S", + "GlossList": { + "GlossEntry": { + "ID": "SGML", + "SortAs": "SGML", + "GlossTerm": "Standard Generalized Markup Language", + "Acronym": "SGML", + "Abbrev": "ISO 8879:1986", + "GlossDef": { + "para": "A meta-markup language, used to create markup languages such as DocBook.", + "GlossSeeAlso": [ + "GML", + "XML" + ] + }, + "GlossSee": "markup" + } + } + } + } +} From 37d86adea367b60ba039413e482e6dd097fdae07 Mon Sep 17 00:00:00 2001 From: RobertAvemarg Date: Thu, 12 Dec 2024 14:11:07 +0100 Subject: [PATCH 08/17] fixed failing showcases --- README.md | 2 +- config/neodymium.properties | 28 ++++---- .../tests/random/FixedRandomTest.java | 50 ++++++++----- .../tests/random/RandomJobOffersTest.java | 71 ------------------- .../random/RandomProductCategoryTest.java | 70 ++++++++++++++++++ .../neodymium/tests/slider/SliderTest.java | 35 ++++----- .../data/TestDataFileWithDifferentName.json | 24 ++++--- 7 files changed, 150 insertions(+), 130 deletions(-) delete mode 100644 src/test/java/showcase/neodymium/tests/random/RandomJobOffersTest.java create mode 100644 src/test/java/showcase/neodymium/tests/random/RandomProductCategoryTest.java diff --git a/README.md b/README.md index 0810ae6..3c00f10 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ cell phone for example, the emulation of various mobile devices integrated in Ch The `showcase.neodymium.tests.random` package contains the selection of random web elements from a website under test. * `FixedRandomTest.java` shows how a random test can be run again in the same way. -* `RandomJobOffersTest.java` demonstrates the selection of different job offers. +* `RandomProductCategoryTest.java` demonstrates the selection of different products at random. ## 9. Logging with log4j2 diff --git a/config/neodymium.properties b/config/neodymium.properties index 6a3bd7e..8196563 100644 --- a/config/neodymium.properties +++ b/config/neodymium.properties @@ -8,14 +8,16 @@ # Chrome WebDriver # To run any showcase the Chrome WebDriver must be installed before. # See: https://github.com/Xceptance/neodymium-library/wiki/How-to-set-up-a-WebDriver -# Configure +# Configure # neodymium.webDriver.chrome.pathToDriverServer = c:/path/to/chromedriver.exe # -# The following long value will be use to initialize Neodymiums Random instance. +# The following long value will be use to initialize Neodymiums Random instance. #neodymium.context.random.initialValue = 123456789 + # Neodymium allows to set a default locale to support the most common test cases # - NeodymiumLocalizationTest -neodymium.locale=en_US +neodymium.locale = en_US + # Neodymium can run an embedded proxy in the test execution process # HTTP Basic access Authentication information is automatically added to the HTTP header # RELATED SHOWCASES: @@ -23,14 +25,14 @@ neodymium.locale=en_US # - SelenideBasicAuthentication # - NeodymiumLocalProxyCertificateAuthentication # - NeodymiumLocalProxyCertificateAuthenticationHost -neodymium.localproxy=false -neodymium.url.host=authenticationtest.com -neodymium.basicauth.username=User -neodymium.basicauth.password=Pass -neodymium.localproxy.certificate=true -neodymium.localproxy.certificate.generate=true -neodymium.localproxy.certificate.archiveFile=./config/Certificate.pfx -neodymium.localproxy.certificate.archivetype=PKCS12 -neodymium.localproxy.certificate.name=e6f60fbd-f9f3-436f-aba5-452861ae4570 -neodymium.localproxy.certificate.password=MITMCertificatePassword +neodymium.localproxy = false +neodymium.url.host = authenticationtest.com +neodymium.basicauth.username = User +neodymium.basicauth.password = Pass +neodymium.localproxy.certificate = true +neodymium.localproxy.certificate.generate = true +neodymium.localproxy.certificate.archiveFile = ./config/Certificate.pfx +neodymium.localproxy.certificate.archivetype = PKCS12 +neodymium.localproxy.certificate.name = e6f60fbd-f9f3-436f-aba5-452861ae4570 +neodymium.localproxy.certificate.password = MITMCertificatePassword # diff --git a/src/test/java/showcase/neodymium/tests/random/FixedRandomTest.java b/src/test/java/showcase/neodymium/tests/random/FixedRandomTest.java index 89dab1b..70a8a41 100644 --- a/src/test/java/showcase/neodymium/tests/random/FixedRandomTest.java +++ b/src/test/java/showcase/neodymium/tests/random/FixedRandomTest.java @@ -1,23 +1,26 @@ package showcase.neodymium.tests.random; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Random; - -import org.junit.Assert; - import com.xceptance.neodymium.common.browser.SuppressBrowsers; import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.Neodymium; - import io.qameta.allure.Description; +import org.junit.Assert; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; import showcase.neodymium.tests.AbstractTest; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Map; +import java.util.Random; + +import static showcase.flows.PropertiesFlow.addTempProperty; +import static showcase.flows.PropertiesFlow.deleteTempPropertiesFile; + /** - * This showcase shows the use of the Neodymium.getRandom() method.
      - * Random values are useful to run different test cases with different values.
      - * In some cases it is necessary to be able to repeat a test with the same random value (e.g. debugging).
      - * Here you can see how a fixed random value can be used.
      + * This showcase shows the use of the Neodymium.getRandom() method.
      Random values are useful to run different test cases with different values.
      In some + * cases it is necessary to be able to repeat a test with the same random value (e.g. debugging).
      Here you can see how a fixed random value can be + * used.
      *
      * REQUIRED CONFIGURATION: config/neodymium.properties *
        @@ -28,13 +31,20 @@ @SuppressBrowsers public class FixedRandomTest extends AbstractTest { - @NeodymiumTest - public void configurationCheck() + public static final String TEMP_PROPERTIES_FILE = "temp-FixedRandomTest-neodymium.properties"; + + @BeforeAll + public static void addPopupBlockerSelectorToTempProperties() { - // by setting the neodymium.context.random.initialValue, the random result can be kept constant - // check if the initialValue is enabled in neodymium.properties - Assert.assertEquals("FixedRandomTest: neodymium.context.random.initialValue is not set", - Long.valueOf("123456789"), Neodymium.configuration().initialRandomValue()); + /* + * In general the properties should be defined directly in the neodymium.properties, but for the showcase to see some example values this is done + * here. + * The following call will create a temp properties file with the values: + * + * neodymium.popup.cookieBanner = #privacy-message .close + */ + addTempProperty(TEMP_PROPERTIES_FILE, + Map.of("neodymium.context.random.initialValue", "123456789")); } @NeodymiumTest @@ -83,4 +93,10 @@ public void testFixedRandom() Assert.assertEquals("Mia", listOfNames.get(8)); Assert.assertEquals("Emma", listOfNames.get(9)); } + + @AfterAll + public static void cleanUp() + { + deleteTempPropertiesFile(TEMP_PROPERTIES_FILE); + } } diff --git a/src/test/java/showcase/neodymium/tests/random/RandomJobOffersTest.java b/src/test/java/showcase/neodymium/tests/random/RandomJobOffersTest.java deleted file mode 100644 index 566067e..0000000 --- a/src/test/java/showcase/neodymium/tests/random/RandomJobOffersTest.java +++ /dev/null @@ -1,71 +0,0 @@ -package showcase.neodymium.tests.random; - -import static com.codeborne.selenide.Condition.exactText; -import static com.codeborne.selenide.Selenide.$; -import static com.codeborne.selenide.Selenide.$$; - -import org.junit.Assert; -import org.junit.jupiter.api.BeforeEach; - -import com.codeborne.selenide.ElementsCollection; -import com.xceptance.neodymium.junit5.NeodymiumTest; -import com.xceptance.neodymium.util.Neodymium; -import com.xceptance.neodymium.util.NeodymiumRandom; - -import io.qameta.allure.Description; -import showcase.flows.OpenPageFlow; -import showcase.neodymium.tests.AbstractTest; - -/** - * This showcase shows the use of the Neodymium.getRandom() method.
        - * Random values are useful to run different test cases with different values.
        - * It is also useful to test a web application with different paths like a real user would.
        - * The NeodymiumRandom class extends the functionality of java.util.Random.
        - * In this case the use of the nextInt() method is shown.
        - * To get to know more possibilities take a closer look at the class.
        - *
        - * REQUIRED CONFIGURATION: config/neodymium.properties - *
          - *
        • A value for neodymium.context.random.initialValue must NOT be set.
        • - *
        - * CAUTION: This test case fails if initialValue is set. - */ -public class RandomJobOffersTest extends AbstractTest -{ - @BeforeEach - public void configurationCheck() - { - // by setting the neodymium.context.random.initialValue, the random result can be kept constant - // check if the initialValue is NOT set in neodymium.properties so that a really random result is chosen - Assert.assertNull("FixedRandomTest: neodymium.context.random.initialValue is set", - Neodymium.configuration().initialRandomValue()); - } - - @NeodymiumTest - @Description(value = "Showcase for clicking a random element in the list of current job offers.") - public void testRandomJobs() - { - // open the demo page and prepare it for the test - OpenPageFlow.openXceptanceJobOffersPage(); - - // check if the heading "Aktuelle Stellenangebote" exists - $(".col-sm-4.tab-content h2").shouldHave(exactText("Aktuelle Stellenangebote")); - - ElementsCollection jobOffersList = $$(".tab-content>.jobs-plain-list>li>a"); - - // count the job offers in the list - final int jobOffersCount = jobOffersList.size(); - - // create a random number between 0 and job offers count in the list - final int randomNumber = NeodymiumRandom.nextInt(jobOffersCount); - - // remember the selected headline - final String headline = jobOffersList.get(randomNumber).getText(); - - // click randomNumber'th link in the job offers list - jobOffersList.get(randomNumber).click(); - - // check if job offer detail page contains same headline - $(".job-listing-col.job-col-header>h2").shouldHave(exactText(headline)); - } -} diff --git a/src/test/java/showcase/neodymium/tests/random/RandomProductCategoryTest.java b/src/test/java/showcase/neodymium/tests/random/RandomProductCategoryTest.java new file mode 100644 index 0000000..b454e84 --- /dev/null +++ b/src/test/java/showcase/neodymium/tests/random/RandomProductCategoryTest.java @@ -0,0 +1,70 @@ +package showcase.neodymium.tests.random; + +import com.codeborne.selenide.ClickOptions; +import com.codeborne.selenide.ElementsCollection; +import com.codeborne.selenide.Selenide; +import com.xceptance.neodymium.junit5.NeodymiumTest; +import com.xceptance.neodymium.util.Neodymium; +import com.xceptance.neodymium.util.NeodymiumRandom; +import io.qameta.allure.Description; +import org.junit.Assert; +import org.junit.jupiter.api.BeforeEach; +import showcase.neodymium.tests.AbstractTest; + +import static com.codeborne.selenide.Condition.partialText; +import static com.codeborne.selenide.Selenide.$; +import static com.codeborne.selenide.Selenide.$$; + +/** + * This showcase shows the use of the Neodymium.getRandom() method.
        Random values are useful to run different test cases with different values.
        It is + * also useful to test a web application with different paths like a real user would.
        The NeodymiumRandom class extends the functionality of + * java.util.Random.
        In this case the use of the nextInt() method is shown.
        To get to know more possibilities take a closer look at the + * class.
        + *
        + * REQUIRED CONFIGURATION: config/neodymium.properties + *
          + *
        • A value for neodymium.context.random.initialValue must NOT be set.
        • + *
        + * CAUTION: This test case fails if initialValue is set. + */ +public class RandomProductCategoryTest extends AbstractTest +{ + @BeforeEach + public void configurationCheck() + { + // by setting the neodymium.context.random.initialValue, the random result can be kept constant + // check if the initialValue is NOT set in neodymium.properties so that a really random result is chosen + Assert.assertNull("FixedRandomTest: neodymium.context.random.initialValue is set", + Neodymium.configuration().initialRandomValue()); + } + + @NeodymiumTest + @Description(value = "Showcase for clicking a random product") + public void testRandomProduct() + { + // open the demo page and prepare it for the test + Selenide.open("https://posters.xceptance.io:8443/"); + + // check if the heading "The Poster Demo Store" exists + $("#header-brand").shouldHave(partialText("The Poster Demo Store")); + + // get all categories + ElementsCollection categories = $$(".category-tile .category-tile-title"); + + // count the categories in the list + final int categoriesCount = categories.size(); + + // create a random number between 0 and categories count in the list + final int randomNumber = NeodymiumRandom.nextInt(categoriesCount); + + // remember the selected headline + final String headline = categories.get(randomNumber).getText(); + + // click randomNumber'th link in the categories list + categories.get(randomNumber).scrollTo().scrollIntoView("{block: 'center'}"); + categories.get(randomNumber).click(ClickOptions.usingJavaScript()); + + // check if category page contains same headline + $("#title-category-name").shouldHave(partialText(headline)); + } +} diff --git a/src/test/java/showcase/neodymium/tests/slider/SliderTest.java b/src/test/java/showcase/neodymium/tests/slider/SliderTest.java index b179be5..739264e 100644 --- a/src/test/java/showcase/neodymium/tests/slider/SliderTest.java +++ b/src/test/java/showcase/neodymium/tests/slider/SliderTest.java @@ -1,18 +1,10 @@ package showcase.neodymium.tests.slider; -import static com.codeborne.selenide.Condition.attribute; -import static com.codeborne.selenide.Condition.hidden; -import static com.codeborne.selenide.Condition.visible; -import static com.codeborne.selenide.Selenide.$; - -import org.junit.Test; - import com.codeborne.selenide.Selenide; import com.codeborne.selenide.SelenideElement; import com.codeborne.selenide.ex.ElementNotFound; import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.SelenideAddons; - import io.qameta.allure.Description; import io.qameta.allure.Owner; import io.qameta.allure.Severity; @@ -21,12 +13,14 @@ import io.qameta.allure.junit4.Tag; import showcase.neodymium.tests.AbstractTest; +import static com.codeborne.selenide.Condition.*; +import static com.codeborne.selenide.Selenide.$; + /** - * Sliders are control elements to give the user the opportunity to select a value on a web page. Mostly there are used - * horizontally but there are also vertical sliders. Manipulation of slider can be a little tricky using the pure - * Selenium API. Therefore, Neodymium provides an approach that requires less knowledge about Selenium's paradigms.
        - * This showcase provides possible approaches how to handle and interact with sliders and they indicators. The first - * and the second test demonstrate horizontal while the other tests showcase vertical movements. + * Sliders are control elements to give the user the opportunity to select a value on a web page. Mostly there are used horizontally but there are also vertical + * sliders. Manipulation of slider can be a little tricky using the pure Selenium API. Therefore, Neodymium provides an approach that requires less knowledge + * about Selenium's paradigms.
        This showcase provides possible approaches how to handle and interact with sliders and they indicators. The first and the + * second test demonstrate horizontal while the other tests showcase vertical movements. */ @Severity(SeverityLevel.TRIVIAL) @Owner("Test Developer") @@ -46,7 +40,7 @@ public void testHorizontalRightMovement() openSliderPage(); // the slider element that will be used for the test - SelenideElement elementUnderTest = $(".balSlider a[role=slider]").scrollIntoView("{block:'center'}"); + SelenideElement elementUnderTest = $(".balSlider [role=slider]").scrollIntoView("{block:'center'}"); // Interaction: move the slider to the right // @@ -60,7 +54,7 @@ public void testHorizontalRightMovement() SelenideAddons.dragAndDropUntilCondition(elementUnderTest, elementUnderTest, 40, 0, INTERACTION_PAUSE, MAX_RETRIES, attribute("aria-valuenow", "8")); } - @Test + @NeodymiumTest @Description(value = "Showcase for a horizontal drag and drop of a web slider to the left side.") public void testHorizontalLeftMovement() { @@ -68,7 +62,8 @@ public void testHorizontalLeftMovement() openSliderPage(); // the slider element that will be used for the test - SelenideElement elementUnderTest = $(".balSlider a[role=slider]").scrollIntoView("{block:'center'}"); + // .balSlider .k-slider-track + SelenideElement elementUnderTest = $(".balSlider [role=slider]").scrollIntoView("{block:'center'}"); // Interaction: move the slider to the left // @@ -82,7 +77,7 @@ public void testHorizontalLeftMovement() SelenideAddons.dragAndDropUntilCondition(elementUnderTest, elementUnderTest, -40, 0, INTERACTION_PAUSE, MAX_RETRIES, attribute("aria-valuenow", "-8")); } - @Test + @NeodymiumTest @Description(value = "Showcase for a vertical drag and drop of a web slider to the top.") public void testVerticalUpMovement() { @@ -90,7 +85,7 @@ public void testVerticalUpMovement() openSliderPage(); // the slider element that will be used for the test - SelenideElement elementUnderTest = $("#equalizer .k-slider-vertical:first-child a").scrollIntoView("{block:'center'}"); + SelenideElement elementUnderTest = $("#equalizer .k-slider-vertical:first-child [role='slider']").scrollIntoView("{block:'center'}"); // Interaction: move the slider upwards // @@ -112,7 +107,7 @@ public void testVerticalDownMovement() openSliderPage(); // the slider element that will be used for the test - SelenideElement elementUnderTest = $("#equalizer .k-slider-vertical:first-child a").scrollIntoView("{block:'center'}"); + SelenideElement elementUnderTest = $("#equalizer .k-slider-vertical:first-child [role='slider']").scrollIntoView("{block:'center'}"); // Interaction: move the slider downwards // @@ -123,7 +118,7 @@ public void testVerticalDownMovement() // pause between movements: 3000ms // retries: 5 // condition until the movement is performed: aria-valuenow = -6 - SelenideAddons.dragAndDropUntilCondition(elementUnderTest, elementUnderTest, 0, 10, INTERACTION_PAUSE, MAX_RETRIES, attribute("aria-valuenow", "-6")); + SelenideAddons.dragAndDropUntilCondition(elementUnderTest, elementUnderTest, 0, 10, INTERACTION_PAUSE, MAX_RETRIES, attribute("aria-valuenow", "-5")); } // a helper function to open the page and close the GDPR dialog to avoid duplicate code diff --git a/src/test/resources/showcase/neodymium/tests/data/TestDataFileWithDifferentName.json b/src/test/resources/showcase/neodymium/tests/data/TestDataFileWithDifferentName.json index a828ba9..590ac76 100644 --- a/src/test/resources/showcase/neodymium/tests/data/TestDataFileWithDifferentName.json +++ b/src/test/resources/showcase/neodymium/tests/data/TestDataFileWithDifferentName.json @@ -7,19 +7,23 @@ "serviceTiles": [ { "heading": "Manual & Automated Testing", - "explanation": "We test your product based on individual requirements, with an ideal mix of manual and automated testing." + "explanation": "We test your product based on individual requirements, with an ideal mix of manual and automated testing.", + "position": 0 }, { "heading": "Load & Performance Testing", - "explanation": "We simulate the traffic you expect on your platform and deliver detailed test reports whether it is a web-based or API-based test. Find out how your site really performs on server and client side." + "explanation": "We simulate the traffic you expect on your platform and deliver detailed test reports whether it is a web-based or API-based test. Find out how your site really performs on server and client side.", + "position": 1 }, { "heading": "Test Guidance & Support", - "explanation": "We love to share our knowledge and can help you establish or improve your own quality assurance processes. Let us inspire you to test better!" + "explanation": "We love to share our knowledge and can help you establish or improve your own quality assurance processes. Let us inspire you to test better!", + "position": 2 }, { "heading": "Our Testing Tool", - "explanation": "XLT covers all your web performance testing needs. It is extensively used by us and continuously improved. Functional test automation can also be done with XLT and is used when real browser performance testing is needed. XLT is Open Source under Apache License 2.0." + "explanation": "XLT covers all your web performance testing needs. It is extensively used by us and continuously improved. Functional test automation can also be done with XLT and is used when real browser performance testing is needed. XLT is Open Source under Apache License 2.0.", + "position": 3 } ], "numberServices": 4 @@ -32,19 +36,23 @@ "serviceTiles": [ { "heading": "Manuelle Tests & Testautomatisierung", - "explanation": "Wir arbeiten mit einem ide­alen Mix aus ma­nu­ellen und auto­ma­ti­sierten Test­ver­fah­ren, ganz nach Ihren per­sön­lichen Wün­schen und Vor­stel­lungen." + "explanation": "Wir arbeiten mit einem ide­alen Mix aus ma­nu­ellen und auto­ma­ti­sierten Test­ver­fah­ren, ganz nach Ihren per­sön­lichen Wün­schen und Vor­stel­lungen.", + "position": 0 }, { "heading": "Last- & Performancetests", - "explanation": "Wir simulieren jede Benutzer- und Transaktions­menge und liefern umfassende Test­reports. Erfahren Sie, was Ihre Website leistet." + "explanation": "Wir simulieren jede Benutzer- und Transaktions­menge und liefern umfassende Test­reports. Erfahren Sie, was Ihre Website leistet.", + "position": 1 }, { "heading": "Testunterstützung", - "explanation": "Wir teilen unsere Erfahrungen und helfen Ihnen, QS-Prozesse zu etablieren und zu optimieren. Lassen Sie sich von uns inspirieren." + "explanation": "Wir teilen unsere Erfahrungen und helfen Ihnen, QS-Prozesse zu etablieren und zu optimieren. Lassen Sie sich von uns inspirieren.", + "position": 2 }, { "heading": "Unser Testwerkzeug", - "explanation": "XLT deckt Ihre Last- und Performance­test-Anfor­de­rungen ab und ermöglicht ebenso WebDriver-basierte Testautomation. XLT ist Open Source." + "explanation": "XLT deckt Ihre Last- und Performance­test-Anfor­de­rungen ab und ermöglicht ebenso WebDriver-basierte Testautomation. XLT ist Open Source.", + "position": 3 } ], "numberServices": 4 From 2d547a79a303d055ba153073c03cd2c6bd244c92 Mon Sep 17 00:00:00 2001 From: RobertAvemarg Date: Mon, 13 Jan 2025 16:21:08 +0100 Subject: [PATCH 09/17] fix: tests after website change --- ...LocalProxyBasicAuthenticationHostTest.java | 59 ++++++++----- ...miumLocalProxyBasicAuthenticationTest.java | 80 +++++++++-------- ...calProxyCertificateAuthenticationTest.java | 88 +++++++++++-------- ...GenerateCertificateAuthenticationTest.java | 70 +++++++++------ .../SelenideBasicAuthenticationTest.java | 70 ++++++++------- .../data/AccessDataViaDataObjectsTest.java | 33 ++++--- .../AccessDataViaDataSetAnnotationTest.java | 25 +++--- .../data/AccessDataViaDataUtilsTest.java | 27 +++--- .../tests/data/AccessDataViaJsonPathTest.java | 30 +++---- .../tests/data/DataFilePriorityTest.java | 20 ++--- .../NeodymiumLocalizationTest.java | 24 +++-- .../tests/random/FixedRandomTest.java | 2 +- .../screenshot/AdvancedScreenshotTest.java | 2 +- .../shadowdom/ShadowDomCheckboxTest.java | 30 +++---- .../UrlValidationIncludeTest.java | 4 +- .../data/AccessDataViaDataObjectsTest.json | 22 ++--- .../AccessDataViaDataSetAnnotationTest.json | 2 +- .../tests/data/AccessDataViaDataUtilsTest.xml | 22 ++--- .../tests/data/DataFilePriorityTest.csv | 4 +- .../tests/data/DataFilePriorityTest.json | 2 +- .../data/TestDataFileWithDifferentName.json | 26 +++--- 21 files changed, 340 insertions(+), 302 deletions(-) diff --git a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationHostTest.java b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationHostTest.java index 7f7f4d8..2bb6879 100644 --- a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationHostTest.java +++ b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationHostTest.java @@ -1,32 +1,32 @@ package showcase.neodymium.tests.basicauth; -import static com.codeborne.selenide.Condition.visible; -import static com.codeborne.selenide.Selenide.$; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - import com.browserup.bup.proxy.auth.AuthType; import com.codeborne.selenide.Selenide; import com.xceptance.neodymium.util.Neodymium; - import io.qameta.allure.Description; import io.qameta.allure.Owner; import io.qameta.allure.Severity; import io.qameta.allure.SeverityLevel; import io.qameta.allure.junit4.Tag; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import showcase.neodymium.tests.AbstractTest; import showcase.pageobjects.components.Title; +import java.util.Map; + +import static com.codeborne.selenide.Condition.visible; +import static com.codeborne.selenide.Selenide.$; +import static showcase.flows.PropertiesFlow.addTempProperty; +import static showcase.flows.PropertiesFlow.deleteTempPropertiesFile; + /** - * If the system under test requires HTTP Basic Authentication then using an embedded local proxy provided by Neodymium - * is one possible approach.
        - * Especially if the standard way (see: {@link SelenideBasicAuthenticationTest} showcase) is not applicable due to - * restrictions of the used WebDriver. The proxy is created on the fly and passed to the WebDriver.
        - * All requests running in the Neodymium test execution process are automatically routed through this proxy. The local - * proxy provided by Neodymium can perform automatic authorizations.
        - * The local proxy adds the credentials to the HTTP header to authenticate the request when opening the site.
        + * If the system under test requires HTTP Basic Authentication then using an embedded local proxy provided by Neodymium is one possible approach.
        Especially + * if the standard way (see: {@link SelenideBasicAuthenticationTest} showcase) is not applicable due to restrictions of the used WebDriver. The proxy is created + * on the fly and passed to the WebDriver.
        All requests running in the Neodymium test execution process are automatically routed through this proxy. The + * local proxy provided by Neodymium can perform automatic authorizations.
        The local proxy adds the credentials to the HTTP header to authenticate the + * request when opening the site.
        *
        * REQUIRED CONFIGURATION: config/neodymium.properties *
          @@ -41,12 +41,24 @@ @Tag("basic authorization") public class NeodymiumLocalProxyBasicAuthenticationHostTest extends AbstractTest { - @Before - public void configurationCheck() + public static final String TEMP_PROPERTIES_FILE = "temp-LocalProxyBasicAuthHost-neodymium.properties"; + + @BeforeAll + public static void addLocalProxyBasicAuthHostTempProperties() { - // required configuration checks - Assert.assertEquals("NeodymiumLocalProxyBasicAuthenticationHostTest: neodymium.localproxy is not set to true", - true, Neodymium.configuration().useLocalProxy()); + /* + * In general the properties should be defined directly in the neodymium.properties, but for the showcase to see some example values this is done + * here. + * The following call will create a temp properties file with the values: + * + * neodymium.localproxy.enable=true + * neodymium.localproxy.certificate=true + * neodymium.localproxy.certificate.generate=true + */ + addTempProperty(TEMP_PROPERTIES_FILE, + Map.of( + "neodymium.localproxy", "true" + )); } @Test @@ -66,4 +78,11 @@ public void test() // check that basic alert message is visible $(".alert-success").shouldBe(visible); } + + @AfterAll + public static void cleanUp() + { + deleteTempPropertiesFile(TEMP_PROPERTIES_FILE); + deleteTempPropertiesFile("embeddedLocalProxySelfSignedRootCertificate.p12"); + } } diff --git a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationTest.java b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationTest.java index 4aa3e91..3b0d349 100644 --- a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationTest.java +++ b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationTest.java @@ -1,32 +1,29 @@ package showcase.neodymium.tests.basicauth; -import static com.codeborne.selenide.Condition.visible; -import static com.codeborne.selenide.Selenide.$; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - import com.codeborne.selenide.Selenide; -import com.xceptance.neodymium.util.Neodymium; - import io.qameta.allure.Description; import io.qameta.allure.Owner; import io.qameta.allure.Severity; import io.qameta.allure.SeverityLevel; import io.qameta.allure.junit4.Tag; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import showcase.neodymium.tests.AbstractTest; -import showcase.pageobjects.components.Title; + +import java.util.Map; + +import static com.codeborne.selenide.Condition.visible; +import static com.codeborne.selenide.Selenide.$; +import static showcase.flows.PropertiesFlow.addTempProperty; +import static showcase.flows.PropertiesFlow.deleteTempPropertiesFile; /** - * If the system under test requires HTTP Basic Authentication then using an embedded local proxy provided by Neodymium - * is one possible approach.
          - * Especially if the standard way (see: {@link SelenideBasicAuthenticationTest} showcase) is not applicable due to - * restrictions of the used WebDriver. The proxy is created on the fly and passed to the WebDriver.
          - * All requests running in the Neodymium test execution process are automatically routed through this proxy. The local - * proxy provided by Neodymium can perform automatic authorizations.
          - * The host, username and password settings (from the Neodymium configuration) are taken by default to invoke the auto - * authorization via the proxy for this host. It is also possible to configure this manually and add additional systems + * If the system under test requires HTTP Basic Authentication then using an embedded local proxy provided by Neodymium is one possible approach.
          Especially + * if the standard way (see: {@link SelenideBasicAuthenticationTest} showcase) is not applicable due to restrictions of the used WebDriver. The proxy is created + * on the fly and passed to the WebDriver.
          All requests running in the Neodymium test execution process are automatically routed through this proxy. The + * local proxy provided by Neodymium can perform automatic authorizations.
          The host, username and password settings (from the Neodymium configuration) are + * taken by default to invoke the auto authorization via the proxy for this host. It is also possible to configure this manually and add additional systems * during runtime (see: {@link NeodymiumLocalProxyBasicAuthenticationHostTest} showcase).
          *
          * REQUIRED CONFIGURATION: config/neodymium.properties @@ -45,24 +42,28 @@ @Tag("basic authorization") public class NeodymiumLocalProxyBasicAuthenticationTest extends AbstractTest { - @Before - public void configurationCheck() - { - // required configuration checks - Assert.assertEquals("NeodymiumLocalProxyBasicAuthenticationTest: neodymium.localproxy is not set to true", - true, Neodymium.configuration().useLocalProxy()); - - // validate the host of https://authenticationtest.com/HTTPAuth/ - Assert.assertEquals("NeodymiumLocalProxyBasicAuthenticationTest: neodymium.url.host is not set", - "authenticationtest.com", Neodymium.configuration().host()); - - // validate username for https://authenticationtest.com/HTTPAuth/ - Assert.assertEquals("NeodymiumLocalProxyBasicAuthenticationTest: neodymium.basicauth.username is not set", - "User", Neodymium.configuration().basicAuthUsername()); + public static final String TEMP_PROPERTIES_FILE = "temp-LocalProxy-neodymium.properties"; - // validate password for user at https://authenticationtest.com/HTTPAuth/ - Assert.assertEquals("NeodymiumLocalProxyBasicAuthenticationTest: neodymium.basicauth.password is not set", - "Pass", Neodymium.configuration().basicAuthPassword()); + @BeforeAll + public static void addLocalProxyTempProperties() + { + /* + * In general the properties should be defined directly in the neodymium.properties, but for the showcase to see some example values this is done + * here. + * The following call will create a temp properties file with the values: + * + * neodymium.localproxy=true + * neodymium.url.host=authenticationtest.com + * neodymium.basicauth.username=User + * neodymium.basicauth.password=Pass + */ + addTempProperty(TEMP_PROPERTIES_FILE, + Map.of( + "neodymium.localproxy", "true", + "neodymium.url.host", "authenticationtest.com", + "neodymium.basicauth.username", "User", + "neodymium.basicauth.password", "Pass" + )); } @Test @@ -73,9 +74,16 @@ public void test() Selenide.open("https://authenticationtest.com/HTTPAuth/"); // validate the page title - new Title().validateTitle("Authentication Test"); + // new Title().validateTitle("Authentication Test"); // check that basic alert message is visible $(".alert-success").shouldBe(visible); } + + @AfterAll + public static void cleanUp() + { + deleteTempPropertiesFile(TEMP_PROPERTIES_FILE); + deleteTempPropertiesFile("embeddedLocalProxySelfSignedRootCertificate.p12"); + } } diff --git a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyCertificateAuthenticationTest.java b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyCertificateAuthenticationTest.java index 8a57c3b..ade00b0 100644 --- a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyCertificateAuthenticationTest.java +++ b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyCertificateAuthenticationTest.java @@ -1,33 +1,32 @@ package showcase.neodymium.tests.basicauth; -import static com.codeborne.selenide.Condition.visible; -import static com.codeborne.selenide.Selenide.$; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - import com.browserup.bup.proxy.auth.AuthType; import com.codeborne.selenide.Selenide; import com.xceptance.neodymium.util.Neodymium; - import io.qameta.allure.Description; import io.qameta.allure.Owner; import io.qameta.allure.Severity; import io.qameta.allure.SeverityLevel; import io.qameta.allure.junit4.Tag; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import showcase.neodymium.tests.AbstractTest; import showcase.pageobjects.components.Title; +import java.util.Map; + +import static com.codeborne.selenide.Condition.visible; +import static com.codeborne.selenide.Selenide.$; +import static showcase.flows.PropertiesFlow.addTempProperty; +import static showcase.flows.PropertiesFlow.deleteTempPropertiesFile; + /** - * The default usage of the embedded local proxy provided by Neodymium disables proxy certificate verification. Due to - * this fact it possible to intercept the communication of the test cases. Some WebDriver will inform you about - * this.
          - * Therefore Neodymium provides a way to configure a certificate that will be used to authenticate the communication - * between the parties involved. All requests running in the Neodymium test execution process are automatically routed - * through this proxy which acts as a certified MITM (Man in the Middle). The advantage of this approach is that an - * officially signed certificate can be used to secure the communication.
          - * If a self-signed certificate is sufficient for your test case this can be automatically generated by Neodymium (see: + * The default usage of the embedded local proxy provided by Neodymium disables proxy certificate verification. Due to this fact it possible to intercept the + * communication of the test cases. Some WebDriver will inform you about this.
          Therefore Neodymium provides a way to configure a certificate that will be + * used to authenticate the communication between the parties involved. All requests running in the Neodymium test execution process are automatically routed + * through this proxy which acts as a certified MITM (Man in the Middle). The advantage of this approach is that an officially signed certificate can be used to + * secure the communication.
          If a self-signed certificate is sufficient for your test case this can be automatically generated by Neodymium (see: * {@link NeodymiumLocalProxyGenerateCertificateAuthenticationTest} showcase).
          *
          * REQUIRED CONFIGURATION: config/neodymium.properties @@ -48,30 +47,34 @@ @Tag("embedded local proxy") public class NeodymiumLocalProxyCertificateAuthenticationTest extends AbstractTest { - @Before - public void configurationCheck() - { - // required configuration checks - Assert.assertEquals("NeodymiumLocalProxyCertificateAuthenticationTest: neodymium.localproxy is not set to true", - true, Neodymium.configuration().useLocalProxy()); + public static final String TEMP_PROPERTIES_FILE = "temp-LocalProxyCert-neodymium.properties"; - Assert.assertEquals("NeodymiumLocalProxyCertificateAuthenticationTest: neodymium.localproxy.certificate is not set to true", - true, Neodymium.configuration().useLocalProxyWithSelfSignedCertificate()); - - Assert.assertEquals("NeodymiumLocalProxyCertificateAuthenticationTest: neodymium.localproxy.certificate.generate is not set to false", - false, Neodymium.configuration().localProxyGenerateSelfSignedCertificate()); - - Assert.assertEquals("NeodymiumLocalProxyCertificateAuthenticationTest: neodymium.localproxy.certificate.archiveFile check failed", - "./config/Certificate.pfx", Neodymium.configuration().localProxyCertificateArchiveFile()); - - Assert.assertEquals("NeodymiumLocalProxyCertificateAuthenticationTest: neodymium.localproxy.certificate.archivetype check failed", - "PKCS12", Neodymium.configuration().localProxyCertificateArchiveType()); - - Assert.assertEquals("NeodymiumLocalProxyCertificateAuthenticationTest: neodymium.localproxy.certificate.name check failed", - "e6f60fbd-f9f3-436f-aba5-452861ae4570", Neodymium.configuration().localProxyCertificateName()); - - Assert.assertEquals("NeodymiumLocalProxyCertificateAuthenticationTest: neodymium.localproxy.certificate.password check failed", - "MITMCertificatePassword", Neodymium.configuration().localProxyCertificatePassword()); + @BeforeAll + public static void addLocalProxyCertTempProperties() + { + /* + * In general the properties should be defined directly in the neodymium.properties, but for the showcase to see some example values this is done + * here. + * The following call will create a temp properties file with the values: + * + * neodymium.localproxy = true + * neodymium.localproxy.certificate = true + * neodymium.localproxy.certificate.generate = false + * neodymium.localproxy.certificate.archiveFile = ./config/Certificate.pfx + * neodymium.localproxy.certificate.archivetype = PKCS12 + * neodymium.localproxy.certificate.name = e6f60fbd-f9f3-436f-aba5-452861ae4570 + * neodymium.localproxy.certificate.password = MITMCertificatePassword + */ + addTempProperty(TEMP_PROPERTIES_FILE, + Map.of( + "neodymium.localproxy", "true", + "neodymium.localproxy.certificate", "true", + "neodymium.localproxy.certificate.generate", "false", + "neodymium.localproxy.certificate.archiveFile", "./config/Certificate.pfx", + "neodymium.localproxy.certificate.archivetype", "PKCS12", + "neodymium.localproxy.certificate.name", "e6f60fbd-f9f3-436f-aba5-452861ae4570", + "neodymium.localproxy.certificate.password", "MITMCertificatePassword" + )); } @Test @@ -89,4 +92,11 @@ public void test() // check that basic alert message is visible $(".alert-success").shouldBe(visible); } + + @AfterAll + public static void cleanUp() + { + deleteTempPropertiesFile(TEMP_PROPERTIES_FILE); + deleteTempPropertiesFile("embeddedLocalProxySelfSignedRootCertificate.p12"); + } } diff --git a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyGenerateCertificateAuthenticationTest.java b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyGenerateCertificateAuthenticationTest.java index da24481..8ca04b2 100644 --- a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyGenerateCertificateAuthenticationTest.java +++ b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyGenerateCertificateAuthenticationTest.java @@ -1,34 +1,33 @@ package showcase.neodymium.tests.basicauth; -import static com.codeborne.selenide.Condition.visible; -import static com.codeborne.selenide.Selenide.$; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - import com.browserup.bup.proxy.auth.AuthType; import com.codeborne.selenide.Selenide; import com.xceptance.neodymium.util.Neodymium; - import io.qameta.allure.Description; import io.qameta.allure.Owner; import io.qameta.allure.Severity; import io.qameta.allure.SeverityLevel; import io.qameta.allure.junit4.Tag; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import showcase.neodymium.tests.AbstractTest; import showcase.pageobjects.components.Title; +import java.util.Map; + +import static com.codeborne.selenide.Condition.visible; +import static com.codeborne.selenide.Selenide.$; +import static showcase.flows.PropertiesFlow.addTempProperty; +import static showcase.flows.PropertiesFlow.deleteTempPropertiesFile; + /** - * The default usage of the embedded local proxy provided by Neodymium disables proxy certificate verification. Due to - * this fact it possible to intercept the communication of the test cases. Some WebDriver will inform you about - * this.
          - * Therefore Neodymium provides a way to configure a certificate that will be used to authenticate the communication - * between the parties involved. All requests running in the Neodymium test execution process are automatically routed - * through this proxy which acts as a certified MITM (Man in the Middle). The advantage of this approach is that an - * officially signed certificate can be used to secure the communication.
          - * If a certificate is required that is signed by an authority for your test case this can be configured using Neodymium - * (see: {@link NeodymiumLocalProxyCertificateAuthenticationTest} showcase)
          + * The default usage of the embedded local proxy provided by Neodymium disables proxy certificate verification. Due to this fact it possible to intercept the + * communication of the test cases. Some WebDriver will inform you about this.
          Therefore Neodymium provides a way to configure a certificate that will be + * used to authenticate the communication between the parties involved. All requests running in the Neodymium test execution process are automatically routed + * through this proxy which acts as a certified MITM (Man in the Middle). The advantage of this approach is that an officially signed certificate can be used to + * secure the communication.
          If a certificate is required that is signed by an authority for your test case this can be configured using Neodymium (see: + * {@link NeodymiumLocalProxyCertificateAuthenticationTest} showcase)
          *
          * REQUIRED CONFIGURATION: config/neodymium.properties *
            @@ -44,18 +43,26 @@ @Tag("embedded local proxy") public class NeodymiumLocalProxyGenerateCertificateAuthenticationTest extends AbstractTest { - @Before - public void configurationCheck() - { - // required configuration checks - Assert.assertEquals("NeodymiumLocalProxyGenerateCertificateAuthenticationTest: neodymium.localproxy is not set to true", - true, Neodymium.configuration().useLocalProxy()); + public static final String TEMP_PROPERTIES_FILE = "temp-LocalProxyGenCert-neodymium.properties"; - Assert.assertEquals("NeodymiumLocalProxyGenerateCertificateAuthenticationTest: neodymium.localproxy.certificate is not set to true", - true, Neodymium.configuration().useLocalProxyWithSelfSignedCertificate()); - - Assert.assertEquals("NeodymiumLocalProxyGenerateCertificateAuthenticationTest: neodymium.localproxy.certificate.generate is not set to true", - true, Neodymium.configuration().localProxyGenerateSelfSignedCertificate()); + @BeforeAll + public static void addLocalProxyGenCertTempProperties() + { + /* + * In general the properties should be defined directly in the neodymium.properties, but for the showcase to see some example values this is done + * here. + * The following call will create a temp properties file with the values: + * + * neodymium.localproxy.enable=true + * neodymium.localproxy.certificate=true + * neodymium.localproxy.certificate.generate=true + */ + addTempProperty(TEMP_PROPERTIES_FILE, + Map.of( + "neodymium.localproxy", "true", + "neodymium.localproxy.certificate", "true", + "neodymium.localproxy.certificate.generate", "true" + )); } @Test @@ -73,4 +80,11 @@ public void test() // check that basic alert message is visible $(".alert-success").shouldBe(visible); } + + @AfterAll + public static void cleanUp() + { + deleteTempPropertiesFile(TEMP_PROPERTIES_FILE); + deleteTempPropertiesFile("embeddedLocalProxySelfSignedRootCertificate.p12"); + } } diff --git a/src/test/java/showcase/neodymium/tests/basicauth/SelenideBasicAuthenticationTest.java b/src/test/java/showcase/neodymium/tests/basicauth/SelenideBasicAuthenticationTest.java index acfe5a6..9b597b5 100644 --- a/src/test/java/showcase/neodymium/tests/basicauth/SelenideBasicAuthenticationTest.java +++ b/src/test/java/showcase/neodymium/tests/basicauth/SelenideBasicAuthenticationTest.java @@ -1,33 +1,32 @@ package showcase.neodymium.tests.basicauth; -import static com.codeborne.selenide.Condition.visible; -import static com.codeborne.selenide.Selenide.$; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - import com.codeborne.selenide.Selenide; import com.xceptance.neodymium.util.Neodymium; - import io.qameta.allure.Description; import io.qameta.allure.Owner; import io.qameta.allure.Severity; import io.qameta.allure.SeverityLevel; import io.qameta.allure.junit4.Tag; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import showcase.neodymium.tests.AbstractTest; import showcase.pageobjects.components.Title; +import java.util.Map; + +import static com.codeborne.selenide.Condition.visible; +import static com.codeborne.selenide.Selenide.$; +import static showcase.flows.PropertiesFlow.addTempProperty; +import static showcase.flows.PropertiesFlow.deleteTempPropertiesFile; + /** - * If the system under test requires HTTP Basic Authentication then using Selenide together with the Neodymium - * configuration is a possible approach. The basic authentication credentials can be set within the Neodymium - * configuration and used when calling - * {@link Selenide#open(String relativeOrAbsoluteUrl, String domain, String login, String password)} as this showcase - * demonstrates.
            - * Selenide prefixes the basic authentication credentials to the URL. Due to security reasons this method is not - * supported for all browsers (e.g. Edge) anymore. Some browsers require enabling this method before it can be used. If - * your test project needs testing with such a browser you can consider the usage of the embedded local proxy provided - * by Neodymium as a solution (see: {@link NeodymiumLocalProxyBasicAuthenticationHostTest} showcase).
            + * If the system under test requires HTTP Basic Authentication then using Selenide together with the Neodymium configuration is a possible approach. The basic + * authentication credentials can be set within the Neodymium configuration and used when calling + * {@link Selenide#open(String relativeOrAbsoluteUrl, String domain, String login, String password)} as this showcase demonstrates.
            Selenide prefixes the + * basic authentication credentials to the URL. Due to security reasons this method is not supported for all browsers (e.g. Edge) anymore. Some browsers require + * enabling this method before it can be used. If your test project needs testing with such a browser you can consider the usage of the embedded local proxy + * provided by Neodymium as a solution (see: {@link NeodymiumLocalProxyBasicAuthenticationHostTest} showcase).
            *
            * REQUIRED CONFIGURATION: config/neodymium.properties *
              @@ -41,21 +40,26 @@ @Tag("basic authorization") public class SelenideBasicAuthenticationTest extends AbstractTest { + public static final String TEMP_PROPERTIES_FILE = "temp-SelenideAuth-neodymium.properties"; - @Before - public void configurationCheck() + @BeforeAll + public static void addSelenideAuthTempProperties() { - // required configuration checks - Assert.assertEquals("NeodymiumLocalProxyBasicAuthentication: neodymium.localproxy is not set to false", - false, Neodymium.configuration().useLocalProxy()); - - // valid user name for https://authenticationtest.com/HTTPAuth/ - Assert.assertEquals("NeodymiumLocalProxyBasicAuthentication: neodymium.basicauth.username is not set", - "User", Neodymium.configuration().basicAuthUsername()); - - // valid password for user at https://authenticationtest.com/HTTPAuth/ | User - Assert.assertEquals("NeodymiumLocalProxyBasicAuthentication: neodymium.basicauth.password is not set", - "Pass", Neodymium.configuration().basicAuthPassword()); + /* + * In general the properties should be defined directly in the neodymium.properties, but for the showcase to see some example values this is done + * here. + * The following call will create a temp properties file with the values: + * + * neodymium.localproxy=false + * neodymium.basicauth.username=User + * neodymium.basicauth.password=Pass + */ + addTempProperty(TEMP_PROPERTIES_FILE, + Map.of( + "neodymium.localproxy", "false", + "neodymium.basicauth.username", "User", + "neodymium.basicauth.password", "Pass" + )); } @Test @@ -72,4 +76,10 @@ public void test() // check that basic alert message is visible $(".alert-success").shouldBe(visible); } + + @AfterAll + public static void cleanUp() + { + deleteTempPropertiesFile(TEMP_PROPERTIES_FILE); + } } diff --git a/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataObjectsTest.java b/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataObjectsTest.java index f169c96..d306eb3 100644 --- a/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataObjectsTest.java +++ b/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataObjectsTest.java @@ -1,26 +1,23 @@ package showcase.neodymium.tests.data; -import static com.codeborne.selenide.CollectionCondition.size; -import static com.codeborne.selenide.Condition.matchText; -import static com.codeborne.selenide.Selenide.$; -import static com.codeborne.selenide.Selenide.$$; - -import org.junit.Test; - import com.codeborne.selenide.Selenide; +import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.DataUtils; - import io.qameta.allure.Description; import io.qameta.allure.junit4.Tag; import showcase.neodymium.tests.AbstractTest; import showcase.neodymium.tests.data.dataobjects.HomePageTestData; import showcase.neodymium.tests.data.dataobjects.ServiceTile; +import static com.codeborne.selenide.CollectionCondition.size; +import static com.codeborne.selenide.Condition.matchText; +import static com.codeborne.selenide.Selenide.$; +import static com.codeborne.selenide.Selenide.$$; + /** - * This is a showcase to explain how to deal with test data using the Neodymium built-in features.
              - * The example focuses on test data retrieval based on data objects.
              - * In this case the test data are converted from a JSON file into Java POJOs HomePageTestData and ServiceTile.
              - * This is an example for working with a more complex test object that contains a list of serviceTiles. + * This is a showcase to explain how to deal with test data using the Neodymium built-in features.
              The example focuses on test data retrieval based on data + * objects.
              In this case the test data are converted from a JSON file into Java POJOs HomePageTestData and ServiceTile.
              This is an example for working + * with a more complex test object that contains a list of serviceTiles. */ @Tag("data object test data access") public class AccessDataViaDataObjectsTest extends AbstractTest @@ -28,7 +25,7 @@ public class AccessDataViaDataObjectsTest extends AbstractTest // by default all available data sets will be executed, so there is no need to call them // explicitly via the @DataSet annotation - @Test + @NeodymiumTest @Description(value = "Get test data using Java Pojo") public void test() { @@ -41,21 +38,21 @@ public void test() Selenide.open("https://www.xceptance.com/" + language); // check for message and comment - $(".landing-intro>h1").should(matchText(testDataHomePage.getTeaserMessage())); - $(".landing-intro>p").should(matchText(testDataHomePage.getTeaserComment())); + $("#introduction h1").should(matchText(testDataHomePage.getTeaserMessage())); + $("#introduction p").should(matchText(testDataHomePage.getTeaserComment())); // check for service tiles on the page // the ServiceTile test data are provided within HomePageTestData as a list for (ServiceTile serviceTile : testDataHomePage.getServiceTiles()) { // check heading with its position - $$(".caption .icon>h2").get(serviceTile.getPosition()).should(matchText(serviceTile.getHeading())); + $$("h2").get(serviceTile.getPosition()).should(matchText(serviceTile.getHeading())); // check explanation text with its position - $$(".caption > p").get(serviceTile.getPosition()).should(matchText(serviceTile.getExplanation())); + $$(".explanation").get(serviceTile.getPosition()).should(matchText(serviceTile.getExplanation())); } // check the number of services - $$(".caption").shouldHave(size(testDataHomePage.getNumberServices())); + $$(".explanation").shouldHave(size(testDataHomePage.getNumberServices())); } } diff --git a/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataSetAnnotationTest.java b/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataSetAnnotationTest.java index 6aea4f0..c303564 100644 --- a/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataSetAnnotationTest.java +++ b/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataSetAnnotationTest.java @@ -1,29 +1,26 @@ package showcase.neodymium.tests.data; -import static com.codeborne.selenide.Condition.matchText; -import static com.codeborne.selenide.Selenide.$; - -import org.junit.Test; - import com.codeborne.selenide.Selenide; import com.xceptance.neodymium.common.testdata.DataSet; import com.xceptance.neodymium.common.testdata.SuppressDataSets; import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.DataUtils; - import io.qameta.allure.Description; import showcase.neodymium.tests.AbstractTest; +import static com.codeborne.selenide.Condition.matchText; +import static com.codeborne.selenide.Selenide.$; + /** - * This is a showcase to explain how to deal with test data using the Neodymium built-in features.
              - * The example shows how to select test data with @DataSet annotation + * This is a showcase to explain how to deal with test data using the Neodymium built-in features.
              The example shows how to select test data with @DataSet + * annotation */ // disables data set support for the whole class @SuppressDataSets public class AccessDataViaDataSetAnnotationTest extends AbstractTest { // this method will run only once and without any data set because of the SuppressDataSets annotation on the class - @Test + @NeodymiumTest @Description(value = "Get test data using @DataSet annotation") public void noDataSets() { @@ -31,7 +28,7 @@ public void noDataSets() Selenide.open("https://www.xceptance.com/en"); // check headline - $(".landing-intro>h1").should(matchText("Committed to Software Quality")); + $("#introduction h1").should(matchText("Committed to Software Quality")); } @NeodymiumTest @@ -43,8 +40,8 @@ public void onlyFirstDataSet() Selenide.open("https://www.xceptance.com/" + DataUtils.asString("language")); // check headline and description - $(".landing-intro>h1").should(matchText(DataUtils.asString("headline"))); - $(".landing-intro>p").should(matchText(DataUtils.asString("description"))); + $("#introduction h1").should(matchText(DataUtils.asString("headline"))); + $("#introduction p").should(matchText(DataUtils.asString("description"))); } @NeodymiumTest @@ -56,7 +53,7 @@ public void allDataSets() Selenide.open("https://www.xceptance.com/" + DataUtils.asString("language")); // check headline and description - $(".landing-intro>h1").should(matchText(DataUtils.asString("headline"))); - $(".landing-intro>p").should(matchText(DataUtils.asString("description"))); + $("#introduction h1").should(matchText(DataUtils.asString("headline"))); + $("#introduction p").should(matchText(DataUtils.asString("description"))); } } diff --git a/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataUtilsTest.java b/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataUtilsTest.java index 24624c1..41d635d 100644 --- a/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataUtilsTest.java +++ b/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataUtilsTest.java @@ -1,23 +1,20 @@ package showcase.neodymium.tests.data; -import static com.codeborne.selenide.CollectionCondition.size; -import static com.codeborne.selenide.Condition.matchText; -import static com.codeborne.selenide.Selenide.$; -import static com.codeborne.selenide.Selenide.$$; - import com.codeborne.selenide.Selenide; import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.DataUtils; - import io.qameta.allure.Description; import io.qameta.allure.junit4.Tag; import showcase.neodymium.tests.AbstractTest; +import static com.codeborne.selenide.CollectionCondition.size; +import static com.codeborne.selenide.Condition.matchText; +import static com.codeborne.selenide.Selenide.$; +import static com.codeborne.selenide.Selenide.$$; + /** - * This is a showcase to explain how to deal with test data using the Neodymium built-in features.
              - * The example focuses on the very basic direct test data retrieval.
              - * In this case the test data are taken from the XML file.
              - * The method DataUtils.asString() is used + * This is a showcase to explain how to deal with test data using the Neodymium built-in features.
              The example focuses on the very basic direct test data + * retrieval.
              In this case the test data are taken from the XML file.
              The method DataUtils.asString() is used */ @Tag("direct test data access") public class AccessDataViaDataUtilsTest extends AbstractTest @@ -32,24 +29,24 @@ public void test() Selenide.open("https://www.xceptance.com/" + language); // check message and comment - $(".landing-intro>h1").should(matchText(DataUtils.asString("teaserMessage"))); - $(".landing-intro>p").should(matchText(DataUtils.asString("teaserComment"))); + $("#introduction h1").should(matchText(DataUtils.asString("teaserMessage"))); + $("#introduction p").should(matchText(DataUtils.asString("teaserComment"))); // check service tiles on the page int i = 0; while (DataUtils.exists("serviceTile_" + i + "_heading")) { // check heading text - $$(".caption .icon>h2").get(i).should(matchText(DataUtils.asString("serviceTile_" + i + "_heading"))); + $$("h2").get(i).should(matchText(DataUtils.asString("serviceTile_" + i + "_heading"))); // check explanation text - $$(".caption > p").get(i).should(matchText(DataUtils.asString("serviceTile_" + i + "_explanation"))); + $$(".explanation").get(i).should(matchText(DataUtils.asString("serviceTile_" + i + "_explanation"))); // next serviceTile i++; } // check the number of services using an integer value provided by DataUtils - $$(".caption").shouldHave(size(DataUtils.asInt("numberServices"))); + $$(".explanation").shouldHave(size(DataUtils.asInt("numberServices"))); } } diff --git a/src/test/java/showcase/neodymium/tests/data/AccessDataViaJsonPathTest.java b/src/test/java/showcase/neodymium/tests/data/AccessDataViaJsonPathTest.java index b03dc47..60fea6a 100644 --- a/src/test/java/showcase/neodymium/tests/data/AccessDataViaJsonPathTest.java +++ b/src/test/java/showcase/neodymium/tests/data/AccessDataViaJsonPathTest.java @@ -1,27 +1,23 @@ package showcase.neodymium.tests.data; -import static com.codeborne.selenide.CollectionCondition.size; -import static com.codeborne.selenide.Condition.matchText; -import static com.codeborne.selenide.Selenide.$; -import static com.codeborne.selenide.Selenide.$$; - import com.codeborne.selenide.Selenide; import com.xceptance.neodymium.common.testdata.DataFile; import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.DataUtils; - import io.qameta.allure.Description; import io.qameta.allure.junit4.Tag; import showcase.neodymium.tests.AbstractTest; import showcase.neodymium.tests.data.dataobjects.ServiceTile; +import static com.codeborne.selenide.CollectionCondition.size; +import static com.codeborne.selenide.Condition.matchText; +import static com.codeborne.selenide.Selenide.$; +import static com.codeborne.selenide.Selenide.$$; + /** - * This showcase explains how to access test data using the features built into the Neodymium framework.
              - * By default, Neodymium looks for a data file that has the same name as the test case and is located in the same - * package in the resources folder.
              - * This example shows the reading from a JSON file that does not meet the naming conventions.
              - * Therefore it is specified using the @DataFile annotation.
              - * The method DataUtils.get() uses the JsonPath here. + * This showcase explains how to access test data using the features built into the Neodymium framework.
              By default, Neodymium looks for a data file that + * has the same name as the test case and is located in the same package in the resources folder.
              This example shows the reading from a JSON file that does + * not meet the naming conventions.
              Therefore it is specified using the @DataFile annotation.
              The method DataUtils.get() uses the JsonPath here. */ @Tag("data object test data access") // tell Neodymium to use a different named data file under src/test/resources/ instead the standard one @@ -40,22 +36,22 @@ public void test() Selenide.open("https://www.xceptance.com/" + language); // check for message and comment - $(".landing-intro>h1").should(matchText(DataUtils.get("$.teaserMessage", String.class))); - $(".landing-intro>p").should(matchText(DataUtils.get("$.teaserComment", String.class))); + $("#introduction h1").should(matchText(DataUtils.get("$.teaserMessage", String.class))); + $("#introduction p").should(matchText(DataUtils.get("$.teaserComment", String.class))); // select a service tile ServiceTile serviceTile = DataUtils.get("$.serviceTiles[2]", ServiceTile.class); // check the heading with the right text - $$(".caption .icon>h2").get(2).should(matchText(serviceTile.getHeading())); + $$("h2").get(2).should(matchText(serviceTile.getHeading())); // check explanation with the right text - $$(".caption > p").get(2).should(matchText(serviceTile.getExplanation())); + $$(".explanation").get(2).should(matchText(serviceTile.getExplanation())); // get integer test data using DataUtils.get() via JsonPath int numberServices = DataUtils.get("$.numberServices", Integer.class); // check the number of services - $$(".caption").shouldHave(size(numberServices)); + $$(".explanation").shouldHave(size(numberServices)); } } diff --git a/src/test/java/showcase/neodymium/tests/data/DataFilePriorityTest.java b/src/test/java/showcase/neodymium/tests/data/DataFilePriorityTest.java index 98afce9..62fc5b4 100644 --- a/src/test/java/showcase/neodymium/tests/data/DataFilePriorityTest.java +++ b/src/test/java/showcase/neodymium/tests/data/DataFilePriorityTest.java @@ -1,24 +1,20 @@ package showcase.neodymium.tests.data; -import static com.codeborne.selenide.Condition.matchText; -import static com.codeborne.selenide.Selenide.$; - import com.codeborne.selenide.Selenide; import com.xceptance.neodymium.common.testdata.DataSet; import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.Neodymium; - import io.qameta.allure.Description; import io.qameta.allure.junit4.Tag; import showcase.neodymium.tests.AbstractTest; +import static com.codeborne.selenide.Condition.matchText; +import static com.codeborne.selenide.Selenide.$; + /** - * This showcase explains how to access test data using the features built into the Neodymium framework.
              - * By default, Neodymium looks for a data file that has the same name as the test case and is located in the same - * package in the resources folder.
              - * This example shows the reading from a CSV file, although a matching JSON file exists.
              - * The CSV file is taken in preference to XML and JSON.
              - * The use of the method Neodymium.dataValue() is shown here. + * This showcase explains how to access test data using the features built into the Neodymium framework.
              By default, Neodymium looks for a data file that + * has the same name as the test case and is located in the same package in the resources folder.
              This example shows the reading from a CSV file, although a + * matching JSON file exists.
              The CSV file is taken in preference to XML and JSON.
              The use of the method Neodymium.dataValue() is shown here. */ @Tag("direct test data access") public class DataFilePriorityTest extends AbstractTest @@ -37,7 +33,7 @@ public void test() Selenide.open("https://www.xceptance.com/" + language); // use Neodymium.dataValue to get the other test data values from the actual data set - $(".landing-intro>h1").should(matchText(Neodymium.dataValue("teaserMessage"))); - $(".landing-intro>p").should(matchText(Neodymium.dataValue("teaserComment"))); + $("#introduction h1").should(matchText(Neodymium.dataValue("teaserMessage"))); + $("#introduction p").should(matchText(Neodymium.dataValue("teaserComment"))); } } diff --git a/src/test/java/showcase/neodymium/tests/localization/NeodymiumLocalizationTest.java b/src/test/java/showcase/neodymium/tests/localization/NeodymiumLocalizationTest.java index 6089c41..5e099a1 100644 --- a/src/test/java/showcase/neodymium/tests/localization/NeodymiumLocalizationTest.java +++ b/src/test/java/showcase/neodymium/tests/localization/NeodymiumLocalizationTest.java @@ -1,14 +1,9 @@ package showcase.neodymium.tests.localization; -import static com.codeborne.selenide.Condition.text; -import static com.codeborne.selenide.Condition.visible; -import static com.codeborne.selenide.Selenide.$; - import com.codeborne.selenide.Selenide; import com.codeborne.selenide.SelenideElement; import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.Neodymium; - import io.qameta.allure.Description; import io.qameta.allure.Owner; import io.qameta.allure.Severity; @@ -17,13 +12,16 @@ import showcase.neodymium.tests.AbstractTest; import showcase.pageobjects.components.Title; +import static com.codeborne.selenide.Condition.text; +import static com.codeborne.selenide.Condition.visible; +import static com.codeborne.selenide.Selenide.$; + /** - * Most websites provide their content in different languages to address different users. Due to the fact test - * automation has often to work with localized content or even validate that general localized formats (e.G. the price - * format) are correct. Neodymium provides support to handle this. This showcase demonstrates a possible approach.
              - * The localization file is config/localization.yaml and Neodymium introduces a override mechanism. The most - * specific definition for a key and a locale will be taken. Otherwise, a default value is taken or an exception is - * raised if no value for the key could be found within the localization file. + * Most websites provide their content in different languages to address different users. Due to the fact test automation has often to work with localized + * content or even validate that general localized formats (e.G. the price format) are correct. Neodymium provides support to handle this. This showcase + * demonstrates a possible approach.
              The localization file is config/localization.yaml and Neodymium introduces a override mechanism. The most + * specific definition for a key and a locale will be taken. Otherwise, a default value is taken or an exception is raised if no value for the key could be + * found within the localization file. *
            */ @Severity(SeverityLevel.NORMAL) @@ -50,8 +48,8 @@ public void test() new Title().validateTitle(titleText); // get headline and subtitle element only needs to be done once - SelenideElement headLine = $("div.landing-intro > h1"); - SelenideElement subTitle = $("div.landing-intro > p"); + SelenideElement headLine = $("#introduction h1"); + SelenideElement subTitle = $("#introduction p"); // check headline and subtitle are visible headLine.shouldBe(visible); diff --git a/src/test/java/showcase/neodymium/tests/random/FixedRandomTest.java b/src/test/java/showcase/neodymium/tests/random/FixedRandomTest.java index 70a8a41..d13f0aa 100644 --- a/src/test/java/showcase/neodymium/tests/random/FixedRandomTest.java +++ b/src/test/java/showcase/neodymium/tests/random/FixedRandomTest.java @@ -34,7 +34,7 @@ public class FixedRandomTest extends AbstractTest public static final String TEMP_PROPERTIES_FILE = "temp-FixedRandomTest-neodymium.properties"; @BeforeAll - public static void addPopupBlockerSelectorToTempProperties() + public static void addRandomSeedTempProperties() { /* * In general the properties should be defined directly in the neodymium.properties, but for the showcase to see some example values this is done diff --git a/src/test/java/showcase/neodymium/tests/screenshot/AdvancedScreenshotTest.java b/src/test/java/showcase/neodymium/tests/screenshot/AdvancedScreenshotTest.java index 3f4fac8..22ae5e9 100644 --- a/src/test/java/showcase/neodymium/tests/screenshot/AdvancedScreenshotTest.java +++ b/src/test/java/showcase/neodymium/tests/screenshot/AdvancedScreenshotTest.java @@ -29,7 +29,7 @@ public class AdvancedScreenshotTest extends AbstractTest public static final String TEMP_PROPERTIES_FILE = "temp-ScreenshotTest-neodymium.properties"; @BeforeAll - public static void addPopupBlockerSelectorToTempProperties() + public static void addScreenshotTempProperties() { /* * In general the properties should be defined directly in the neodymium.properties, but for the showcase to see some example values this is done diff --git a/src/test/java/showcase/neodymium/tests/shadowdom/ShadowDomCheckboxTest.java b/src/test/java/showcase/neodymium/tests/shadowdom/ShadowDomCheckboxTest.java index b2775ba..e4141f7 100644 --- a/src/test/java/showcase/neodymium/tests/shadowdom/ShadowDomCheckboxTest.java +++ b/src/test/java/showcase/neodymium/tests/shadowdom/ShadowDomCheckboxTest.java @@ -1,34 +1,30 @@ package showcase.neodymium.tests.shadowdom; -import static com.codeborne.selenide.Condition.exist; -import static com.codeborne.selenide.Condition.value; -import static com.codeborne.selenide.Condition.visible; -import static com.codeborne.selenide.Selenide.$; - -import org.junit.Test; -import org.openqa.selenium.Keys; -import org.openqa.selenium.interactions.Actions; - import com.codeborne.selenide.Selectors; import com.codeborne.selenide.Selenide; import com.codeborne.selenide.SelenideElement; import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.Neodymium; - import io.qameta.allure.Description; import io.qameta.allure.Owner; import io.qameta.allure.Severity; import io.qameta.allure.SeverityLevel; import io.qameta.allure.junit4.DisplayName; import io.qameta.allure.junit4.Tag; +import org.openqa.selenium.Keys; +import org.openqa.selenium.interactions.Actions; import showcase.neodymium.tests.AbstractTest; import showcase.pageobjects.components.Title; +import static com.codeborne.selenide.Condition.exist; +import static com.codeborne.selenide.Condition.value; +import static com.codeborne.selenide.Condition.visible; +import static com.codeborne.selenide.Selenide.$; + /** - * Shadow DOM is a technique for encapsulation. It allows the user to create a separate and independent DOM. This second - * DOM can be nested into the DOM tree of a website without any side effects. This approach is used to build reusable - * components which can be integrated on every page without introducing side effect.
            - * This showcase provides possible approaches how to perform tests for Shadow DOM elements.
            + * Shadow DOM is a technique for encapsulation. It allows the user to create a separate and independent DOM. This second DOM can be nested into the DOM tree of + * a website without any side effects. This approach is used to build reusable components which can be integrated on every page without introducing side + * effect.
            This showcase provides possible approaches how to perform tests for Shadow DOM elements.
            */ @Severity(SeverityLevel.TRIVIAL) @Owner("Test Developer") @@ -51,7 +47,7 @@ public void testNestedShadowDOM() /* * Nested shadow DOM demo test - * + * * Since shadow DOM can be nested into any DOM it's possible to have a shadow DOM within a shadow DOM. The * following tests demonstrates how you can handle this. */ @@ -78,7 +74,7 @@ public void testNestedShadowDOM() $(Selectors.shadowCss(target, shadowHost, nestedShadowHost)).shouldNotBe(visible); } - @Test + @NeodymiumTest @Description(value = "Simple showcase for usage of shadow DOM") public void testSimpleShadowDOM() { @@ -93,7 +89,7 @@ public void testSimpleShadowDOM() /* * Basic shadow DOM demo test - * + * * This is a straight forward approach how to validate shadow DOM elements. */ diff --git a/src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationIncludeTest.java b/src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationIncludeTest.java index 335fa9a..9553d82 100644 --- a/src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationIncludeTest.java +++ b/src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationIncludeTest.java @@ -59,10 +59,10 @@ public void testIncludeList() // after opening the ULR it is validated if the URL is included and if not, an assertion error will be thrown and the test is stopped // clicking a link to a not included URL creates an error AssertionFailedError exceptionClick = assertThrows(AssertionFailedError.class, () -> { - $("#navigation a[href*='xlt']").click(); + $("#navigation a[href*='products']").click(); }); Assertions.assertEquals( - "Opened Link was outside permitted URLs: https://www.xceptance.com/en/xlt/ ==> expected: but was: ", + "Opened Link was outside permitted URLs: https://www.xceptance.com/en/products/ ==> expected: but was: ", exceptionClick.getMessage()); // opening a not included URL creates an error diff --git a/src/test/resources/showcase/neodymium/tests/data/AccessDataViaDataObjectsTest.json b/src/test/resources/showcase/neodymium/tests/data/AccessDataViaDataObjectsTest.json index d7edcdc..6879a6e 100644 --- a/src/test/resources/showcase/neodymium/tests/data/AccessDataViaDataObjectsTest.json +++ b/src/test/resources/showcase/neodymium/tests/data/AccessDataViaDataObjectsTest.json @@ -3,26 +3,26 @@ "testId": "en/JSON test data access using Java Pojo", "language": "en", "teaserMessage": "Committed to Software Quality", - "teaserComment": "We help our clients optimize software testing and quality assurance", + "teaserComment": "We Help Our Clients Optimize Software Testing and Quality Assurance.", "serviceTiles": [ { "heading": "Manual & Automated Testing", - "explanation": "We test your product based on individual requirements, with an ideal mix of manual and automated testing.", + "explanation": "We test your product based on individual requirements using an ideal mix of manual and automated testing. Learn More", "position": 0 }, { "heading": "Load & Performance Testing", - "explanation": "We simulate the traffic you expect on your platform and deliver detailed test reports whether it is a web-based or API-based test. Find out how your site really performs on server and client side.", + "explanation": "We simulate the traffic you expect on your platform and deliver detailed test reports for both web and API testing. Discover how your site truly performs on both the server and client sides. Learn More", "position": 1 }, { "heading": "Test Guidance & Support", - "explanation": "We love to share our knowledge and can help you establish or improve your own quality assurance processes. Let us inspire you to test better!", + "explanation": "We love to share our knowledge and can help you establish or improve your own quality assurance processes. Let us inspire you to test better! Learn More", "position": 2 }, { - "heading": "Our Testing Tool", - "explanation": "XLT covers all your web performance testing needs. It is extensively used by us and continuously improved. Functional test automation can also be done with XLT and is used when real browser performance testing is needed. XLT is Open Source under Apache License 2.0.", + "heading": "Testing Tools", + "explanation": "We offer tools for load testing, monitoring, and functional test automation of web applications. Learn More", "position": 3 } ], @@ -36,22 +36,22 @@ "serviceTiles": [ { "heading": "Manuelle Tests & Testautomatisierung", - "explanation": "Wir arbeiten mit einem ide­alen Mix aus ma­nu­ellen und auto­ma­ti­sierten Test­ver­fah­ren, ganz nach Ihren per­sön­lichen Wün­schen und Vor­stel­lungen.", + "explanation": "Wir arbeiten mit einem ide\u00ADalen Mix aus ma\u00ADnu\u00ADellen und auto\u00ADma\u00ADti\u00ADsierten Test\u00ADver\u00ADfah\u00ADren, ganz nach Ihren per\u00ADsön\u00ADlichen Wün\u00ADschen und Vor\u00ADstel\u00ADlungen. Mehr", "position": 0 }, { "heading": "Last- & Performancetests", - "explanation": "Wir simulieren jede Benutzer- und Transaktions­menge und liefern umfassende Test­reports. Erfahren Sie, was Ihre Website leistet.", + "explanation": "Wir simulieren jede Benutzer- und Transaktions\u00ADmenge und liefern umfassende Test\u00ADreports. Erfahren Sie, was Ihre Website leistet. Mehr", "position": 1 }, { "heading": "Testunterstützung", - "explanation": "Wir teilen unsere Erfahrungen und helfen Ihnen, QS-Prozesse zu etablieren und zu optimieren. Lassen Sie sich von uns inspirieren.", + "explanation": "Wir teilen unsere Erfahrungen und helfen Ihnen, QS-Prozesse zu etablieren und zu optimieren. Lassen Sie sich von uns inspirieren. Mehr", "position": 2 }, { - "heading": "Unser Testwerkzeug", - "explanation": "XLT deckt Ihre Last- und Performance­test-Anfor­de­rungen ab und ermöglicht ebenso WebDriver-basierte Testautomation. XLT ist Open Source.", + "heading": "Testwerkzeuge", + "explanation": "Wir bieten Werkzeuge für Lasttests, Monitoring und funktionale Testautomatisierung von Web-Anwendungen an. Mehr", "position": 3 } ], diff --git a/src/test/resources/showcase/neodymium/tests/data/AccessDataViaDataSetAnnotationTest.json b/src/test/resources/showcase/neodymium/tests/data/AccessDataViaDataSetAnnotationTest.json index 95e39df..25ed82a 100644 --- a/src/test/resources/showcase/neodymium/tests/data/AccessDataViaDataSetAnnotationTest.json +++ b/src/test/resources/showcase/neodymium/tests/data/AccessDataViaDataSetAnnotationTest.json @@ -3,7 +3,7 @@ "testId": "0001", "language": "en", "headline": "Committed to Software Quality", - "description": "We help our clients optimize software testing and quality assurance" + "description": "We Help Our Clients Optimize Software Testing and Quality Assurance." }, { "testId": "0002", diff --git a/src/test/resources/showcase/neodymium/tests/data/AccessDataViaDataUtilsTest.xml b/src/test/resources/showcase/neodymium/tests/data/AccessDataViaDataUtilsTest.xml index e230ecb..6f0c1a7 100644 --- a/src/test/resources/showcase/neodymium/tests/data/AccessDataViaDataUtilsTest.xml +++ b/src/test/resources/showcase/neodymium/tests/data/AccessDataViaDataUtilsTest.xml @@ -4,15 +4,15 @@ en/XML test data access using Neodymium DataUtils method en Committed to Software Quality - We help our clients optimize software testing and quality assurance + We Help Our Clients Optimize Software Testing and Quality Assurance. Manual & Automated Testing - We test your product based on individual requirements, with an ideal mix of manual and automated testing. + We test your product based on individual requirements using an ideal mix of manual and automated testing. Learn More Load & Performance Testing - We simulate the traffic you expect on your platform and deliver detailed test reports whether it is a web-based or API-based test. Find out how your site really performs on server and client side. + We simulate the traffic you expect on your platform and deliver detailed test reports for both web and API testing. Discover how your site truly performs on both the server and client sides. Learn More Test Guidance & Support - We love to share our knowledge and can help you establish or improve your own quality assurance processes. Let us inspire you to test better! - Our Testing Tool - XLT covers all your web performance testing needs. It is extensively used by us and continuously improved. Functional test automation can also be done with XLT and is used when real browser performance testing is needed. XLT is Open Source under Apache License 2.0. + We love to share our knowledge and can help you establish or improve your own quality assurance processes. Let us inspire you to test better! Learn More + Testing Tools + We offer tools for load testing, monitoring, and functional test automation of web applications. Learn More 4 @@ -21,13 +21,13 @@ Der Qualität von Software verpflichtet Wir begleiten Sie auf Ihrem Weg zum besten Produkt.Manual & Automated Testing Manuelle Tests & Testautomatisierung - Wir arbeiten mit einem ide­alen Mix aus ma­nu­ellen und auto­ma­ti­sierten Test­ver­fah­ren, ganz nach Ihren per­sön­lichen Wün­schen und Vor­stel­lungen. + Wir arbeiten mit einem ide­alen Mix aus ma­nu­ellen und auto­ma­ti­sierten Test­ver­fah­ren, ganz nach Ihren per­sön­lichen Wün­schen und Vor­stel­lungen. Mehr Last- & Performancetests - Wir simulieren jede Benutzer- und Transaktions­menge und liefern umfassende Test­reports. Erfahren Sie, was Ihre Website leistet. + Wir simulieren jede Benutzer- und Transaktions­menge und liefern umfassende Test­reports. Erfahren Sie, was Ihre Website leistet. Mehr Testunterstützung - Wir teilen unsere Erfahrungen und helfen Ihnen, QS-Prozesse zu etablieren und zu optimieren. Lassen Sie sich von uns inspirieren. - Unser Testwerkzeug - XLT deckt Ihre Last- und Performance­test-Anfor­de­rungen ab und ermöglicht ebenso WebDriver-basierte Testautomation. XLT ist Open Source. + Wir teilen unsere Erfahrungen und helfen Ihnen, QS-Prozesse zu etablieren und zu optimieren. Lassen Sie sich von uns inspirieren. Mehr + Testwerkzeuge + Wir bieten Werkzeuge für Lasttests, Monitoring und funktionale Testautomatisierung von Web-Anwendungen an. Mehr 4 diff --git a/src/test/resources/showcase/neodymium/tests/data/DataFilePriorityTest.csv b/src/test/resources/showcase/neodymium/tests/data/DataFilePriorityTest.csv index 5d913bf..f2c3052 100644 --- a/src/test/resources/showcase/neodymium/tests/data/DataFilePriorityTest.csv +++ b/src/test/resources/showcase/neodymium/tests/data/DataFilePriorityTest.csv @@ -1,3 +1,3 @@ testId,language,teaserMessage,teaserComment -"en/CSV test data access using Neodymium.dataValue method","en","Committed to Software Quality","We help our clients optimize software testing and quality assurance" -"de/CSV test data access using Neodymium.dataValue method","de","Der Qualität von Software verpflichtet","Wir begleiten Sie auf Ihrem Weg zum besten Produkt." \ No newline at end of file +"en/CSV test data access using Neodymium.dataValue method","en","Committed to Software Quality","We Help Our Clients Optimize Software Testing and Quality Assurance." +"de/CSV test data access using Neodymium.dataValue method","de","Der Qualität von Software verpflichtet","Wir begleiten Sie auf Ihrem Weg zum besten Produkt." diff --git a/src/test/resources/showcase/neodymium/tests/data/DataFilePriorityTest.json b/src/test/resources/showcase/neodymium/tests/data/DataFilePriorityTest.json index b50bf42..d98e666 100644 --- a/src/test/resources/showcase/neodymium/tests/data/DataFilePriorityTest.json +++ b/src/test/resources/showcase/neodymium/tests/data/DataFilePriorityTest.json @@ -3,7 +3,7 @@ "testId": "en/JSON different test data set in JSON file which is not used", "lang": "en", "teaserMessage": "Committed to Software Quality", - "teaserComment": "We help our clients optimize software testing and quality assurance" + "teaserComment": "We Help Our Clients Optimize Software Testing and Quality Assurance." }, { "testId": "de/JSON different test data set in JSON file which is not used", diff --git a/src/test/resources/showcase/neodymium/tests/data/TestDataFileWithDifferentName.json b/src/test/resources/showcase/neodymium/tests/data/TestDataFileWithDifferentName.json index 590ac76..9d4ba71 100644 --- a/src/test/resources/showcase/neodymium/tests/data/TestDataFileWithDifferentName.json +++ b/src/test/resources/showcase/neodymium/tests/data/TestDataFileWithDifferentName.json @@ -1,57 +1,57 @@ [ { - "testId": "en/JSON test data access using DataUtils.get method with jsonPath", + "testId": "en/JSON test data access using Java Pojo", "language": "en", "teaserMessage": "Committed to Software Quality", - "teaserComment": "We help our clients optimize software testing and quality assurance", + "teaserComment": "We Help Our Clients Optimize Software Testing and Quality Assurance.", "serviceTiles": [ { "heading": "Manual & Automated Testing", - "explanation": "We test your product based on individual requirements, with an ideal mix of manual and automated testing.", + "explanation": "We test your product based on individual requirements using an ideal mix of manual and automated testing. Learn More", "position": 0 }, { "heading": "Load & Performance Testing", - "explanation": "We simulate the traffic you expect on your platform and deliver detailed test reports whether it is a web-based or API-based test. Find out how your site really performs on server and client side.", + "explanation": "We simulate the traffic you expect on your platform and deliver detailed test reports for both web and API testing. Discover how your site truly performs on both the server and client sides. Learn More", "position": 1 }, { "heading": "Test Guidance & Support", - "explanation": "We love to share our knowledge and can help you establish or improve your own quality assurance processes. Let us inspire you to test better!", + "explanation": "We love to share our knowledge and can help you establish or improve your own quality assurance processes. Let us inspire you to test better! Learn More", "position": 2 }, { - "heading": "Our Testing Tool", - "explanation": "XLT covers all your web performance testing needs. It is extensively used by us and continuously improved. Functional test automation can also be done with XLT and is used when real browser performance testing is needed. XLT is Open Source under Apache License 2.0.", + "heading": "Testing Tools", + "explanation": "We offer tools for load testing, monitoring, and functional test automation of web applications. Learn More", "position": 3 } ], "numberServices": 4 }, { - "testId": "de/JSON test data access using DataUtils.get method with jsonPath", + "testId": "de/JSON test data access using Java Pojo", "language": "de", "teaserMessage": "Der Qualität von Software verpflichtet", "teaserComment": "Wir begleiten Sie auf Ihrem Weg zum besten Produkt.", "serviceTiles": [ { "heading": "Manuelle Tests & Testautomatisierung", - "explanation": "Wir arbeiten mit einem ide­alen Mix aus ma­nu­ellen und auto­ma­ti­sierten Test­ver­fah­ren, ganz nach Ihren per­sön­lichen Wün­schen und Vor­stel­lungen.", + "explanation": "Wir arbeiten mit einem ide\u00ADalen Mix aus ma\u00ADnu\u00ADellen und auto\u00ADma\u00ADti\u00ADsierten Test\u00ADver\u00ADfah\u00ADren, ganz nach Ihren per\u00ADsön\u00ADlichen Wün\u00ADschen und Vor\u00ADstel\u00ADlungen. Mehr", "position": 0 }, { "heading": "Last- & Performancetests", - "explanation": "Wir simulieren jede Benutzer- und Transaktions­menge und liefern umfassende Test­reports. Erfahren Sie, was Ihre Website leistet.", + "explanation": "Wir simulieren jede Benutzer- und Transaktions\u00ADmenge und liefern umfassende Test\u00ADreports. Erfahren Sie, was Ihre Website leistet. Mehr", "position": 1 }, { "heading": "Testunterstützung", - "explanation": "Wir teilen unsere Erfahrungen und helfen Ihnen, QS-Prozesse zu etablieren und zu optimieren. Lassen Sie sich von uns inspirieren.", + "explanation": "Wir teilen unsere Erfahrungen und helfen Ihnen, QS-Prozesse zu etablieren und zu optimieren. Lassen Sie sich von uns inspirieren. Mehr", "position": 2 }, { - "heading": "Unser Testwerkzeug", - "explanation": "XLT deckt Ihre Last- und Performance­test-Anfor­de­rungen ab und ermöglicht ebenso WebDriver-basierte Testautomation. XLT ist Open Source.", + "heading": "Testwerkzeuge", + "explanation": "Wir bieten Werkzeuge für Lasttests, Monitoring und funktionale Testautomatisierung von Web-Anwendungen an. Mehr", "position": 3 } ], From f6cf1d1e436fd0b31fc2f13656713e66911918ac Mon Sep 17 00:00:00 2001 From: RobertAvemarg Date: Tue, 14 Jan 2025 13:49:43 +0100 Subject: [PATCH 10/17] changed test annotation --- .../NeodymiumLocalProxyBasicAuthenticationHostTest.java | 4 ++-- .../NeodymiumLocalProxyBasicAuthenticationTest.java | 4 ++-- .../NeodymiumLocalProxyCertificateAuthenticationTest.java | 5 ++--- ...ymiumLocalProxyGenerateCertificateAuthenticationTest.java | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationHostTest.java b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationHostTest.java index 2bb6879..15b5c9e 100644 --- a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationHostTest.java +++ b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationHostTest.java @@ -2,6 +2,7 @@ import com.browserup.bup.proxy.auth.AuthType; import com.codeborne.selenide.Selenide; +import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.Neodymium; import io.qameta.allure.Description; import io.qameta.allure.Owner; @@ -10,7 +11,6 @@ import io.qameta.allure.junit4.Tag; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import showcase.neodymium.tests.AbstractTest; import showcase.pageobjects.components.Title; @@ -61,7 +61,7 @@ public static void addLocalProxyBasicAuthHostTempProperties() )); } - @Test + @NeodymiumTest @Description(value = "Showcase for basic authentication using Neodymium Local Proxy") public void test() { diff --git a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationTest.java b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationTest.java index 3b0d349..7385da0 100644 --- a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationTest.java +++ b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationTest.java @@ -1,6 +1,7 @@ package showcase.neodymium.tests.basicauth; import com.codeborne.selenide.Selenide; +import com.xceptance.neodymium.junit5.NeodymiumTest; import io.qameta.allure.Description; import io.qameta.allure.Owner; import io.qameta.allure.Severity; @@ -8,7 +9,6 @@ import io.qameta.allure.junit4.Tag; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import showcase.neodymium.tests.AbstractTest; import java.util.Map; @@ -66,7 +66,7 @@ public static void addLocalProxyTempProperties() )); } - @Test + @NeodymiumTest @Description(value = "Showcase for basic authentication using Neodymium Local Proxy") public void test() { diff --git a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyCertificateAuthenticationTest.java b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyCertificateAuthenticationTest.java index ade00b0..c7cb461 100644 --- a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyCertificateAuthenticationTest.java +++ b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyCertificateAuthenticationTest.java @@ -2,6 +2,7 @@ import com.browserup.bup.proxy.auth.AuthType; import com.codeborne.selenide.Selenide; +import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.Neodymium; import io.qameta.allure.Description; import io.qameta.allure.Owner; @@ -10,7 +11,6 @@ import io.qameta.allure.junit4.Tag; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import showcase.neodymium.tests.AbstractTest; import showcase.pageobjects.components.Title; @@ -77,7 +77,7 @@ public static void addLocalProxyCertTempProperties() )); } - @Test + @NeodymiumTest @Description(value = "Showcase for certificate authentication using Neodymium Local Proxy") public void test() { @@ -97,6 +97,5 @@ public void test() public static void cleanUp() { deleteTempPropertiesFile(TEMP_PROPERTIES_FILE); - deleteTempPropertiesFile("embeddedLocalProxySelfSignedRootCertificate.p12"); } } diff --git a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyGenerateCertificateAuthenticationTest.java b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyGenerateCertificateAuthenticationTest.java index 8ca04b2..2716574 100644 --- a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyGenerateCertificateAuthenticationTest.java +++ b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyGenerateCertificateAuthenticationTest.java @@ -2,6 +2,7 @@ import com.browserup.bup.proxy.auth.AuthType; import com.codeborne.selenide.Selenide; +import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.Neodymium; import io.qameta.allure.Description; import io.qameta.allure.Owner; @@ -10,7 +11,6 @@ import io.qameta.allure.junit4.Tag; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import showcase.neodymium.tests.AbstractTest; import showcase.pageobjects.components.Title; @@ -65,7 +65,7 @@ public static void addLocalProxyGenCertTempProperties() )); } - @Test + @NeodymiumTest @Description(value = "Showcase for certificate authentication using Neodymium Local Proxy") public void test() { From 3fa22c05d7c9f7fff48764f9d2699c09004a479d Mon Sep 17 00:00:00 2001 From: RobertAvemarg Date: Mon, 20 Jan 2025 10:09:55 +0100 Subject: [PATCH 11/17] fix AdvancedScreenshotsTest --- config/neodymium.properties | 1 - .../browsersession/DifferentBrowserSessionTest.java | 6 +++--- .../tests/browsersession/SameBrowserSessionTest.java | 6 +++--- .../tests/screenshot/AdvancedScreenshotTest.java | 11 +++-------- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/config/neodymium.properties b/config/neodymium.properties index 8196563..414bd40 100644 --- a/config/neodymium.properties +++ b/config/neodymium.properties @@ -35,4 +35,3 @@ neodymium.localproxy.certificate.archiveFile = ./config/Certificate.pfx neodymium.localproxy.certificate.archivetype = PKCS12 neodymium.localproxy.certificate.name = e6f60fbd-f9f3-436f-aba5-452861ae4570 neodymium.localproxy.certificate.password = MITMCertificatePassword -# diff --git a/src/test/java/showcase/neodymium/tests/browsersession/DifferentBrowserSessionTest.java b/src/test/java/showcase/neodymium/tests/browsersession/DifferentBrowserSessionTest.java index 7be3d83..1f4d5a8 100644 --- a/src/test/java/showcase/neodymium/tests/browsersession/DifferentBrowserSessionTest.java +++ b/src/test/java/showcase/neodymium/tests/browsersession/DifferentBrowserSessionTest.java @@ -53,8 +53,8 @@ public void cleanUp() cleanUpWindowHandle = Neodymium.getDriver().getWindowHandle(); // different browsers should generate different window handles - Assertions.assertNotEquals(setUpWindowHandle, testWindowHandle); - Assertions.assertNotEquals(setUpWindowHandle, cleanUpWindowHandle); - Assertions.assertNotEquals(testWindowHandle, cleanUpWindowHandle); + Assertions.assertNotEquals(setUpWindowHandle, testWindowHandle, "setup and test window handle are the same"); + Assertions.assertNotEquals(setUpWindowHandle, cleanUpWindowHandle, "setup and cleanup window handle are the same"); + Assertions.assertNotEquals(testWindowHandle, cleanUpWindowHandle, "test and cleanup window handle are the same"); } } diff --git a/src/test/java/showcase/neodymium/tests/browsersession/SameBrowserSessionTest.java b/src/test/java/showcase/neodymium/tests/browsersession/SameBrowserSessionTest.java index 4452529..c124960 100644 --- a/src/test/java/showcase/neodymium/tests/browsersession/SameBrowserSessionTest.java +++ b/src/test/java/showcase/neodymium/tests/browsersession/SameBrowserSessionTest.java @@ -45,8 +45,8 @@ public void cleanUp() cleanUpWindowHandle = Neodymium.getDriver().getWindowHandle(); // using the same browsers and same tab should not generate different window handles - Assertions.assertEquals(setUpWindowHandle, testWindowHandle); - Assertions.assertEquals(setUpWindowHandle, cleanUpWindowHandle); - Assertions.assertEquals(testWindowHandle, cleanUpWindowHandle); + Assertions.assertEquals(setUpWindowHandle, testWindowHandle, "setup and test window handle are different"); + Assertions.assertEquals(setUpWindowHandle, cleanUpWindowHandle, "setup and cleanup window handle are different"); + Assertions.assertEquals(testWindowHandle, cleanUpWindowHandle, "test and cleanup window handle are different"); } } diff --git a/src/test/java/showcase/neodymium/tests/screenshot/AdvancedScreenshotTest.java b/src/test/java/showcase/neodymium/tests/screenshot/AdvancedScreenshotTest.java index 22ae5e9..7f74d29 100644 --- a/src/test/java/showcase/neodymium/tests/screenshot/AdvancedScreenshotTest.java +++ b/src/test/java/showcase/neodymium/tests/screenshot/AdvancedScreenshotTest.java @@ -3,9 +3,7 @@ import com.codeborne.selenide.Selenide; import com.codeborne.selenide.ex.ElementNotFound; import com.xceptance.neodymium.junit5.NeodymiumTest; -import com.xceptance.neodymium.util.Neodymium; import io.qameta.allure.junit4.Tag; -import org.aeonbits.owner.ConfigFactory; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; @@ -40,24 +38,21 @@ public static void addScreenshotTempProperties() * neodymium.screenshots.fullpagecapture.enable=true * neodymium.screenshots.fullpagecapture.highlightViewport=true * neodymium.screenshots.fullpagecapture.highlightColor=#735369 + * neodymium.screenshots.enableOnSuccess=true - only necessary because the exception is caught and this disables the advanced screenshots */ addTempProperty(TEMP_PROPERTIES_FILE, Map.of( "neodymium.screenshots.enableAdvancedScreenshots", "true", "neodymium.screenshots.fullpagecapture.enable", "true", "neodymium.screenshots.fullpagecapture.highlightViewport", "true", - "neodymium.screenshots.fullpagecapture.highlightColor", "#735369" + "neodymium.screenshots.fullpagecapture.highlightColor", "#735369", + "neodymium.screenshots.enableOnSuccess", "true" )); } @NeodymiumTest public void testAdvancedScreenshots() { - - // TODO fix screenshot - - ConfigFactory.setProperty(Neodymium.TEMPORARY_CONFIG_FILE_PROPERTY_NAME, "file:config/" + TEMP_PROPERTIES_FILE); - Selenide.open("https://www.xceptance.com/en/"); ElementNotFound exception = assertThrows(ElementNotFound.class, () -> { From 58db620d91cee9c52924367c551bd82643268d3c Mon Sep 17 00:00:00 2001 From: RobertAvemarg Date: Mon, 27 Jan 2025 14:58:12 +0100 Subject: [PATCH 12/17] improve showcases --- README.md | 6 +++ .../java/showcase/flows/OpenPageFlow.java | 19 ++++++-- .../java/showcase/flows/PropertiesFlow.java | 39 +++++++++++++-- ...LocalProxyBasicAuthenticationHostTest.java | 5 +- ...miumLocalProxyBasicAuthenticationTest.java | 9 ++-- .../SelenideBasicAuthenticationTest.java | 4 +- .../DifferentBrowserSessionTest.java | 48 +++++++++++-------- .../SameBrowserSessionTest.java | 47 ++++++++---------- .../CustomEnvironmentDataTest.java | 34 +++++++++++++ .../iframe/SelenideSwitchToFrameTest.java | 13 +++-- .../jsonassertion/JsonAssertionTest.java | 22 +-------- .../tests/popupblocker/PopupBlockerTest.java | 1 - .../tests/responsive/MobileDeviceTest.java | 19 ++++---- .../screenshot/AdvancedScreenshotTest.java | 16 +------ .../UrlValidationExcludeTest.java | 36 +++++++------- .../UrlValidationIncludeTest.java | 31 +++++------- 16 files changed, 195 insertions(+), 154 deletions(-) create mode 100644 src/test/java/showcase/neodymium/tests/customenvironmentdata/CustomEnvironmentDataTest.java diff --git a/README.md b/README.md index 3c00f10..f9d24a6 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,12 @@ To prevent the test automation to reach sites that are out of scope or should no include and exclude lists in the `neodymium.config`. The setup and usage of those lists is demonstrated in the showcases in the package `showcase.neodymium.tests.urlvalidation`. +## 18. + +It is possible to add custom values to differentiate between environments or profiles within your test runs, enhancing +the granularity of your test environment information. A very basic example can be found in the showcase +`showcase.neodymium.tests.customenvironmentdata.CustomEnvironmentDataTest`. + ## License MIT diff --git a/src/test/java/showcase/flows/OpenPageFlow.java b/src/test/java/showcase/flows/OpenPageFlow.java index bf44f51..6c7ac31 100644 --- a/src/test/java/showcase/flows/OpenPageFlow.java +++ b/src/test/java/showcase/flows/OpenPageFlow.java @@ -1,12 +1,13 @@ package showcase.flows; +import com.codeborne.selenide.Selenide; +import com.codeborne.selenide.SelenideElement; +import com.codeborne.selenide.ex.ElementNotFound; + import static com.codeborne.selenide.Condition.hidden; import static com.codeborne.selenide.Condition.visible; import static com.codeborne.selenide.Selenide.$; -import com.codeborne.selenide.Selenide; -import com.codeborne.selenide.ex.ElementNotFound; - public class OpenPageFlow { /** @@ -34,4 +35,16 @@ public static void openXceptanceJobOffersPage() $(".btn-link").shouldBe(hidden); } } + + /** + * Helper function to open the menu on posters if it is collapsed + */ + public static void openCollapsedMenu() + { + SelenideElement navBarToggle = $(".navbar-toggler"); + if (navBarToggle.isDisplayed()) + { + navBarToggle.click(); + } + } } diff --git a/src/test/java/showcase/flows/PropertiesFlow.java b/src/test/java/showcase/flows/PropertiesFlow.java index c88c5f5..ce24fd9 100644 --- a/src/test/java/showcase/flows/PropertiesFlow.java +++ b/src/test/java/showcase/flows/PropertiesFlow.java @@ -11,6 +11,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.Map; +import java.util.Set; import java.util.stream.Collectors; public class PropertiesFlow @@ -31,11 +32,7 @@ public class PropertiesFlow */ public static void addTempProperty(String filename, Map properties) { - // define and set the properties - for (String key : properties.keySet()) - { - Neodymium.configuration().setProperty(key, properties.get(key)); - } + setTempProperties(properties); String propertiesString = properties.entrySet().stream() .map(entry -> entry.getKey() + "=" + entry.getValue()) @@ -81,5 +78,37 @@ public static void deleteTempPropertiesFile(String filename) { throw new RuntimeException(e); } + + ConfigFactory.clearProperty(Neodymium.TEMPORARY_CONFIG_FILE_PROPERTY_NAME); + Neodymium.clearThreadContext(); + } + + /** + * Helper method to add the properties to the current Neodymium configuration + * + * @param properties + * a map containing the properties and values to add + */ + public static void setTempProperties(Map properties) + { + // define and set the properties + for (String key : properties.keySet()) + { + Neodymium.configuration().setProperty(key, properties.get(key)); + } + } + + /** + * Helper method to remove the properties from the current Neodymium configuration + * + * @param properties + * a set containing the properties to remove + */ + public static void removeTempProperties(Set properties) + { + properties.forEach(p -> { + Neodymium.configuration().removeProperty(p); + ConfigFactory.clearProperty(p); + }); } } diff --git a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationHostTest.java b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationHostTest.java index 15b5c9e..641fdd2 100644 --- a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationHostTest.java +++ b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationHostTest.java @@ -51,9 +51,7 @@ public static void addLocalProxyBasicAuthHostTempProperties() * here. * The following call will create a temp properties file with the values: * - * neodymium.localproxy.enable=true - * neodymium.localproxy.certificate=true - * neodymium.localproxy.certificate.generate=true + * neodymium.localproxy=true */ addTempProperty(TEMP_PROPERTIES_FILE, Map.of( @@ -83,6 +81,5 @@ public void test() public static void cleanUp() { deleteTempPropertiesFile(TEMP_PROPERTIES_FILE); - deleteTempPropertiesFile("embeddedLocalProxySelfSignedRootCertificate.p12"); } } diff --git a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationTest.java b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationTest.java index 7385da0..1d21bc1 100644 --- a/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationTest.java +++ b/src/test/java/showcase/neodymium/tests/basicauth/NeodymiumLocalProxyBasicAuthenticationTest.java @@ -10,6 +10,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import showcase.neodymium.tests.AbstractTest; +import showcase.pageobjects.components.Title; import java.util.Map; @@ -54,15 +55,11 @@ public static void addLocalProxyTempProperties() * * neodymium.localproxy=true * neodymium.url.host=authenticationtest.com - * neodymium.basicauth.username=User - * neodymium.basicauth.password=Pass */ addTempProperty(TEMP_PROPERTIES_FILE, Map.of( "neodymium.localproxy", "true", - "neodymium.url.host", "authenticationtest.com", - "neodymium.basicauth.username", "User", - "neodymium.basicauth.password", "Pass" + "neodymium.url.host", "authenticationtest.com" )); } @@ -74,7 +71,7 @@ public void test() Selenide.open("https://authenticationtest.com/HTTPAuth/"); // validate the page title - // new Title().validateTitle("Authentication Test"); + new Title().validateTitle("Authentication Test"); // check that basic alert message is visible $(".alert-success").shouldBe(visible); diff --git a/src/test/java/showcase/neodymium/tests/basicauth/SelenideBasicAuthenticationTest.java b/src/test/java/showcase/neodymium/tests/basicauth/SelenideBasicAuthenticationTest.java index 9b597b5..624221a 100644 --- a/src/test/java/showcase/neodymium/tests/basicauth/SelenideBasicAuthenticationTest.java +++ b/src/test/java/showcase/neodymium/tests/basicauth/SelenideBasicAuthenticationTest.java @@ -1,6 +1,7 @@ package showcase.neodymium.tests.basicauth; import com.codeborne.selenide.Selenide; +import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.Neodymium; import io.qameta.allure.Description; import io.qameta.allure.Owner; @@ -9,7 +10,6 @@ import io.qameta.allure.junit4.Tag; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import showcase.neodymium.tests.AbstractTest; import showcase.pageobjects.components.Title; @@ -62,7 +62,7 @@ public static void addSelenideAuthTempProperties() )); } - @Test + @NeodymiumTest @Description(value = "Showcase for basic authentication using Selenide") public void test() { diff --git a/src/test/java/showcase/neodymium/tests/browsersession/DifferentBrowserSessionTest.java b/src/test/java/showcase/neodymium/tests/browsersession/DifferentBrowserSessionTest.java index 1f4d5a8..113fa61 100644 --- a/src/test/java/showcase/neodymium/tests/browsersession/DifferentBrowserSessionTest.java +++ b/src/test/java/showcase/neodymium/tests/browsersession/DifferentBrowserSessionTest.java @@ -1,16 +1,19 @@ package showcase.neodymium.tests.browsersession; +import com.codeborne.selenide.ClickOptions; import com.xceptance.neodymium.common.browser.StartNewBrowserForCleanUp; import com.xceptance.neodymium.common.browser.StartNewBrowserForSetUp; import com.xceptance.neodymium.junit5.NeodymiumTest; -import com.xceptance.neodymium.util.Neodymium; +import com.xceptance.neodymium.util.SelenideAddons; import io.qameta.allure.junit4.Tag; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import showcase.neodymium.tests.AbstractTest; +import static com.codeborne.selenide.Condition.visible; +import static com.codeborne.selenide.Selenide.$; import static com.codeborne.selenide.Selenide.open; +import static showcase.flows.OpenPageFlow.openCollapsedMenu; /** * To start the test with a fresh, clean browser its is possible to use a different browser for the setup and also for the cleanup. this can be done with the @@ -20,27 +23,32 @@ @Tag("BrowserSession") public class DifferentBrowserSessionTest extends AbstractTest { - private String setUpWindowHandle; - - private String testWindowHandle; - - private String cleanUpWindowHandle; - // annotation to force a new browser for setup @StartNewBrowserForSetUp @BeforeEach public void setUp() { - // Setup code using dedicated browser - open("https://www.xceptance.com/en/"); - setUpWindowHandle = Neodymium.getDriver().getWindowHandle(); + open("https://posters.xceptance.io:8443/"); + + // open the first product + $(".product-tile:first-of-type img").click(ClickOptions.usingJavaScript()); + + // add it to the cart + $("#btn-add-to-cart").click(ClickOptions.usingJavaScript()); } @NeodymiumTest public void testDifferentBrowserSession() { - open("https://www.xceptance.com/en/"); - testWindowHandle = Neodymium.getDriver().getWindowHandle(); + open("https://posters.xceptance.io:8443/"); + SelenideAddons.optionalWaitUntilCondition($("#carousel-product-display"), visible); + + // check if the nav bar is collapsed and if so open it + openCollapsedMenu(); + + // check that the product from the setup is present + $("#header-cart-overview").click(); + $(".go-to-cart").shouldNotBe(visible); } // annotation to force a new browser for cleanup @@ -49,12 +57,14 @@ public void testDifferentBrowserSession() public void cleanUp() { // Cleanup code using dedicated browser - open("https://www.xceptance.com/en/"); - cleanUpWindowHandle = Neodymium.getDriver().getWindowHandle(); + open("https://posters.xceptance.io:8443/"); + SelenideAddons.optionalWaitUntilCondition($("#carousel-product-display"), visible); + + // check if the nav bar is collapsed and if so open it + openCollapsedMenu(); - // different browsers should generate different window handles - Assertions.assertNotEquals(setUpWindowHandle, testWindowHandle, "setup and test window handle are the same"); - Assertions.assertNotEquals(setUpWindowHandle, cleanUpWindowHandle, "setup and cleanup window handle are the same"); - Assertions.assertNotEquals(testWindowHandle, cleanUpWindowHandle, "test and cleanup window handle are the same"); + // check that the product from the setup is present + $("#header-cart-overview").click(); + $(".go-to-cart").shouldNotBe(visible); } } diff --git a/src/test/java/showcase/neodymium/tests/browsersession/SameBrowserSessionTest.java b/src/test/java/showcase/neodymium/tests/browsersession/SameBrowserSessionTest.java index c124960..63f4164 100644 --- a/src/test/java/showcase/neodymium/tests/browsersession/SameBrowserSessionTest.java +++ b/src/test/java/showcase/neodymium/tests/browsersession/SameBrowserSessionTest.java @@ -1,14 +1,16 @@ package showcase.neodymium.tests.browsersession; +import com.codeborne.selenide.ClickOptions; import com.xceptance.neodymium.junit5.NeodymiumTest; -import com.xceptance.neodymium.util.Neodymium; +import com.xceptance.neodymium.util.SelenideAddons; import io.qameta.allure.junit4.Tag; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import showcase.neodymium.tests.AbstractTest; +import static com.codeborne.selenide.Condition.visible; +import static com.codeborne.selenide.Selenide.$; import static com.codeborne.selenide.Selenide.open; +import static showcase.flows.OpenPageFlow.openCollapsedMenu; /** * It is also possible to reuse the same browser thought the whole test including setup and cleanup. This is demonstrated here and the default behaviour. @@ -16,37 +18,30 @@ @Tag("BrowserSession") public class SameBrowserSessionTest extends AbstractTest { - private String setUpWindowHandle; - - private String testWindowHandle; - - private String cleanUpWindowHandle; - @BeforeEach public void setUp() { - // Setup code using dedicated browser - open("https://www.xceptance.com/en/"); - setUpWindowHandle = Neodymium.getDriver().getWindowHandle(); + open("https://posters.xceptance.io:8443/"); + + // open the first product + $(".product-tile:first-of-type img").click(ClickOptions.usingJavaScript()); + + // add it to the cart + $("#btn-add-to-cart").click(ClickOptions.usingJavaScript()); } @NeodymiumTest public void testSameBrowserSession() { - open("https://www.xceptance.com/en/"); - testWindowHandle = Neodymium.getDriver().getWindowHandle(); - } + open("https://posters.xceptance.io:8443/"); + SelenideAddons.optionalWaitUntilCondition($("#carousel-product-display"), visible); - @AfterEach - public void cleanUp() - { - // Cleanup code using dedicated browser - open("https://www.xceptance.com/en/"); - cleanUpWindowHandle = Neodymium.getDriver().getWindowHandle(); - - // using the same browsers and same tab should not generate different window handles - Assertions.assertEquals(setUpWindowHandle, testWindowHandle, "setup and test window handle are different"); - Assertions.assertEquals(setUpWindowHandle, cleanUpWindowHandle, "setup and cleanup window handle are different"); - Assertions.assertEquals(testWindowHandle, cleanUpWindowHandle, "test and cleanup window handle are different"); + // check if the nav bar is collapsed and if so open it + openCollapsedMenu(); + + // check that the product from the setup is present + $("#header-cart-overview").click(); + $(".go-to-cart").shouldBe(visible); } + } diff --git a/src/test/java/showcase/neodymium/tests/customenvironmentdata/CustomEnvironmentDataTest.java b/src/test/java/showcase/neodymium/tests/customenvironmentdata/CustomEnvironmentDataTest.java new file mode 100644 index 0000000..a604e34 --- /dev/null +++ b/src/test/java/showcase/neodymium/tests/customenvironmentdata/CustomEnvironmentDataTest.java @@ -0,0 +1,34 @@ +package showcase.neodymium.tests.customenvironmentdata; + +import com.xceptance.neodymium.junit5.NeodymiumTest; +import io.qameta.allure.junit4.Tag; +import org.junit.jupiter.api.BeforeAll; +import showcase.neodymium.tests.AbstractTest; + +/** + * It is possible to add custom values to differentiate between environments or profiles within your test runs, enhancing the granularity of your test + * environment information. + */ +@Tag("CustomEnvironmentData") +public class CustomEnvironmentDataTest extends AbstractTest +{ + @BeforeAll + public static void addCustomEnvironmentDataToTempProperties() + { + /* + * In general the properties should be defined directly in the neodymium.properties, but for the showcase to see some example values this is done + * here. + * The following call will add system properties with the values: + * + * neodymium.report.environment.enableCustomData = true + * neodymium.report.environment.custom.customData = customValue + */ + System.setProperty("neodymium.report.environment.enableCustomData", "true"); + System.setProperty("neodymium.report.environment.custom.customData", "customValue"); + } + + @NeodymiumTest + public void testCustomEnvironmentData() + { + } +} diff --git a/src/test/java/showcase/neodymium/tests/iframe/SelenideSwitchToFrameTest.java b/src/test/java/showcase/neodymium/tests/iframe/SelenideSwitchToFrameTest.java index 401cd98..309ec7b 100644 --- a/src/test/java/showcase/neodymium/tests/iframe/SelenideSwitchToFrameTest.java +++ b/src/test/java/showcase/neodymium/tests/iframe/SelenideSwitchToFrameTest.java @@ -1,20 +1,19 @@ package showcase.neodymium.tests.iframe; -import static com.codeborne.selenide.Condition.matchText; -import static com.codeborne.selenide.Selenide.$; -import static com.codeborne.selenide.Selenide.switchTo; - import com.codeborne.selenide.Selenide; import com.codeborne.selenide.SelenideElement; import com.xceptance.neodymium.junit5.NeodymiumTest; - import io.qameta.allure.Description; import io.qameta.allure.junit4.Tag; import showcase.neodymium.tests.AbstractTest; +import static com.codeborne.selenide.Condition.matchText; +import static com.codeborne.selenide.Selenide.$; +import static com.codeborne.selenide.Selenide.switchTo; + /** - * This showcase explains with an example implementation how to test a website using frames (iframe).
            - * Selenide offers a straight forward approach to handle such frames and within Neodymium this is simply applied.
            + * This showcase explains with an example implementation how to test a website using frames (iframe).
            Selenide offers a straight forward approach to handle + * such frames and within Neodymium this is simply applied.
            */ @Tag("iFrame") public class SelenideSwitchToFrameTest extends AbstractTest diff --git a/src/test/java/showcase/neodymium/tests/jsonassertion/JsonAssertionTest.java b/src/test/java/showcase/neodymium/tests/jsonassertion/JsonAssertionTest.java index 7ea2a5d..b8947e2 100644 --- a/src/test/java/showcase/neodymium/tests/jsonassertion/JsonAssertionTest.java +++ b/src/test/java/showcase/neodymium/tests/jsonassertion/JsonAssertionTest.java @@ -10,9 +10,6 @@ import java.nio.file.Files; import java.nio.file.Path; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; - /** * Comparing JSON files can be hard sometimes. To simplify it, JSONAssert was used and the differences between the files are added to the allure report. This * showcase is used to demonstrate basic examples of comparing JSON files, where one shows the errors, which can be easily seen in the allure report. @@ -20,10 +17,8 @@ @Tag("JsonAssertion") public class JsonAssertionTest { - // TODO fix nullpointer for getWebDriver if no browser is used or prevent start of browser which is not necessary here - @NeodymiumTest - public void testEqualOnDifferingFiles() throws IOException + public void failingTestEqualOnDifferingFiles() throws IOException { // read the JSON files to compare Path expectedJsonPath = Path.of("src/test/resources/showcase/neodymium/tests/jsonassertion/expected.json"); @@ -35,20 +30,7 @@ public void testEqualOnDifferingFiles() throws IOException // check that the files are equal // expected error is caught to make the test pass // the differences are still added to the report and can be seen - AssertionError exception = assertThrows(AssertionError.class, () -> { - JsonAssert.assertEquals(expectedJson, actualJson, JSONCompareMode.STRICT_ORDER); - }); - assertEquals("java.lang.AssertionError: both json's are not equal (see attachment 'Json Compare') glossary.GlossDiv.GlossList.GlossEntry\n" + - "Expected: Acronym\n" + - " but none found\n" + - " ; glossary.GlossDiv.GlossList.GlossEntry.GlossDef.GlossSeeAlso[]: Expected 2 values but got 3 ; glossary.GlossDiv.title\n" + - "Expected: S\n" + - " got: T\n" + - " ; glossary.title\n" + - "Expected: example glossary\n" + - " got: example glosary\n" + - "\n" + - "(Timeout: 0 ms.)", exception.getMessage()); + JsonAssert.assertEquals(expectedJson, actualJson, JSONCompareMode.STRICT_ORDER); } @NeodymiumTest diff --git a/src/test/java/showcase/neodymium/tests/popupblocker/PopupBlockerTest.java b/src/test/java/showcase/neodymium/tests/popupblocker/PopupBlockerTest.java index 09e8a3d..b9001da 100644 --- a/src/test/java/showcase/neodymium/tests/popupblocker/PopupBlockerTest.java +++ b/src/test/java/showcase/neodymium/tests/popupblocker/PopupBlockerTest.java @@ -23,7 +23,6 @@ @Tag("PopupBlocker") public class PopupBlockerTest extends AbstractTest { - public static final String TEMP_PROPERTIES_FILE = "temp-PopupBlockerTest-neodymium.properties"; @BeforeAll diff --git a/src/test/java/showcase/neodymium/tests/responsive/MobileDeviceTest.java b/src/test/java/showcase/neodymium/tests/responsive/MobileDeviceTest.java index 1b90338..c58694c 100644 --- a/src/test/java/showcase/neodymium/tests/responsive/MobileDeviceTest.java +++ b/src/test/java/showcase/neodymium/tests/responsive/MobileDeviceTest.java @@ -1,23 +1,20 @@ package showcase.neodymium.tests.responsive; -import static com.codeborne.selenide.Condition.hidden; -import static com.codeborne.selenide.Condition.visible; -import static com.codeborne.selenide.Selenide.$; - import com.codeborne.selenide.Selenide; import com.xceptance.neodymium.common.browser.Browser; import com.xceptance.neodymium.junit5.NeodymiumTest; import com.xceptance.neodymium.util.Neodymium; - import showcase.neodymium.tests.AbstractTest; +import static com.codeborne.selenide.Condition.hidden; +import static com.codeborne.selenide.Condition.visible; +import static com.codeborne.selenide.Selenide.$; + /** - * Most websites provide their content in different resolutions for different devices.
            - * In order to test a cell phone for example, the emulation of various mobile devices integrated in Chrome can be - * used.
            - * Browser profiles are defined in the config/browser.properties file.
            - * There is a value for chromeEmulationProfile necessary, in our example: "iPhone X".
            - * Possible values can be found in the Chrome browser in the developer tools "Toggle device toolbar" drop down menu
            + * Most websites provide their content in different resolutions for different devices.
            In order to test a cell phone for example, the emulation of various + * mobile devices integrated in Chrome can be used.
            Browser profiles are defined in the config/browser.properties file.
            There is a value for + * chromeEmulationProfile necessary, in our example: "iPhone X".
            Possible values can be found in the Chrome browser in the developer tools "Toggle device + * toolbar" drop down menu
            */ @Browser("Chrome_1500x1000") @Browser("Chrome_iPhoneX") diff --git a/src/test/java/showcase/neodymium/tests/screenshot/AdvancedScreenshotTest.java b/src/test/java/showcase/neodymium/tests/screenshot/AdvancedScreenshotTest.java index 7f74d29..6c159db 100644 --- a/src/test/java/showcase/neodymium/tests/screenshot/AdvancedScreenshotTest.java +++ b/src/test/java/showcase/neodymium/tests/screenshot/AdvancedScreenshotTest.java @@ -1,19 +1,14 @@ package showcase.neodymium.tests.screenshot; import com.codeborne.selenide.Selenide; -import com.codeborne.selenide.ex.ElementNotFound; import com.xceptance.neodymium.junit5.NeodymiumTest; import io.qameta.allure.junit4.Tag; import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import showcase.neodymium.tests.AbstractTest; import java.util.Map; -import static com.codeborne.selenide.Condition.visible; -import static com.codeborne.selenide.Selenide.$; -import static org.junit.jupiter.api.Assertions.assertThrows; import static showcase.flows.PropertiesFlow.addTempProperty; import static showcase.flows.PropertiesFlow.deleteTempPropertiesFile; @@ -38,7 +33,7 @@ public static void addScreenshotTempProperties() * neodymium.screenshots.fullpagecapture.enable=true * neodymium.screenshots.fullpagecapture.highlightViewport=true * neodymium.screenshots.fullpagecapture.highlightColor=#735369 - * neodymium.screenshots.enableOnSuccess=true - only necessary because the exception is caught and this disables the advanced screenshots + * neodymium.screenshots.enableOnSuccess=true - to take the screenshot without throwing an assertion error */ addTempProperty(TEMP_PROPERTIES_FILE, Map.of( @@ -54,15 +49,6 @@ public static void addScreenshotTempProperties() public void testAdvancedScreenshots() { Selenide.open("https://www.xceptance.com/en/"); - - ElementNotFound exception = assertThrows(ElementNotFound.class, () -> { - $("#notExistingSelector42").shouldBe(visible); - }); - Assertions.assertEquals( - "Element not found {#notExistingSelector42}\n" + - "Expected: visible\n" + - "(Timeout: 3 s.)", - exception.getMessage()); } @AfterAll diff --git a/src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationExcludeTest.java b/src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationExcludeTest.java index 7c00a01..6758c38 100644 --- a/src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationExcludeTest.java +++ b/src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationExcludeTest.java @@ -4,14 +4,12 @@ import com.xceptance.neodymium.junit5.NeodymiumTest; import io.qameta.allure.junit4.Tag; import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; -import org.opentest4j.AssertionFailedError; import showcase.neodymium.tests.AbstractTest; import java.util.Map; -import static org.junit.jupiter.api.Assertions.assertThrows; +import static com.codeborne.selenide.Selenide.$; import static showcase.flows.PropertiesFlow.addTempProperty; import static showcase.flows.PropertiesFlow.deleteTempPropertiesFile; @@ -46,26 +44,30 @@ public static void setExcludeList() @NeodymiumTest public void testExcludeList() + { + Selenide.open("https://posters.xceptance.io:8443/"); + Selenide.open("https://www.xceptance.com/de/"); + Selenide.open("https://www.google.com"); + } + + @NeodymiumTest + public void failingTestClickExcludedUrl() { Selenide.open("https://posters.xceptance.io:8443/"); Selenide.sleep(1000); - // after opening the ULR it is validated if the URL is excluded and if so, an assertion error will be thrown and the test is stopped - // expected error is caught to make the test pass - AssertionFailedError exceptionRegex = assertThrows(AssertionFailedError.class, () -> { - Selenide.open("https://posters.xceptance.io:8443/topCategory/Dining?categoryId=2"); - }); - Assertions.assertEquals( - "Opened Link was to forbidden site: https://posters.xceptance.io:8443/topCategory/Dining?categoryId=2 ==> expected: but was: ", - exceptionRegex.getMessage()); + $(".navbar-toggler").click(); + $(".nav-link[href*='Dining']").click(); + } + + @NeodymiumTest + public void failingTestOpenExcludedUrl() + { + Selenide.open("https://posters.xceptance.io:8443/"); + // after opening the ULR it is validated if the URL is excluded and if so, an assertion error will be thrown and the test is stopped // expected error is caught to make the test pass - AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { - Selenide.open("https://www.xceptance.com/en/"); - }); - Assertions.assertEquals( - "Opened Link was to forbidden site: https://www.xceptance.com/en/ ==> expected: but was: ", - exception.getMessage()); + Selenide.open("https://posters.xceptance.io:8443/topCategory/Dining?categoryId=2"); } @AfterAll diff --git a/src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationIncludeTest.java b/src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationIncludeTest.java index 9553d82..cc1c97e 100644 --- a/src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationIncludeTest.java +++ b/src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationIncludeTest.java @@ -4,15 +4,12 @@ import com.xceptance.neodymium.junit5.NeodymiumTest; import io.qameta.allure.junit4.Tag; import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; -import org.opentest4j.AssertionFailedError; import showcase.neodymium.tests.AbstractTest; import java.util.Map; import static com.codeborne.selenide.Selenide.$; -import static org.junit.jupiter.api.Assertions.assertThrows; import static showcase.flows.PropertiesFlow.addTempProperty; import static showcase.flows.PropertiesFlow.deleteTempPropertiesFile; @@ -49,29 +46,27 @@ public static void setIncludeList() public void testIncludeList() { Selenide.open("https://posters.xceptance.io:8443/"); - Selenide.sleep(1000); - $(".navbar-toggler").click(); - $(".nav-link[href*='Dining']").click(); + Selenide.open("https://www.xceptance.com/en/"); + } + @NeodymiumTest + public void failingTestClickNotIncludedUrl() + { Selenide.open("https://www.xceptance.com/en/"); // after opening the ULR it is validated if the URL is included and if not, an assertion error will be thrown and the test is stopped // clicking a link to a not included URL creates an error - AssertionFailedError exceptionClick = assertThrows(AssertionFailedError.class, () -> { - $("#navigation a[href*='products']").click(); - }); - Assertions.assertEquals( - "Opened Link was outside permitted URLs: https://www.xceptance.com/en/products/ ==> expected: but was: ", - exceptionClick.getMessage()); + $("#navigation a[href*='products']").click(); + } + + @NeodymiumTest + public void failingTestOpenNotIncludedUrl() + { + Selenide.open("https://www.xceptance.com/en/"); // opening a not included URL creates an error - AssertionFailedError exceptionOpenUrl = assertThrows(AssertionFailedError.class, () -> { - Selenide.open("https://github.com/Xceptance/neodymium"); - }); - Assertions.assertEquals( - "Opened Link was outside permitted URLs: https://github.com/Xceptance/neodymium ==> expected: but was: ", - exceptionOpenUrl.getMessage()); + Selenide.open("https://github.com/Xceptance/neodymium"); } @AfterAll From 467f98396094646f8ed90438e3bf196714cd1a27 Mon Sep 17 00:00:00 2001 From: Jan Robert Avemarg Date: Mon, 3 Feb 2025 11:48:42 +0100 Subject: [PATCH 13/17] updated comments --- .../tests/jsonassertion/JsonAssertionTest.java | 2 -- .../tests/lighthouse/LighthouseTest.java | 18 +++++------------- .../UrlValidationExcludeTest.java | 1 - 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/test/java/showcase/neodymium/tests/jsonassertion/JsonAssertionTest.java b/src/test/java/showcase/neodymium/tests/jsonassertion/JsonAssertionTest.java index b8947e2..f5b8f80 100644 --- a/src/test/java/showcase/neodymium/tests/jsonassertion/JsonAssertionTest.java +++ b/src/test/java/showcase/neodymium/tests/jsonassertion/JsonAssertionTest.java @@ -28,8 +28,6 @@ public void failingTestEqualOnDifferingFiles() throws IOException String actualJson = Files.readString(actualJsonPath, StandardCharsets.UTF_8); // check that the files are equal - // expected error is caught to make the test pass - // the differences are still added to the report and can be seen JsonAssert.assertEquals(expectedJson, actualJson, JSONCompareMode.STRICT_ORDER); } diff --git a/src/test/java/showcase/neodymium/tests/lighthouse/LighthouseTest.java b/src/test/java/showcase/neodymium/tests/lighthouse/LighthouseTest.java index ac2f7b8..b146b90 100644 --- a/src/test/java/showcase/neodymium/tests/lighthouse/LighthouseTest.java +++ b/src/test/java/showcase/neodymium/tests/lighthouse/LighthouseTest.java @@ -16,21 +16,13 @@ public class LighthouseTest extends AbstractTest { @NeodymiumTest - public void testLighthouse() + public void testLighthouse() throws Exception { Selenide.open("https://www.xceptance.com/en/"); - try - { - // calling createLightHouseReport() will create a Lighthouse report for the current page - // this will open a new tab and open the same page again in the new tab - // after generating the report, the additional tab will be closed and the test automatically proceeds with the initial tab - // ATTENTION: can currently cause problems for unique sites tied to a session like order confirmation pages for logged in customers - LighthouseUtils.createLightHouseReport("testReport"); - } - catch (Exception e) - { - throw new RuntimeException(e); - } + // calling createLightHouseReport() will create a Lighthouse report for the current page + // this will open a new tab and open the same page again in the new tab + // after generating the report, the additional tab will be closed and the test automatically proceeds with the initial tab + LighthouseUtils.createLightHouseReport("testReport"); } } diff --git a/src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationExcludeTest.java b/src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationExcludeTest.java index 6758c38..c41cdc0 100644 --- a/src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationExcludeTest.java +++ b/src/test/java/showcase/neodymium/tests/urlvalidation/UrlValidationExcludeTest.java @@ -66,7 +66,6 @@ public void failingTestOpenExcludedUrl() Selenide.open("https://posters.xceptance.io:8443/"); // after opening the ULR it is validated if the URL is excluded and if so, an assertion error will be thrown and the test is stopped - // expected error is caught to make the test pass Selenide.open("https://posters.xceptance.io:8443/topCategory/Dining?categoryId=2"); } From 3282e6b15a4010ed96be7fa8a06daa3f28c245ad Mon Sep 17 00:00:00 2001 From: Jan Robert Avemarg Date: Fri, 7 Feb 2025 17:26:04 +0100 Subject: [PATCH 14/17] fix tests after website change --- .../neodymium/tests/data/AccessDataViaDataObjectsTest.java | 6 +++--- .../neodymium/tests/data/AccessDataViaDataUtilsTest.java | 6 +++--- .../neodymium/tests/data/AccessDataViaJsonPathTest.java | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataObjectsTest.java b/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataObjectsTest.java index d306eb3..020ea62 100644 --- a/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataObjectsTest.java +++ b/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataObjectsTest.java @@ -46,13 +46,13 @@ public void test() for (ServiceTile serviceTile : testDataHomePage.getServiceTiles()) { // check heading with its position - $$("h2").get(serviceTile.getPosition()).should(matchText(serviceTile.getHeading())); + $$("a h2").get(serviceTile.getPosition()).should(matchText(serviceTile.getHeading())); // check explanation text with its position - $$(".explanation").get(serviceTile.getPosition()).should(matchText(serviceTile.getExplanation())); + $$(".bg-dark .explanation").get(serviceTile.getPosition()).should(matchText(serviceTile.getExplanation())); } // check the number of services - $$(".explanation").shouldHave(size(testDataHomePage.getNumberServices())); + $$(".bg-dark .explanation").shouldHave(size(testDataHomePage.getNumberServices())); } } diff --git a/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataUtilsTest.java b/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataUtilsTest.java index 41d635d..cd6aa8a 100644 --- a/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataUtilsTest.java +++ b/src/test/java/showcase/neodymium/tests/data/AccessDataViaDataUtilsTest.java @@ -37,16 +37,16 @@ public void test() while (DataUtils.exists("serviceTile_" + i + "_heading")) { // check heading text - $$("h2").get(i).should(matchText(DataUtils.asString("serviceTile_" + i + "_heading"))); + $$("a h2").get(i).should(matchText(DataUtils.asString("serviceTile_" + i + "_heading"))); // check explanation text - $$(".explanation").get(i).should(matchText(DataUtils.asString("serviceTile_" + i + "_explanation"))); + $$(".bg-dark .explanation").get(i).should(matchText(DataUtils.asString("serviceTile_" + i + "_explanation"))); // next serviceTile i++; } // check the number of services using an integer value provided by DataUtils - $$(".explanation").shouldHave(size(DataUtils.asInt("numberServices"))); + $$(".bg-dark .explanation").shouldHave(size(DataUtils.asInt("numberServices"))); } } diff --git a/src/test/java/showcase/neodymium/tests/data/AccessDataViaJsonPathTest.java b/src/test/java/showcase/neodymium/tests/data/AccessDataViaJsonPathTest.java index 60fea6a..4808fb9 100644 --- a/src/test/java/showcase/neodymium/tests/data/AccessDataViaJsonPathTest.java +++ b/src/test/java/showcase/neodymium/tests/data/AccessDataViaJsonPathTest.java @@ -43,15 +43,15 @@ public void test() ServiceTile serviceTile = DataUtils.get("$.serviceTiles[2]", ServiceTile.class); // check the heading with the right text - $$("h2").get(2).should(matchText(serviceTile.getHeading())); + $$("a h2").get(2).should(matchText(serviceTile.getHeading())); // check explanation with the right text - $$(".explanation").get(2).should(matchText(serviceTile.getExplanation())); + $$(".bg-dark .explanation").get(2).should(matchText(serviceTile.getExplanation())); // get integer test data using DataUtils.get() via JsonPath int numberServices = DataUtils.get("$.numberServices", Integer.class); // check the number of services - $$(".explanation").shouldHave(size(numberServices)); + $$(".bg-dark .explanation").shouldHave(size(numberServices)); } } From 4c6e8a45f3305344ba4789c21667eb693b515d54 Mon Sep 17 00:00:00 2001 From: Jan Robert Avemarg Date: Mon, 10 Feb 2025 16:50:43 +0100 Subject: [PATCH 15/17] update to Neo version 5.2.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ec87971..9a87944 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ 2.22.2 1.9.21 2.12.0 - 5.1.1 + 5.2.0 2.0.24 From e16e6410e80faf5da67167f7a0cdde7c2c9766cb Mon Sep 17 00:00:00 2001 From: RobertAvemarg Date: Wed, 12 Feb 2025 16:46:50 +0100 Subject: [PATCH 16/17] bump up version to 5.2.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9a87944..59bda35 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.xceptance.neodymium.project neodymium-showcase - 5.1.1 + 5.2.0 jar neodymium-showcase From 1d63d494a9e79def1051dfd4d348004896ce0b0c Mon Sep 17 00:00:00 2001 From: RobertAvemarg Date: Wed, 12 Feb 2025 16:51:49 +0100 Subject: [PATCH 17/17] changed logger and updated README --- README.md | 4 ++-- .../tests/logging/LoggingFirstTest.java | 18 +++++++----------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index f9d24a6..5fcd6a5 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ the [reports section](https://github.com/Xceptance/neodymium/wiki/Reports#add-js Due to the steadily increasing importance of accessibility Google Lighthouse is now part of our test framework and can be used to get an accessibility score for the desired websites. To demonstrate the usage the showcase `showcase.neodymium.tests.lighthouse.LighthouseTest.java` was created. -Further reading: [lighthouse section](https://github.com/Xceptance/neodymium/wiki/Reports#lighthouse) +Further reading: [lighthouse section](https://github.com/Xceptance/neodymium/wiki/Accessibility#lighthouse) ## 15. Popup blocker @@ -141,7 +141,7 @@ To prevent the test automation to reach sites that are out of scope or should no include and exclude lists in the `neodymium.config`. The setup and usage of those lists is demonstrated in the showcases in the package `showcase.neodymium.tests.urlvalidation`. -## 18. +## 18. Custom environment data It is possible to add custom values to differentiate between environments or profiles within your test runs, enhancing the granularity of your test environment information. A very basic example can be found in the showcase diff --git a/src/test/java/showcase/neodymium/tests/logging/LoggingFirstTest.java b/src/test/java/showcase/neodymium/tests/logging/LoggingFirstTest.java index 443a28a..dc8709e 100644 --- a/src/test/java/showcase/neodymium/tests/logging/LoggingFirstTest.java +++ b/src/test/java/showcase/neodymium/tests/logging/LoggingFirstTest.java @@ -1,26 +1,22 @@ package showcase.neodymium.tests.logging; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - import com.xceptance.neodymium.common.browser.SuppressBrowsers; import com.xceptance.neodymium.junit5.NeodymiumTest; - import io.qameta.allure.Description; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import showcase.neodymium.tests.AbstractTest; /** - * Neodymium provides extended logging. The log4j-api and log4j-core are included in the Neodymium library.
            - * Therefore it is not necessary to add an entry in the pom.
            - * ConfigurationFactory class will look for log4j2-test.properties in the classpath.
            - * Then it will look for log4j2.properties on the classpath.
            - * The same mechanism applies for other file formats like yaml, json and xml.
            - * As soon as the search was successful, log4j2 will stop and load the configuration file. + * Neodymium provides extended logging. The log4j-api and log4j-core are included in the Neodymium library.
            Therefore it is not necessary to add an entry in + * the pom.
            ConfigurationFactory class will look for log4j2-test.properties in the classpath.
            Then it will look for log4j2.properties on the + * classpath.
            The same mechanism applies for other file formats like yaml, json and xml.
            As soon as the search was successful, log4j2 will stop and load + * the configuration file. */ @SuppressBrowsers public class LoggingFirstTest extends AbstractTest { - private static final Logger logger = LogManager.getLogger(LoggingSecondTest.class); + private static final Logger logger = LogManager.getLogger(LoggingFirstTest.class); @NeodymiumTest @Description("Showcase for logging with log4j2.")