From 6d11c4dbc8056a52acd1962b8bda35e6c1368f21 Mon Sep 17 00:00:00 2001 From: Matthew Casperson Date: Mon, 7 Aug 2017 17:38:09 +1000 Subject: [PATCH] Still trying to fix the tests --- .../agic/apptesting/steps/ValidationStepDefinitions.java | 8 ++++---- src/test/java/au/com/agic/apptesting/LiveTests.java | 2 -- src/test/resources/steptest.feature | 7 ++++--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/main/java/au/com/agic/apptesting/steps/ValidationStepDefinitions.java b/src/main/java/au/com/agic/apptesting/steps/ValidationStepDefinitions.java index e83933ce..c2e1bc76 100644 --- a/src/main/java/au/com/agic/apptesting/steps/ValidationStepDefinitions.java +++ b/src/main/java/au/com/agic/apptesting/steps/ValidationStepDefinitions.java @@ -339,7 +339,7 @@ public void verifyPageContent(final String alias, final String text) { webDriver.findElement(By.tagName("body")).getAttribute("innerText"); if (!pageText.contains(fixedtext)) { - throw new ValidationException("Could not find the text \"" + fixedtext + "\" on the page"); + throw new ValidationException("Could not find the text \"" + fixedtext + "\" on the page with text " + pageText); } } @@ -360,7 +360,7 @@ public void verifyPageRegexContent(final String alias, final String regex) { webDriver.findElement(By.tagName("body")).getAttribute("innerText"); if (!pattern.matcher(pageText).find()) { - throw new ValidationException("Could not find the regex \"" + fixedRegex + "\" on the page"); + throw new ValidationException("Could not find the regex \"" + fixedRegex + "\" on the page with text " + pageText); } } @@ -378,7 +378,7 @@ public void verifyPageContentAbsent(final String alias, final String text) { webDriver.findElement(By.tagName("body")).getAttribute("innerText"); if (pageText.contains(fixedtext)) { - throw new ValidationException("Found the text \"" + fixedtext + "\" on the page"); + throw new ValidationException("Found the text \"" + fixedtext + "\" on the page with text " + pageText); } } @@ -399,7 +399,7 @@ public void verifyPageRegexNotContent(final String alias, final String regex) { webDriver.findElement(By.tagName("body")).getAttribute("innerText"); if (pattern.matcher(pageText).find()) { - throw new ValidationException("Found the regex \"" + fixedRegex + "\" on the page"); + throw new ValidationException("Found the regex \"" + fixedRegex + "\" on the page with text " + pageText); } } diff --git a/src/test/java/au/com/agic/apptesting/LiveTests.java b/src/test/java/au/com/agic/apptesting/LiveTests.java index 0196c8cd..077df4eb 100644 --- a/src/test/java/au/com/agic/apptesting/LiveTests.java +++ b/src/test/java/au/com/agic/apptesting/LiveTests.java @@ -101,8 +101,6 @@ public void getBrowserList() throws JSONException { browsers.add("PhantomJS"); } else { try { - - final JSONObject settings = new JSONObject(browsersSysProp); if (settings.has("browsers")) { diff --git a/src/test/resources/steptest.feature b/src/test/resources/steptest.feature index 625394e8..6f263a06 100644 --- a/src/test/resources/steptest.feature +++ b/src/test/resources/steptest.feature @@ -58,12 +58,13 @@ Feature: Test of the steps provided by Iridium And I scroll to the bottom of the page # IE reports hidden and invisible text And I verify that the page contains the regex "Some text with (blah)?hidden elements" - And I verify that the page contains the regex "Some text with (blah)?invisible elements" + # The whitspace before the invisible element could be a space, or a space and line break + And I verify that the page contains the regex "Some text with\s+(blah)?invisible elements" And I verify that the page contains the text "Some text with supertext" And I verify that the page contains the text "Some text with subtext" And I verify that the page contains the text "Some text with UTF characters like Є and ϼ" - # The whitespace between table cells can be tabs or spaces depending on the browser - And I verify that the page contains the regex "Some\stext\sin\sa\stable" + # The whitespace between table cells can be tabs, spaces or newlines depending on the browser + And I verify that the page contains the regex "Some(\s)+text(\s)+in(\s)+a(\s)+table" @test Scenario: Test cookie steps