From 7c9a8a360611900d7877b77b810c2bf9ca487595 Mon Sep 17 00:00:00 2001 From: dn0000001 Date: Sat, 7 Oct 2023 16:47:52 -0400 Subject: [PATCH] Fix Smoke Test suite due to website changes --- .../common/ui/app/pageObjects/CsvFileDownloadPage.java | 2 +- .../ui/app/pageObjects/PrimeFacesSelectManyCheckboxPage.java | 2 +- .../ui/app/pageObjects/PrimeFacesSelectOneRadioPage.java | 2 +- .../com/automation/common/ui/app/tests/ChangeBrowserTest.java | 4 ++++ .../ui/support/testng/TestNGBaseWithoutListeners.java | 4 ++-- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/automation-tests/src/main/java/com/automation/common/ui/app/pageObjects/CsvFileDownloadPage.java b/automation-tests/src/main/java/com/automation/common/ui/app/pageObjects/CsvFileDownloadPage.java index 4526290..5f27bc7 100644 --- a/automation-tests/src/main/java/com/automation/common/ui/app/pageObjects/CsvFileDownloadPage.java +++ b/automation-tests/src/main/java/com/automation/common/ui/app/pageObjects/CsvFileDownloadPage.java @@ -22,7 +22,7 @@ public class CsvFileDownloadPage extends PageObjectV2 { private static final String LINK_HTTP_STATUS = "Link HTTP Status"; @XStreamOmitField - @FindBy(css = "h3 [href$='Research-and-development-survey-2021-CSV-notes.csv']") + @FindBy(css = "h3 [href$='research-and-development-survey-2022-csv-notes.csv']") private WebComponent downloadLink; public CsvFileDownloadPage() { diff --git a/automation-tests/src/main/java/com/automation/common/ui/app/pageObjects/PrimeFacesSelectManyCheckboxPage.java b/automation-tests/src/main/java/com/automation/common/ui/app/pageObjects/PrimeFacesSelectManyCheckboxPage.java index eeeb02e..5e62d76 100644 --- a/automation-tests/src/main/java/com/automation/common/ui/app/pageObjects/PrimeFacesSelectManyCheckboxPage.java +++ b/automation-tests/src/main/java/com/automation/common/ui/app/pageObjects/PrimeFacesSelectManyCheckboxPage.java @@ -25,7 +25,7 @@ public class PrimeFacesSelectManyCheckboxPage extends PageObjectV2 { private static final String VALUE_TO_BE_SET = "true"; private static final BasicClock clock = new BasicClock(); - @FindBy(xpath = "//table[contains(@id, 'basic')]//label[text()='Option 1']/..") + @FindBy(xpath = "//*[contains(@id, 'basic')]//label[text()='Option 1']/..") private CheckBoxLabel option1; public PrimeFacesSelectManyCheckboxPage() { diff --git a/automation-tests/src/main/java/com/automation/common/ui/app/pageObjects/PrimeFacesSelectOneRadioPage.java b/automation-tests/src/main/java/com/automation/common/ui/app/pageObjects/PrimeFacesSelectOneRadioPage.java index 0569ed0..758f0a1 100644 --- a/automation-tests/src/main/java/com/automation/common/ui/app/pageObjects/PrimeFacesSelectOneRadioPage.java +++ b/automation-tests/src/main/java/com/automation/common/ui/app/pageObjects/PrimeFacesSelectOneRadioPage.java @@ -7,7 +7,7 @@ import ru.yandex.qatools.allure.annotations.Step; public class PrimeFacesSelectOneRadioPage extends PageObjectV2 { - @FindBy(css = ".ui-selectoneradio[id$=':console'] td") + @FindBy(css = ".ui-selectoneradio[id$=':line'] [role='radio']") private PrimeFacesRadioButtonGroup basic; public PrimeFacesSelectOneRadioPage() { diff --git a/automation-tests/src/main/java/com/automation/common/ui/app/tests/ChangeBrowserTest.java b/automation-tests/src/main/java/com/automation/common/ui/app/tests/ChangeBrowserTest.java index a98b2d1..d42335f 100644 --- a/automation-tests/src/main/java/com/automation/common/ui/app/tests/ChangeBrowserTest.java +++ b/automation-tests/src/main/java/com/automation/common/ui/app/tests/ChangeBrowserTest.java @@ -42,6 +42,10 @@ public void performTest() { AssertJUtil.assertThat(getContext().getDriver().getCurrentUrl()).as("Changed Context URL").contains(SITE_2_VALIDATION); AssertJUtil.assertThat(Utils.getStoredTestProperties().getBrowserType()).as("Changed Test Properties").isEqualTo(EXPECTED_BROWSER); + // Random actions to prevent 'Failed to shutdown Driver Command Executor' that seems to occur + // if you shutdown the browser too fast after launching. + new HerokuappDataTableEqualsTest().verifyTable1EqualsTable2Test(); + Utils.restoreBrowser(); AssertJUtil.assertThat(getContext().getDriver().getCurrentUrl()).as("Restored Context URL Diff").doesNotContain(SITE_2_VALIDATION); AssertJUtil.assertThat(getContext().getDriver().getCurrentUrl()).as("Restored Context URL Same").contains(SITE_1_VALIDATION); diff --git a/taf/src/main/java/com/taf/automation/ui/support/testng/TestNGBaseWithoutListeners.java b/taf/src/main/java/com/taf/automation/ui/support/testng/TestNGBaseWithoutListeners.java index fd39d15..b96a329 100644 --- a/taf/src/main/java/com/taf/automation/ui/support/testng/TestNGBaseWithoutListeners.java +++ b/taf/src/main/java/com/taf/automation/ui/support/testng/TestNGBaseWithoutListeners.java @@ -50,7 +50,7 @@ public static void takeScreenshot(String title) { if (context() != null && context().getDriver() != null) { try { Utils.until(ExpectedConditionsUtil.takeScreenshot(title)).forEach(Attachment::build); - } catch (Exception ex) { + } catch (Exception | AssertionError ex) { String shortMessage = "Could not take screenshot for " + title; StringWriter sw = new StringWriter(); ex.printStackTrace(new PrintWriter(sw)); @@ -73,7 +73,7 @@ public static void takeHTML(String title) { if (AppiumDriver.class.isAssignableFrom(context().getDriver().getClass())) { type = "text/xml"; } - } catch (Exception ex) { + } catch (Exception | AssertionError ex) { String shortMessage = "Could not take HTML for " + title; StringWriter sw = new StringWriter(); ex.printStackTrace(new PrintWriter(sw));