From f07529a0b2823110be71a444d80ed06e157b1fe7 Mon Sep 17 00:00:00 2001 From: RobertAvemarg Date: Wed, 30 Nov 2022 11:21:28 +0100 Subject: [PATCH 1/3] update snakeyaml to 1.33 --- README.md | 4 ++-- pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9dabcbfd8..029cff89c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Maven Central](https://img.shields.io/maven-central/v/com.xceptance/neodymium-library.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.xceptance%22%20AND%20a:%22neodymium-library%22) [![Join the chat at https://gitter.im/neodymium-library/community](https://badges.gitter.im/neodymium-library/community.svg)](https://gitter.im/neodymium-library/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -# Neodymium v4.1.4 +# Neodymium v4.1.5 Neodymium tries to solve your typical and most pressing UI test automation problems by combining JUnit, WebDriver, BDD/Cucumber, and proper reporting. It gives you ready to use templates, assembles well-known open source projects, and enhances this all with additional functionality that is often missing. Neodymium is basically the combination of state of the art open source test libraries with additional glue to make it stick reliably together. @@ -47,7 +47,7 @@ If you are still impatient, here is the quickest way to get Neodymium added to y com.xceptance neodymium-library - 4.1.4 + 4.1.5 ``` Add the `@RunWith` annotation to your test class or its superclass. This enables test execution with Neodymium. diff --git a/pom.xml b/pom.xml index dfd12526b..9f9e8159e 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.xceptance neodymium-library - 4.1.4 + 4.1.5 neodymium-library https://github.com/Xceptance/neodymium-library @@ -223,7 +223,7 @@ org.yaml snakeyaml - 1.31 + 1.33 io.cucumber From 3e3a049950264e50fc7b9a900f44ed651d388d9d Mon Sep 17 00:00:00 2001 From: RobertAvemarg Date: Tue, 6 Dec 2022 10:54:15 +0100 Subject: [PATCH 2/3] changed test website from xceptance to posters.xceptance.io --- config/browser.properties | 1 + .../testclasses/proxy/RunWithProxy.java | 6 +- .../softassertion/UseSoftAssertions.java | 4 +- .../tests/ProxyConfigurationTest.java | 2 +- .../neodymium/util/DebugUtilsTest.java | 26 +++---- .../neodymium/util/JavaScriptUtilsTest.java | 8 +- .../neodymium/util/SelenideAddonsTest.java | 76 +++++++++---------- 7 files changed, 62 insertions(+), 61 deletions(-) diff --git a/config/browser.properties b/config/browser.properties index 0e2894c32..14c5b5c4d 100644 --- a/config/browser.properties +++ b/config/browser.properties @@ -118,6 +118,7 @@ browserprofile.Chrome_headless.browser = chrome browserprofile.Chrome_headless.browserResolution = 1024x768 browserprofile.Chrome_headless.arguments = -ignore-certificate-errors browserprofile.Chrome_headless.headless = true +browserprofile.Chrome_headless.acceptInsecureCertificates = true # Local headless Chrome browserprofile.Chrome_1500x1000_headless.name = Headless Google Chrome 1500x1000 diff --git a/src/test/java/com/xceptance/neodymium/testclasses/proxy/RunWithProxy.java b/src/test/java/com/xceptance/neodymium/testclasses/proxy/RunWithProxy.java index 9d1bb0382..1ac546320 100644 --- a/src/test/java/com/xceptance/neodymium/testclasses/proxy/RunWithProxy.java +++ b/src/test/java/com/xceptance/neodymium/testclasses/proxy/RunWithProxy.java @@ -25,11 +25,11 @@ public void testProxyConfiguration() }); } - // the test is expected to run since we configured a bypass for "www.xceptance.com" + // the test is expected to run since we configured a bypass for "posters.xceptance.io" @Test public void testProxyBypassConfiguration() { - Selenide.open("https://www.xceptance.com"); - $("#page #navigation").shouldBe(visible); + Selenide.open("https://posters.xceptance.io:8443/posters/"); + $("#header-search-trigger").shouldBe(visible); } } diff --git a/src/test/java/com/xceptance/neodymium/testclasses/softassertion/UseSoftAssertions.java b/src/test/java/com/xceptance/neodymium/testclasses/softassertion/UseSoftAssertions.java index f2948e880..6d0bf4599 100644 --- a/src/test/java/com/xceptance/neodymium/testclasses/softassertion/UseSoftAssertions.java +++ b/src/test/java/com/xceptance/neodymium/testclasses/softassertion/UseSoftAssertions.java @@ -28,12 +28,12 @@ public class UseSoftAssertions public void validateSoftAssertion() { Neodymium.softAssertions(true); - Selenide.open("https://blog.xceptance.com/"); + Selenide.open("https://posters.xceptance.io:8443/posters/"); Assert.assertEquals(Configuration.assertionMode, AssertionMode.SOFT); $("#notFound1").should(exist); $("#notFound2").should(exist); - $("#masthead .search-toggle").click(); + $("#header-search-trigger").click(); $("#notFound3").should(exist); Assert.assertThrows(ElementNotFound.class, () -> { $("#notFound4").click(); diff --git a/src/test/java/com/xceptance/neodymium/tests/ProxyConfigurationTest.java b/src/test/java/com/xceptance/neodymium/tests/ProxyConfigurationTest.java index 9858ea5a0..2115f28e4 100644 --- a/src/test/java/com/xceptance/neodymium/tests/ProxyConfigurationTest.java +++ b/src/test/java/com/xceptance/neodymium/tests/ProxyConfigurationTest.java @@ -21,7 +21,7 @@ public class ProxyConfigurationTest extends NeodymiumTest private static final String PORT = "1323"; - private static final String BYPASS = "www.xceptance.com"; + private static final String BYPASS = "posters.xceptance.io"; private static final String SOCKET_USERNAME = "username"; diff --git a/src/test/java/com/xceptance/neodymium/util/DebugUtilsTest.java b/src/test/java/com/xceptance/neodymium/util/DebugUtilsTest.java index 14e4a8bd1..a59c93c15 100644 --- a/src/test/java/com/xceptance/neodymium/util/DebugUtilsTest.java +++ b/src/test/java/com/xceptance/neodymium/util/DebugUtilsTest.java @@ -27,20 +27,20 @@ public void testHighlighting() { Neodymium.configuration().setProperty("neodymium.debugUtils.highlight.duration", "500"); - Selenide.open("https://blog.xceptance.com/"); + Selenide.open("https://posters.xceptance.io:8443/posters/"); DebugUtils.injectJavaScript(); assertJsSuccessfullyInjected(); - final List list = $("body").findElements(By.cssSelector("#masthead")); + final List list = $("body").findElements(By.cssSelector("#globalNavigation")); DebugUtils.highlightElements(list, Neodymium.getDriver()); $(".neodymium-highlight-box").shouldBe(visible); DebugUtils.resetAllHighlight(); $(".neodymium-highlight-box").shouldNot(exist); - final List list2 = $("body").findElements(By.cssSelector("#content article")); + final List list2 = $("body").findElements(By.cssSelector("#productList li")); DebugUtils.highlightElements(list2, Neodymium.getDriver()); - $$(".neodymium-highlight-box").shouldHaveSize(10); + $$(".neodymium-highlight-box").shouldHaveSize(3); DebugUtils.resetAllHighlight(); $(".neodymium-highlight-box").shouldNot(exist); @@ -51,11 +51,11 @@ public void testHighlightingWithoutImplicitWaitTime() { Neodymium.configuration().setProperty("neodymium.debugUtils.highlight.duration", "500"); - Selenide.open("https://blog.xceptance.com/"); + Selenide.open("https://posters.xceptance.io:8443/posters/"); DebugUtils.injectJavaScript(); assertJsSuccessfullyInjected(); - final List list = $("body").findElements(By.cssSelector("#masthead")); + final List list = $("body").findElements(By.cssSelector("#globalNavigation")); DebugUtils.highlightElements(list, Neodymium.getDriver()); $(".neodymium-highlight-box").shouldBe(visible); @@ -72,32 +72,32 @@ public void testWaiting() Neodymium.configuration().setProperty("neodymium.debugUtils.highlight", "true"); // one wait due to navigation - Selenide.open("https://blog.xceptance.com/"); + Selenide.open("https://posters.xceptance.io:8443/posters/"); Assert.assertEquals(0, eventListener.implicitWaitCount); // one wait due to find - $("body #masthead").should(exist); + $("body #globalNavigation").should(exist); Assert.assertEquals(1, eventListener.implicitWaitCount); assertJsSuccessfullyInjected(); // two waits due to chain finding - $("body").findElements(By.cssSelector("#content article")); + $("body").findElements(By.cssSelector("#productList li")); Assert.assertEquals(3, eventListener.implicitWaitCount); // two waits due to find and click - $("#text-3 h1").click(); + $("#titleIndex").click(); Assert.assertEquals(4, eventListener.implicitWaitCount); // additional two waits due to find and click - $("#masthead .search-toggle").click(); + $("#header-search-trigger").click(); Assert.assertEquals(5, eventListener.implicitWaitCount); // three waits due to find and change value (consumes 2 waits) - $("#search-container .search-form input.search-field").val("abc"); + $("#searchForm input").val("abc"); Assert.assertEquals(6, eventListener.implicitWaitCount); // two waits due to find and press enter - $("#search-container .search-form input.search-field").pressEnter(); + $("#searchForm input").pressEnter(); Assert.assertEquals(7, eventListener.implicitWaitCount); } diff --git a/src/test/java/com/xceptance/neodymium/util/JavaScriptUtilsTest.java b/src/test/java/com/xceptance/neodymium/util/JavaScriptUtilsTest.java index 61bdb59b6..5aa8cde0f 100644 --- a/src/test/java/com/xceptance/neodymium/util/JavaScriptUtilsTest.java +++ b/src/test/java/com/xceptance/neodymium/util/JavaScriptUtilsTest.java @@ -17,7 +17,7 @@ public class JavaScriptUtilsTest public void testWaitingAnimationSelectorUnconfigured() { Neodymium.configuration().setProperty("neodymium.javaScriptUtils.timeout", "10000"); - Selenide.open("https://blog.xceptance.com/"); + Selenide.open("https://posters.xceptance.io:8443/posters/"); final long start = System.currentTimeMillis(); JavaScriptUtils.waitForReady(); final long end = System.currentTimeMillis(); @@ -28,10 +28,10 @@ public void testWaitingAnimationSelectorUnconfigured() @Test public void testWaitingAnimationSelectorExistsOnPage() { - Neodymium.configuration().setProperty("neodymium.javaScriptUtils.loading.animationSelector", "#main-content"); + Neodymium.configuration().setProperty("neodymium.javaScriptUtils.loading.animationSelector", "#main"); Neodymium.configuration().setProperty("neodymium.javaScriptUtils.timeout", "10000"); - Selenide.open("https://blog.xceptance.com/"); + Selenide.open("https://posters.xceptance.io:8443/posters/"); final long start = System.currentTimeMillis(); JavaScriptUtils.waitForReady(); final long end = System.currentTimeMillis(); @@ -46,7 +46,7 @@ public void testWaitingAnimationSelectorUnavailableOnPage() Neodymium.configuration().setProperty("neodymium.javaScriptUtils.loading.animationSelector", ".cantFindThisClass"); Neodymium.configuration().setProperty("neodymium.javaScriptUtils.timeout", "10000"); - Selenide.open("https://blog.xceptance.com/"); + Selenide.open("https://posters.xceptance.io:8443/posters/"); final long start = System.currentTimeMillis(); JavaScriptUtils.waitForReady(); final long end = System.currentTimeMillis(); diff --git a/src/test/java/com/xceptance/neodymium/util/SelenideAddonsTest.java b/src/test/java/com/xceptance/neodymium/util/SelenideAddonsTest.java index 249e36ce9..9f32555ad 100644 --- a/src/test/java/com/xceptance/neodymium/util/SelenideAddonsTest.java +++ b/src/test/java/com/xceptance/neodymium/util/SelenideAddonsTest.java @@ -36,99 +36,100 @@ @Browser("Chrome_headless") public class SelenideAddonsTest { - private void openBlogPage() + private void openPostersStartPage() { - Selenide.open("https://blog.xceptance.com/"); + Selenide.open("https://posters.xceptance.io:8443/posters/"); } @Test public void testMatchesAttributeCondition() { - openBlogPage(); - $("#masthead .search-toggle").click(); + openPostersStartPage(); + $("#header-search-trigger").click(); - $("#search-container .search-field").should(SelenideAddons.matchesAttribute("placeholder", "Search")); + $("#searchForm input").should(SelenideAddons.matchesAttribute("placeholder", "Search")); } @Test public void testMatchAttributeCondition() { - openBlogPage(); - $("#masthead .search-toggle").click(); + openPostersStartPage(); + $("#header-search-trigger").click(); - $("#search-container .search-field").should(SelenideAddons.matchAttribute("placeholder", "^S.a.c.\\s…")); - $("#search-container .search-field").should(SelenideAddons.matchAttribute("placeholder", "\\D+")); + $("#searchForm input").should(SelenideAddons.matchAttribute("placeholder", "^S.a.c.")); + $("#searchForm input").should(SelenideAddons.matchAttribute("placeholder", "\\D+")); } @Test public void testMatchAttributeConditionError() { - openBlogPage(); - $("#masthead .search-toggle").click(); + openPostersStartPage(); + $("#header-search-trigger").click(); Assert.assertThrows(ElementShould.class, () -> { - $("#search-container .search-field").should(SelenideAddons.matchAttribute("placeholder", "\\d+")); + $("#searchForm input").should(SelenideAddons.matchAttribute("placeholder", "\\d+")); }); } @Test public void testMatchAttributeConditionErrorMissingAttribute() { - openBlogPage(); - $("#masthead .search-toggle").click(); + openPostersStartPage(); + $("#header-search-trigger").click(); Assert.assertThrows(ElementShould.class, () -> { - $("#search-container .search-field").should(SelenideAddons.matchAttribute("foo", "bar")); + $("#searchForm input").should(SelenideAddons.matchAttribute("foo", "bar")); }); } @Test public void testMatchesValueCondition() { - openBlogPage(); - $("#masthead .search-toggle").click(); - $("#search-container .search-field").val("searchphrase").submit(); + openPostersStartPage(); + $("#header-search-trigger").click(); + $("#searchForm input").val("bear").submit(); - $("#content .search-field").should(SelenideAddons.matchesValue("earchphras")); + // used "#searchForm input" because it has the search term as value + $("#searchForm input").should(SelenideAddons.matchesValue("ea")); } @Test public void testMatchValueCondition() { - openBlogPage(); - $("#masthead .search-toggle").click(); - $("#search-container .search-field").val("searchphrase").submit(); + openPostersStartPage(); + $("#header-search-trigger").click(); + $("#searchForm input").val("bear").submit(); - $("#content .search-field").should(SelenideAddons.matchValue("^s.a.c.p.r.s.$")); - $("#content .search-field").should(SelenideAddons.matchValue("\\D+")); + $("#searchForm input").should(SelenideAddons.matchValue("b.a.")); + $("#searchForm input").should(SelenideAddons.matchValue("\\D+")); } @Test public void testMatchValueConditionError() { - openBlogPage(); - $("#masthead .search-toggle").click(); - $("#search-container .search-field").val("searchphrase").submit(); + openPostersStartPage(); + $("#header-search-trigger").click(); + $("#searchForm input").val("bear").submit(); Assert.assertThrows(ElementShould.class, () -> { - $("#content .search-field").should(SelenideAddons.matchValue("\\d+")); + $("#searchForm input").should(SelenideAddons.matchValue("\\d+")); }); } @Test() public void testWrapAssertion() { - openBlogPage(); + openPostersStartPage(); SelenideAddons.wrapAssertionError(() -> { - Assert.assertEquals("Passionate Testing | Xceptance Blog", Selenide.title()); + Assert.assertEquals("Posters - The Ultimate Online Shop", Selenide.title()); }); } @Test public void testWrapAssertionError() { - openBlogPage(); + openPostersStartPage(); Assert.assertThrows(UIAssertionError.class, () -> { SelenideAddons.wrapAssertionError(() -> { @@ -161,11 +162,10 @@ public void beforeEvent(LogEvent currentLog) } }); - openBlogPage(); + openPostersStartPage(); Neodymium.softAssertions(true); try { - SelenideAddons.wrapAssertionError(() -> { Assert.assertEquals(errMessage, "MyPageTitle", Selenide.title()); }); @@ -202,7 +202,7 @@ public void beforeEvent(LogEvent currentLog) } }); - openBlogPage(); + openPostersStartPage(); Neodymium.softAssertions(true); try { @@ -223,7 +223,7 @@ public void testWrapAssertionErrorWithoutMessage() final String errMessage = "AssertionError: No error message provided by the Assertion."; try { - openBlogPage(); + openPostersStartPage(); SelenideAddons.wrapAssertionError(() -> { Assert.assertTrue(Selenide.title().startsWith("MyPageTitle")); }); @@ -323,7 +323,7 @@ public void testSafeSupplier() final Iterator iterator = runArray.iterator(); // testing the error path after three exceptions - openBlogPage(); + openPostersStartPage(); long startTime = new Date().getTime(); try { @@ -501,7 +501,7 @@ public void testRightwardDragAndDrop() SelenideElement slider = $(".balSlider span[role=slider]"); slider.shouldHave(attribute("aria-valuenow", "0")); - SelenideAddons.dragAndDrop(slider, 32, 0); + SelenideAddons.dragAndDrop(slider, 42, 0); slider.shouldHave(attribute("aria-valuenow", "2")); } @@ -512,7 +512,7 @@ public void testLeftwardDragAndDrop() SelenideElement slider = $(".balSlider span[role=slider]"); slider.shouldHave(attribute("aria-valuenow", "0")); - SelenideAddons.dragAndDrop(slider, -32, 0); + SelenideAddons.dragAndDrop(slider, -42, 0); slider.shouldHave(attribute("aria-valuenow", "-2")); } From 09230ded2deff5c08c092f696c1236dcd1a967c0 Mon Sep 17 00:00:00 2001 From: RobertAvemarg Date: Tue, 13 Dec 2022 12:00:55 +0100 Subject: [PATCH 3/3] implemented requested changes --- .../xceptance/neodymium/util/SelenideAddonsTest.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/test/java/com/xceptance/neodymium/util/SelenideAddonsTest.java b/src/test/java/com/xceptance/neodymium/util/SelenideAddonsTest.java index 9f32555ad..5c177a976 100644 --- a/src/test/java/com/xceptance/neodymium/util/SelenideAddonsTest.java +++ b/src/test/java/com/xceptance/neodymium/util/SelenideAddonsTest.java @@ -87,10 +87,9 @@ public void testMatchesValueCondition() { openPostersStartPage(); $("#header-search-trigger").click(); - $("#searchForm input").val("bear").submit(); + $("#searchForm input").val("mozzarella").submit(); - // used "#searchForm input" because it has the search term as value - $("#searchForm input").should(SelenideAddons.matchesValue("ea")); + $("#searchForm input").should(SelenideAddons.matchesValue("ozzarell")); } @Test @@ -98,9 +97,9 @@ public void testMatchValueCondition() { openPostersStartPage(); $("#header-search-trigger").click(); - $("#searchForm input").val("bear").submit(); + $("#searchForm input").val("mozzarella").submit(); - $("#searchForm input").should(SelenideAddons.matchValue("b.a.")); + $("#searchForm input").should(SelenideAddons.matchValue("^m.z.a.e.l.$")); $("#searchForm input").should(SelenideAddons.matchValue("\\D+")); } @@ -109,7 +108,7 @@ public void testMatchValueConditionError() { openPostersStartPage(); $("#header-search-trigger").click(); - $("#searchForm input").val("bear").submit(); + $("#searchForm input").val("mozzarella").submit(); Assert.assertThrows(ElementShould.class, () -> { $("#searchForm input").should(SelenideAddons.matchValue("\\d+"));