diff --git a/selenium-testing/config.properties.template b/selenium-testing/config.properties.template
index a9176eb2..945a1cf5 100644
--- a/selenium-testing/config.properties.template
+++ b/selenium-testing/config.properties.template
@@ -2,6 +2,10 @@ portal_url=https://ofm-frontend-test-e1800b-dev.apps.silver.devops.gov.bc.ca/log
portal_username=
portal_password=
+internal_portal_url=https://ofm-frontend-test-e1800b-dev.apps.silver.devops.gov.bc.ca/internal
+internal_portal_username=
+internal_portal_password=
+
crm_url=https://mychildcareservicesdev.crm3.dynamics.com/main.aspx?appid=af54cb40-d463-ee11-8df0-000d3a09d499&pagetype=dashboard&id=73c44d9c-cfe6-ee11-a204-000d3af4865d&type=system&_canOverride=true
crm_username=
crm_password=
diff --git a/selenium-testing/pom.xml b/selenium-testing/pom.xml
index e4d54101..d4a481af 100644
--- a/selenium-testing/pom.xml
+++ b/selenium-testing/pom.xml
@@ -69,5 +69,10 @@
opencsv
5.5.2
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.13
+
diff --git a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_CRM/CRMHomePage.java b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_CRM/CRMHomePage.java
index 457e9a8d..5c4524ae 100644
--- a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_CRM/CRMHomePage.java
+++ b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_CRM/CRMHomePage.java
@@ -23,6 +23,43 @@ public class CRMHomePage {
@FindBy(xpath = "//*[@aria-label='Edit']")
WebElement editButton;
+
+ @FindBy(xpath = "//*[@aria-label[contains(., 'Account Manager')]]")
+ WebElement profileButton;
+
+ @FindBy(xpath = "//*[@aria-label='Sign out of this account']")
+ WebElement signOut;
+
+ @FindBy(xpath = "//*[@aria-label='Organization-Facilities']")
+ WebElement orgFacButton;
+
+ @FindBy(xpath = "//*[@aria-label='Contacts']")
+ WebElement contactButton;
+
+ @FindBy(xpath = "//*[@aria-label='Licences']")
+ WebElement licenseButton;
+
+ @FindBy(xpath = "//*[@aria-label='Contact Lists']")
+ WebElement contactListButton;
+
+ @FindBy(xpath = "//*[@aria-label='Notifications']")
+ WebElement notificationButton;
+
+ @FindBy(xpath = "//*[@aria-label='Provider Reports']")
+ WebElement providerReportsButton;
+
+ @FindBy(xpath = "//*[@aria-label='Applications']")
+ WebElement applicationsButton;
+
+ @FindBy(xpath = "//*[@aria-label='Supplementaries']")
+ WebElement supplementariesButton;
+
+ @FindBy(xpath = "//*[@aria-label='Fundings']")
+ WebElement fundingsButton;
+
+ @FindBy(xpath = "//*[@aria-label='Assistance Requests']")
+ WebElement assistanceRequestsButton;
+
public CRMHomePage(WebDriver driver) {
this.driver = driver;
@@ -43,4 +80,52 @@ public void selectIrregularExpenseApplication() {
e.printStackTrace();
}
}
+
+ public void selectProfile() {
+ wait.until(ExpectedConditions.elementToBeClickable(profileButton)).click();
+ }
+
+ public void clickSignOut() {
+ wait.until(ExpectedConditions.elementToBeClickable(signOut)).click();
+ }
+
+ public void selectOrgFacButton() {
+ wait.until(ExpectedConditions.elementToBeClickable(orgFacButton)).click();
+ }
+
+ public void selectContacts() {
+ wait.until(ExpectedConditions.elementToBeClickable(contactButton)).click();
+ }
+
+ public void selectLicenses() {
+ wait.until(ExpectedConditions.elementToBeClickable(licenseButton)).click();
+ }
+
+ public void selectContactList() {
+ wait.until(ExpectedConditions.elementToBeClickable(contactListButton)).click();
+ }
+
+ public void selectNotifications() {
+ wait.until(ExpectedConditions.elementToBeClickable(notificationButton)).click();
+ }
+
+ public void selectProviderReports() {
+ wait.until(ExpectedConditions.elementToBeClickable(providerReportsButton)).click();
+ }
+
+ public void selectApplications() {
+ wait.until(ExpectedConditions.elementToBeClickable(applicationsButton)).click();
+ }
+
+ public void selectSupplementaries() {
+ wait.until(ExpectedConditions.elementToBeClickable(supplementariesButton)).click();
+ }
+
+ public void selectFundings() {
+ wait.until(ExpectedConditions.elementToBeClickable(fundingsButton)).click();
+ }
+
+ public void selectAssistanceRequests() {
+ wait.until(ExpectedConditions.elementToBeClickable(assistanceRequestsButton)).click();
+ }
}
diff --git a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_CRM/CRMSignInCredentialPage.java b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_CRM/CRMSignInCredentialPage.java
index f59ae9c3..14ecfdf7 100644
--- a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_CRM/CRMSignInCredentialPage.java
+++ b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_CRM/CRMSignInCredentialPage.java
@@ -40,6 +40,9 @@ public class CRMSignInCredentialPage {
@FindBy(xpath = "//*[text()='Assistance Requests']")
WebElement buttonAssistanceRequest;
+
+ @FindBy(xpath = "//*[@aria-label[contains(., 'Sign in with')]]")
+ WebElement signInAccount;
public CRMSignInCredentialPage(WebDriver driver) {
this.driver = driver;
@@ -86,5 +89,9 @@ public void clickOrgFacilities() {
public void clickAssistanceRequest() {
wait.until(ExpectedConditions.elementToBeClickable(buttonAssistanceRequest)).click();
}
+
+ public void clickAccount() {
+ wait.until(ExpectedConditions.elementToBeClickable(signInAccount)).click();
+ }
}
diff --git a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_CRM/LicenseDetailsPage.java b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_CRM/LicenseDetailsPage.java
index e847a875..e6794ea3 100644
--- a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_CRM/LicenseDetailsPage.java
+++ b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_CRM/LicenseDetailsPage.java
@@ -32,6 +32,9 @@ public class LicenseDetailsPage {
@FindBy(xpath = "//*[@aria-label='Save (CTRL+S)']")
WebElement saveButton;
+ @FindBy(xpath = "//*[@aria-label='Save & Close']")
+ WebElement saveAndCloseButton;
+
@FindBy(xpath = "//*[@aria-label='New Service Delivery Detail. Add New Service Delivery Detail']")
WebElement newServiceDeliveryDetail;
@@ -59,4 +62,12 @@ public void setStartDate() {
public void saveLicense() {
wait.until(ExpectedConditions.visibilityOf(saveButton)).click();
}
+
+ public void saveAndCloseLicense() {
+ wait.until(ExpectedConditions.visibilityOf(saveAndCloseButton)).click();
+ }
+
+ public void addNewSDD() {
+ wait.until(ExpectedConditions.visibilityOf(newServiceDeliveryDetail)).click();
+ }
}
\ No newline at end of file
diff --git a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_CRM/ServiceDeliveryDetailsPage.java b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_CRM/ServiceDeliveryDetailsPage.java
new file mode 100644
index 00000000..7d2789f9
--- /dev/null
+++ b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_CRM/ServiceDeliveryDetailsPage.java
@@ -0,0 +1,98 @@
+package ca.bc.gov.ecc.ofm.selenium.v1.PageFactory_CRM;
+
+import java.time.Duration;
+import java.util.Base64;
+
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+import org.openqa.selenium.support.PageFactory;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+public class ServiceDeliveryDetailsPage {
+ WebDriver driver;
+ WebDriverWait wait;
+
+ @FindBy(xpath = "//*[@aria-label='Licence Type']")
+ WebElement licenseTypeField;
+
+ @FindBy(xpath = "//*[text()='Group Child Care (Under 36 Months)']")
+ WebElement licenseTypeOption;
+
+ @FindBy(xpath = "//*[@aria-label='Weeks in Operation']")
+ WebElement weeksInOperationField;
+
+ @FindBy(id = "ofm_week_days_ledit")
+ WebElement daysOfWeekField;
+
+ @FindBy(xpath = "//*[text()='Monday']")
+ WebElement daysOfWeekOption;
+
+ @FindBy(xpath = "//*[@aria-label='Hours of Operation From']")
+ WebElement hoursOfOperationFromField;
+
+ @FindBy(xpath = "//*[@aria-label='Hours of Operation To']")
+ WebElement hoursOfOperationToField;
+
+ @FindBy(xpath = "//*[@aria-label='Licensed Spaces']")
+ WebElement licenseSpacesField;
+
+ @FindBy(xpath = "//*[@aria-label='Operational Spaces']")
+ WebElement operationalSpacesField;
+
+ @FindBy(xpath = "//*[@aria-label='Enrolled Spaces']")
+ WebElement enrolledSpacesField;
+
+ @FindBy(xpath = "//*[@aria-label='Save & Close']")
+ WebElement saveAndCloseButton;
+
+
+ public ServiceDeliveryDetailsPage(WebDriver driver) {
+ this.driver = driver;
+ PageFactory.initElements(driver, this);
+ wait = new WebDriverWait(driver, Duration.ofMillis(10000));
+ }
+
+ public void setLicenceType() {
+ wait.until(ExpectedConditions.visibilityOf(licenseTypeField)).click();
+ wait.until(ExpectedConditions.visibilityOf(licenseTypeOption)).click();
+ }
+
+ public void setWeeksInOperation(String weeksInOperation) {
+ weeksInOperationField.sendKeys(weeksInOperation);
+ }
+
+ public void setDaysOfWeek(String daysOfWeek) {
+ daysOfWeekField.sendKeys(daysOfWeek);
+ wait.until(ExpectedConditions.visibilityOf(daysOfWeekOption)).click();
+ daysOfWeekField.sendKeys(Keys.ESCAPE);
+ }
+
+ public void setHoursOfOperationFrom(String hoursOfOperationFrom) {
+ wait.until(ExpectedConditions.visibilityOf(hoursOfOperationFromField)).click();
+ hoursOfOperationFromField.sendKeys(hoursOfOperationFrom);
+ }
+
+ public void setHoursOfOperationTo(String hoursOfOperationTo) {
+ wait.until(ExpectedConditions.visibilityOf(hoursOfOperationToField)).click();
+ hoursOfOperationToField.sendKeys(hoursOfOperationTo);
+ }
+
+ public void setLicenseSpaces(String licenseSpaces) {
+ licenseSpacesField.sendKeys(licenseSpaces);
+ }
+
+ public void setOperationalSpaces(String operationalSpaces) {
+ operationalSpacesField.sendKeys(operationalSpaces);
+ }
+
+ public void setEnrolledSpacesField(String enrolledSpaces) {
+ enrolledSpacesField.sendKeys(enrolledSpaces);
+ }
+
+ public void saveAndCLoseSDD() {
+ wait.until(ExpectedConditions.visibilityOf(saveAndCloseButton)).click();
+ }
+}
\ No newline at end of file
diff --git a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_Portal/PortalHomePage.java b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_Portal/PortalHomePage.java
index 58ccbc02..93a6dd41 100644
--- a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_Portal/PortalHomePage.java
+++ b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_Portal/PortalHomePage.java
@@ -3,6 +3,7 @@
import java.time.Duration;
import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
@@ -19,6 +20,58 @@ public class PortalHomePage {
@FindBy(xpath = "//*[contains(text(), '" + "Log Out" + "')]")
WebElement logout;
+
+ @FindBy(id = "login-button")
+ WebElement login;
+
+ @FindBy(xpath = "//*[@aria-label='Home']")
+ WebElement home;
+
+ @FindBy(id = "reporting-card")
+ WebElement reportTile;
+
+ @FindBy(id = "funding-card")
+ WebElement fundingTile;
+
+ @FindBy(id = "account-mgmt-card")
+ WebElement accountManagementTile;
+
+ @FindBy(id = "assistance-card")
+ WebElement assistanceRequestTile;
+
+ @FindBy(id = "cancel-new-request")
+ WebElement cancelAssistanceRequestButton;
+
+ @FindBy(id = "footer-home")
+ WebElement footerHomeButton;
+
+ @FindBy(id = "footer-about")
+ WebElement footerAboutButton;
+
+ @FindBy(id = "footer-disclaimer")
+ WebElement footerDisclaimerButton;
+
+ @FindBy(id = "footer-privacy")
+ WebElement footerPrivacyButton;
+
+ @FindBy(id = "footer-accessibility")
+ WebElement footerAccessibilityButton;
+
+ @FindBy(id = "footer-copyright")
+ WebElement footerCopyrightButton;
+
+ @FindBy(id = "footer-contact")
+ WebElement footerContactButton;
+
+ @FindBy(xpath = "//*[@aria-label='Messages/Notifications']")
+ WebElement messagesAndNotificationsButton;
+
+ @FindBy(xpath = "//*[@aria-label='User Menu']")
+ WebElement userProfile;
+
+ @FindBy(id = "impersonate_button")
+ WebElement ImpersonateButton;
+
public PortalHomePage(WebDriver driver) {
this.driver = driver;
@@ -27,19 +80,96 @@ public PortalHomePage(WebDriver driver) {
}
public void clickOnApplicationBox() {
- box_Applications.click();
+ ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", box_Applications);
+ wait.until(ExpectedConditions.elementToBeClickable(box_Applications)).click();
}
- public void clickOnUsername(String username) throws Exception {
- String usernameLowerCase = username.toLowerCase();
- String xpathExpression = "//*[translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = '" + usernameLowerCase + "']";
- wait.until(ExpectedConditions.elementToBeClickable(By.xpath(xpathExpression)));
- Thread.sleep(2000);
- driver.findElement(By.xpath(xpathExpression)).click();
+ public void clickOnUsername() {
+ wait.until(ExpectedConditions.elementToBeClickable(userProfile)).click();
}
public void logout() {
wait.until(ExpectedConditions.elementToBeClickable(logout));
logout.click();
}
+
+ public void login() {
+ wait.until(ExpectedConditions.elementToBeClickable(login)).click();
+ }
+
+ public void home() {
+ wait.until(ExpectedConditions.elementToBeClickable(home)).click();
+ }
+
+ public void clickReportTile() {
+ ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", reportTile);
+ wait.until(ExpectedConditions.elementToBeClickable(reportTile)).click();
+ }
+
+ public void clickFundingTile() {
+ ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", fundingTile);
+ wait.until(ExpectedConditions.elementToBeClickable(fundingTile)).click();
+ }
+
+ public void clickAccountManagementTile() {
+ ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", accountManagementTile);
+ wait.until(ExpectedConditions.elementToBeClickable(accountManagementTile)).click();
+ }
+
+ public void clickAssistanceRequestTile() {
+ ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", assistanceRequestTile);
+ wait.until(ExpectedConditions.elementToBeClickable(assistanceRequestTile)).click();
+ }
+
+ public void exitOutOfAssistanceRequest() {
+ ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", cancelAssistanceRequestButton);
+ wait.until(ExpectedConditions.elementToBeClickable(cancelAssistanceRequestButton)).click();
+ }
+
+ public void clickFooterHome() {
+ ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", footerHomeButton);
+ wait.until(ExpectedConditions.elementToBeClickable(footerHomeButton)).click();
+ }
+
+ public void clickFooterAbout() {
+ ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", footerAboutButton);
+ wait.until(ExpectedConditions.elementToBeClickable(footerAboutButton)).click();
+ }
+
+ public void clickFooterDisclaimer() {
+ ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", footerDisclaimerButton);
+ wait.until(ExpectedConditions.elementToBeClickable(footerDisclaimerButton)).click();
+ }
+
+ public void clickFooterPrivacy() {
+ ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", footerPrivacyButton);
+ wait.until(ExpectedConditions.elementToBeClickable(footerPrivacyButton)).click();
+ }
+
+ public void clickFooterAccessibility() {
+ ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", footerAccessibilityButton);
+ wait.until(ExpectedConditions.elementToBeClickable(footerAccessibilityButton)).click();
+ }
+
+ public void clickFooterCopyright() {
+ ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", footerCopyrightButton);
+ wait.until(ExpectedConditions.elementToBeClickable(footerCopyrightButton)).click();
+ }
+
+ public void clickFooterContact() {
+ ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", footerContactButton);
+ wait.until(ExpectedConditions.elementToBeClickable(footerContactButton)).click();
+ }
+
+ public void clickBackArrow(WebDriver driver) {
+ driver.navigate().back();
+ }
+
+ public void clickMessagesAndNotifications() {
+ wait.until(ExpectedConditions.elementToBeClickable(messagesAndNotificationsButton)).click();
+ }
+
+ public void clickImpersonate() {
+ wait.until(ExpectedConditions.elementToBeClickable(ImpersonateButton)).click();
+ }
}
diff --git a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_Portal/PortalImpersonatePage.java b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_Portal/PortalImpersonatePage.java
new file mode 100644
index 00000000..da6f91fc
--- /dev/null
+++ b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_Portal/PortalImpersonatePage.java
@@ -0,0 +1,41 @@
+package ca.bc.gov.ecc.ofm.selenium.v1.PageFactory_Portal;
+
+import java.time.Duration;
+
+import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+import org.openqa.selenium.support.PageFactory;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+public class PortalImpersonatePage {
+
+ WebDriver driver;
+ WebDriverWait wait;
+
+ @FindBy(id = "businessBCeId-field")
+ WebElement bceidField;
+
+ @FindBy(id = "bceid-search")
+ WebElement bceidSearchButton;
+
+
+
+ public PortalImpersonatePage(WebDriver driver) {
+ this.driver = driver;
+ PageFactory.initElements(driver, this);
+ wait = new WebDriverWait(driver, Duration.ofMillis(10000));
+ }
+
+ public void setImpersonateField(String bceid) {
+ bceidField.sendKeys(bceid);
+ }
+
+ public void clickSearchButton() {
+ wait.until(ExpectedConditions.elementToBeClickable(bceidSearchButton)).click();
+ }
+
+}
\ No newline at end of file
diff --git a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_Portal/PortalIrregularExpenseApplicationsDetails.java b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_Portal/PortalIrregularExpenseApplicationsDetails.java
index b5c22c51..084e1b33 100644
--- a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_Portal/PortalIrregularExpenseApplicationsDetails.java
+++ b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_Portal/PortalIrregularExpenseApplicationsDetails.java
@@ -22,6 +22,10 @@ public class PortalIrregularExpenseApplicationsDetails {
@CacheLookup
private WebElement submitNewRequestButton;
+ @FindBy(id = "selectFacility")
+ @CacheLookup
+ private WebElement selectFacilityField;
+
public PortalIrregularExpenseApplicationsDetails(WebDriver driver) {
this.driver = driver;
@@ -40,7 +44,10 @@ public void setSubjectTextField(String subjectValue) {
public void setRequestDescriptionTextField(String requestDescriptionValue) {
WebElement requestDescription = driver.findElements(By.xpath("//*[contains(@id, 'input-')]")).get(6);
requestDescription.sendKeys(requestDescriptionValue);
-
+ }
+
+ public void addFacility(String facility) {
+ selectFacilityField.sendKeys(facility);
}
public void addNewFile() {
diff --git a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_Portal/PortalMessagesAndNotificationsPage.java b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_Portal/PortalMessagesAndNotificationsPage.java
new file mode 100644
index 00000000..00ceb0dd
--- /dev/null
+++ b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_Portal/PortalMessagesAndNotificationsPage.java
@@ -0,0 +1,44 @@
+package ca.bc.gov.ecc.ofm.selenium.v1.PageFactory_Portal;
+
+import java.time.Duration;
+
+import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+import org.openqa.selenium.support.PageFactory;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+public class PortalMessagesAndNotificationsPage {
+ WebDriver driver;
+ WebDriverWait wait;
+
+ @FindBy(xpath = "//*[contains(text(), 'Action Required') or contains(text(), 'Open')]")
+ WebElement message;
+
+ @FindBy(xpath = "//*[@value='notifications']")
+ WebElement notificationsTab;
+
+ @FindBy(xpath = "//div[contains(text(), 'Read') or contains(text(), 'Unread')]")
+ WebElement notification;
+
+ public PortalMessagesAndNotificationsPage(WebDriver driver) {
+ this.driver = driver;
+ PageFactory.initElements(driver, this);
+ wait = new WebDriverWait(driver, Duration.ofMillis(10000));
+ }
+
+ public void clickOnMessage() {
+ wait.until(ExpectedConditions.elementToBeClickable(message)).click();
+ }
+
+ public void clickOnNotificationTab() {
+ wait.until(ExpectedConditions.elementToBeClickable(notificationsTab)).click();
+ }
+
+ public void clickOnNotification() {
+ wait.until(ExpectedConditions.elementToBeClickable(notification)).click();
+ }
+}
\ No newline at end of file
diff --git a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_Portal/PortalSignInFirstPage.java b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_Portal/PortalSignInFirstPage.java
index 716df1bb..271bfe83 100644
--- a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_Portal/PortalSignInFirstPage.java
+++ b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_Portal/PortalSignInFirstPage.java
@@ -16,6 +16,9 @@ public class PortalSignInFirstPage {
@FindBy(id = "bceid-login")
WebElement button_BCeIdLogin;
+
+ @FindBy(id = "idir-login")
+ WebElement IDIRLoginButton;
public PortalSignInFirstPage(WebDriver driver) {
this.driver = driver;
@@ -27,4 +30,8 @@ public void clickOnBCeIdLogin() {
wait.until(ExpectedConditions.presenceOfElementLocated(By.id("bceid-login")));
button_BCeIdLogin.click();
}
+
+ public void clickOnIDIRLogin() {
+ wait.until(ExpectedConditions.elementToBeClickable(IDIRLoginButton)).click();
+ }
}
diff --git a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/tests/BaseTest.java b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/tests/BaseTest.java
index f9fcf288..7b83f057 100644
--- a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/tests/BaseTest.java
+++ b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/tests/BaseTest.java
@@ -30,6 +30,9 @@ public class BaseTest {
protected static String PORTAL_URL;
protected static String PORTAL_USERNAME;
protected static String PORTAL_PASSWORD;
+ protected static String INTERNAL_PORTAL_URL;
+ protected static String INTERNAL_PORTAL_USERNAME;
+ protected static String INTERNAL_PORTAL_PASSWORD;
protected static String CRM_URL;
protected static String CRM_USERNAME;
protected static String CRM_PASSWORD;
@@ -48,6 +51,9 @@ public void setup() {
PORTAL_URL = properties.getProperty("portal_url");
PORTAL_USERNAME = properties.getProperty("portal_username");
PORTAL_PASSWORD = properties.getProperty("portal_password");
+ INTERNAL_PORTAL_URL = properties.getProperty("internal_portal_url");
+ INTERNAL_PORTAL_USERNAME = properties.getProperty("internal_portal_username");
+ INTERNAL_PORTAL_PASSWORD = properties.getProperty("internal_portal_password");
CRM_URL = properties.getProperty("crm_url");
CRM_USERNAME = properties.getProperty("crm_username");
CRM_PASSWORD = properties.getProperty("crm_password");
diff --git a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/tests/crm/CRMAddLicenceToFacility.java b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/tests/crm/CRMAddLicenceToFacility.java
index 2a13ad78..bcd692c5 100644
--- a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/tests/crm/CRMAddLicenceToFacility.java
+++ b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/tests/crm/CRMAddLicenceToFacility.java
@@ -22,6 +22,7 @@
import ca.bc.gov.ecc.ofm.selenium.v1.PageFactory_CRM.CRMOrganizationPage;
import ca.bc.gov.ecc.ofm.selenium.v1.PageFactory_CRM.CRMSignInCredentialPage;
import ca.bc.gov.ecc.ofm.selenium.v1.PageFactory_CRM.LicenseDetailsPage;
+import ca.bc.gov.ecc.ofm.selenium.v1.PageFactory_CRM.ServiceDeliveryDetailsPage;
import ca.bc.gov.ecc.ofm.selenium.v1.tests.BaseTest;
import io.github.bonigarcia.wdm.WebDriverManager;
@@ -74,14 +75,30 @@ public void createOrganizationFacilityContact() {
CRMFacilityPage cRMFacilityPage = new CRMFacilityPage(driver);
cRMFacilityPage.clickLicenceTab();
- cRMFacilityPage.addNewLicense();
+ // Creates license 1234
Thread.sleep(2000);
LicenseDetailsPage licenseDetailsPage = new LicenseDetailsPage(driver);
- licenseDetailsPage.setLicenseNumber("LN-1234");
- licenseDetailsPage.setStartDate();
- licenseDetailsPage.setHealthAuthority();
- licenseDetailsPage.saveLicense();
+ createNewLicense(licenseDetailsPage, cRMFacilityPage, "LN-1234");
+
+ // Creates SDD
+ Thread.sleep(2000);
+ ServiceDeliveryDetailsPage serviceDeliveryDetailsPage = new ServiceDeliveryDetailsPage(driver);
+
+ createNewSDD(serviceDeliveryDetailsPage, licenseDetailsPage, "52", "Monday", "9:00 AM", "5:00 PM", "12", "12", "12");
+ createNewSDD(serviceDeliveryDetailsPage, licenseDetailsPage, "52", "Monday", "9:00 AM", "5:00 PM", "15", "15", "15");
+
+ licenseDetailsPage.saveAndCloseLicense();
+
+ // Creates license 5678
+ Thread.sleep(2000);
+ createNewLicense(licenseDetailsPage, cRMFacilityPage, "LN-5678");
+
+ Thread.sleep(2000);
+ createNewSDD(serviceDeliveryDetailsPage, licenseDetailsPage, "52", "Monday", "9:00 AM", "5:00 PM", "21", "21", "21");
+ createNewSDD(serviceDeliveryDetailsPage, licenseDetailsPage, "52", "Monday", "9:00 AM", "5:00 PM", "18", "18", "18");
+
+ licenseDetailsPage.saveAndCloseLicense();
test.info("Licence added to facility successfully");
test.pass("Added licence to facility");
@@ -93,6 +110,34 @@ public void createOrganizationFacilityContact() {
}
}
+ public void createNewLicense(LicenseDetailsPage licenseDetailsPage, CRMFacilityPage cRMFacilityPage, String licenseNumber) {
+ try {
+ cRMFacilityPage.addNewLicense();
+ Thread.sleep(2000);
+ licenseDetailsPage.setLicenseNumber(licenseNumber);
+ licenseDetailsPage.setStartDate();
+ licenseDetailsPage.setHealthAuthority();
+ licenseDetailsPage.saveLicense();
+ }
+ catch(Exception e) {
+ System.out.println("Could not create license");
+ }
+ }
+
+ public void createNewSDD(ServiceDeliveryDetailsPage serviceDeliveryDetailsPage, LicenseDetailsPage licenseDetailsPage, String weeksInOperation, String dayOfWeek,
+ String hoursOfOperationFrom, String hoursOfOperationTo, String licenseSpaces, String operationalSpaces, String enrolledSpaces) {
+ licenseDetailsPage.addNewSDD();
+ serviceDeliveryDetailsPage.setLicenceType();
+ serviceDeliveryDetailsPage.setWeeksInOperation(weeksInOperation);
+ serviceDeliveryDetailsPage.setDaysOfWeek(dayOfWeek);
+ serviceDeliveryDetailsPage.setHoursOfOperationFrom(hoursOfOperationFrom);
+ serviceDeliveryDetailsPage.setHoursOfOperationTo(hoursOfOperationTo);
+ serviceDeliveryDetailsPage.setLicenseSpaces(licenseSpaces);
+ serviceDeliveryDetailsPage.setOperationalSpaces(operationalSpaces);
+ serviceDeliveryDetailsPage.setEnrolledSpacesField(enrolledSpaces);
+ serviceDeliveryDetailsPage.saveAndCLoseSDD();
+ }
+
@AfterTest
public void tearDown() {
diff --git a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/tests/portal/PortalCreateIrregularExpenseApplication.java b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/tests/portal/PortalCreateIrregularExpenseApplication.java
index 768f823b..bbaff44d 100644
--- a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/tests/portal/PortalCreateIrregularExpenseApplication.java
+++ b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/tests/portal/PortalCreateIrregularExpenseApplication.java
@@ -45,10 +45,12 @@ public void CreateIrregularExpenseApplication() throws InterruptedException {
PortalIrregularExpenseApplicationsHomePage portalIrregularExpenseApplicationsHomePage = new PortalIrregularExpenseApplicationsHomePage(driver);
test.info("Homepage complete");
+ Thread.sleep(5000);
portalIrregularExpenseApplicationsHomePage.addIrregularExpenseApplication();
PortalIrregularExpenseApplicationsDetails portalIrregularExpenseApplicationsDetails = new PortalIrregularExpenseApplicationsDetails(driver);
portalIrregularExpenseApplicationsDetails.setSubjectTextField("Irregular Expense Test Subject");
portalIrregularExpenseApplicationsDetails.setRequestDescriptionTextField("Irregular expense test description");
+ portalIrregularExpenseApplicationsDetails.addFacility("ofmqa_fac_automation");
portalIrregularExpenseApplicationsDetails.addNewFile();
portalIrregularExpenseApplicationsDetails.clickSubmitNewRequest();
test.info("Submit page complete");
diff --git a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/tests/scripting/ContactBCeIDScript.java b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/tests/scripting/ContactBCeIDScript.java
index ac4b197d..4a29b4c6 100644
--- a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/tests/scripting/ContactBCeIDScript.java
+++ b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/tests/scripting/ContactBCeIDScript.java
@@ -213,7 +213,7 @@ public static void loginThroughEachUser(WebDriver driver, Map da
// Log out of the portal
PortalHomePage portalHomePage = new PortalHomePage(driver);
- portalHomePage.clickOnUsername(username);
+ portalHomePage.clickOnUsername();
portalHomePage.logout();
}
diff --git a/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/tests/scripting/SmokeTestScript.java b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/tests/scripting/SmokeTestScript.java
new file mode 100644
index 00000000..e6e26eb7
--- /dev/null
+++ b/selenium-testing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/tests/scripting/SmokeTestScript.java
@@ -0,0 +1,360 @@
+package ca.bc.gov.ecc.ofm.selenium.v1.tests.scripting;
+
+import java.time.Duration;
+import org.openqa.selenium.*;
+import org.openqa.selenium.chrome.ChromeDriver;
+import org.openqa.selenium.chrome.ChromeOptions;
+import org.testng.Assert;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.List;
+import org.openqa.selenium.logging.LogEntries;
+import org.openqa.selenium.logging.LogEntry;
+import org.openqa.selenium.logging.LogType;
+import org.openqa.selenium.logging.Logs;
+import java.util.logging.Level;
+
+import ca.bc.gov.ecc.ofm.selenium.v1.PageFactory_Portal.*;
+import ca.bc.gov.ecc.ofm.selenium.v1.PageFactory_CRM.*;
+import ca.bc.gov.ecc.ofm.selenium.v1.tests.BaseTest;
+import io.github.bonigarcia.wdm.WebDriverManager;
+
+public class SmokeTestScript extends BaseTest {
+ WebDriver driver;
+
+ @BeforeTest
+ public void initDriver() {
+ ChromeOptions options = new ChromeOptions();
+ options.setCapability("goog:loggingPrefs", java.util.Collections.singletonMap("browser", Level.ALL));
+ WebDriverManager.chromedriver().setup();
+ driver = new ChromeDriver(options);
+ driver.manage().window().maximize();
+ }
+
+ @SuppressWarnings("deprecation")
+ @Test
+ public void SmokeTest() throws InterruptedException {
+
+ try {
+
+ test = extent.createTest("Test - Smoke test");
+ test.info("Starting Test - Smoke test");
+
+ driver.get(PORTAL_URL);
+
+ test.info("Test #1 - Logging into external portal - In Progress");
+
+ // Initial login
+ Thread.sleep(2000);
+ PortalSignInFirstPage objPortalSigninFirstPage = new PortalSignInFirstPage(driver);
+ objPortalSigninFirstPage.clickOnBCeIdLogin();
+
+ loginPortal(driver, PORTAL_USERNAME, PORTAL_PASSWORD);
+ logoutPortal(driver);
+ loginPortal(driver, PORTAL_USERNAME, PORTAL_PASSWORD);
+
+ test.info("Test #1 - Logging into external portal - Complete");
+
+ test.info("Test #2 - Applications, Reports, and Funding load without error - In Progress");
+
+ PortalHomePage portalHomePage = new PortalHomePage(driver);
+ Thread.sleep(2000);
+ portalHomePage.clickOnApplicationBox();
+ Thread.sleep(2000);
+ portalHomePage.home();
+ checkForConsoleErrors(driver);
+
+ Thread.sleep(2000);
+ portalHomePage.clickReportTile();
+ Thread.sleep(2000);
+ portalHomePage.home();
+ checkForConsoleErrors(driver);
+
+ Thread.sleep(2000);
+ portalHomePage.clickFundingTile();
+ Thread.sleep(2000);
+ portalHomePage.home();
+ checkForConsoleErrors(driver);
+
+ Thread.sleep(2000);
+ portalHomePage.clickAccountManagementTile();
+ Thread.sleep(2000);
+ portalHomePage.home();
+ checkForConsoleErrors(driver);
+
+ Thread.sleep(2000);
+ portalHomePage.clickAssistanceRequestTile();
+ Thread.sleep(2000);
+ portalHomePage.exitOutOfAssistanceRequest();
+ checkForConsoleErrors(driver);
+
+ test.info("Test #2 - Applications, Reports, and Funding load without error - Complete");
+
+ test.info("Test #3 - External links return status code 200 and messages load without error - In Progress");
+
+ portalHomePage.clickFooterHome();
+ checkHTTPResponse("https://www2.gov.bc.ca/gov/content/home");
+ Thread.sleep(5000);
+ portalHomePage.clickBackArrow(driver);
+
+ Thread.sleep(3000);
+ portalHomePage.clickFooterAbout();
+ checkHTTPResponse("https://www2.gov.bc.ca/gov/content/about-gov-bc-ca");
+ Thread.sleep(5000);
+ portalHomePage.clickBackArrow(driver);
+
+ Thread.sleep(3000);
+ portalHomePage.clickFooterDisclaimer();
+ checkHTTPResponse("https://www2.gov.bc.ca/gov/content/home/disclaimer");
+ Thread.sleep(5000);
+ portalHomePage.clickBackArrow(driver);
+
+ Thread.sleep(3000);
+ portalHomePage.clickFooterPrivacy();
+ checkHTTPResponse("https://www2.gov.bc.ca/gov/content/home/privacy");
+ Thread.sleep(5000);
+ portalHomePage.clickBackArrow(driver);
+
+ Thread.sleep(3000);
+ portalHomePage.clickFooterAccessibility();
+ checkHTTPResponse("https://www2.gov.bc.ca/gov/content/home/accessible-government");
+ Thread.sleep(5000);
+ portalHomePage.clickBackArrow(driver);
+
+ Thread.sleep(3000);
+ portalHomePage.clickFooterCopyright();
+ checkHTTPResponse("https://www2.gov.bc.ca/gov/content/home/copyright");
+ Thread.sleep(3000);
+ portalHomePage.clickBackArrow(driver);
+
+ Thread.sleep(5000);
+ portalHomePage.clickFooterContact();
+ checkHTTPResponse("https://www2.gov.bc.ca/gov/content/home/get-help-with-government-services");
+ Thread.sleep(5000);
+ portalHomePage.clickBackArrow(driver);
+
+
+ portalHomePage.clickMessagesAndNotifications();
+ Thread.sleep(10000);
+ PortalMessagesAndNotificationsPage portalMessagesAndNotificationsPage = new PortalMessagesAndNotificationsPage(driver);
+ portalMessagesAndNotificationsPage.clickOnMessage();
+ checkForConsoleErrors(driver);
+ Thread.sleep(5000);
+
+ portalMessagesAndNotificationsPage.clickOnNotificationTab();
+ Thread.sleep(2000);
+ portalMessagesAndNotificationsPage.clickOnNotification();
+ checkForConsoleErrors(driver);
+
+ logoutPortal(driver);
+
+ test.info("Test #3 - External links return status code 200 and messages load without error - Complete");
+
+ test.info("Test #4 - Logging into internal portal and checking status code is 200 - In Progress");
+
+ driver.get(INTERNAL_PORTAL_URL);
+ Thread.sleep(2000);
+
+ // Initial login
+ PortalSignInFirstPage objInternalPortalSigninFirstPage = new PortalSignInFirstPage(driver);
+ objInternalPortalSigninFirstPage.clickOnIDIRLogin();
+
+ loginPortal(driver, INTERNAL_PORTAL_USERNAME, INTERNAL_PORTAL_PASSWORD);
+ Thread.sleep(5000);
+ logoutPortal(driver);
+ loginPortal(driver, INTERNAL_PORTAL_USERNAME, INTERNAL_PORTAL_PASSWORD);
+ checkHTTPResponse(INTERNAL_PORTAL_URL);
+
+ test.info("Test #4 - Logging into internal portal and checking status code is 200 - Complete");
+
+ test.info("Test #5 - Using impersonate - In Progress");
+
+ portalHomePage.clickOnUsername();
+ portalHomePage.clickImpersonate();
+
+ Thread.sleep(2000);
+ PortalImpersonatePage portalImpersonatePage = new PortalImpersonatePage(driver);
+ portalImpersonatePage.setImpersonateField(PORTAL_USERNAME);
+ portalImpersonatePage.clickSearchButton();
+
+ test.info("Test #5 - Using impersonate - Complete");
+
+ test.info("Test #6 - Using impersonate, click all tiles without error - In Progress");
+
+ Thread.sleep(2000);
+ portalHomePage.clickOnApplicationBox();
+ Thread.sleep(2000);
+ portalHomePage.home();
+ checkForConsoleErrors(driver);
+
+ Thread.sleep(2000);
+ portalHomePage.clickReportTile();
+ Thread.sleep(2000);
+ portalHomePage.home();
+ checkForConsoleErrors(driver);
+
+ Thread.sleep(2000);
+ portalHomePage.clickFundingTile();
+ Thread.sleep(2000);
+ portalHomePage.home();
+ checkForConsoleErrors(driver);
+
+ Thread.sleep(2000);
+ portalHomePage.clickAccountManagementTile();
+ Thread.sleep(2000);
+ portalHomePage.home();
+ checkForConsoleErrors(driver);
+
+ test.info("Test #6 - Using impersonate, click all tiles without error - Complete");
+
+ test.info("Test #7 - Using impersonate, login to another user - In Progress");
+
+ portalHomePage.clickOnUsername();
+ portalHomePage.clickImpersonate();
+
+ Thread.sleep(3000);
+ portalImpersonatePage.setImpersonateField("ofmqa224");
+ portalImpersonatePage.clickSearchButton();
+
+ test.info("Test #7 - Using impersonate, login to another user - Complete");
+
+ test.info("Test #8 - Using impersonate, External link return status code 200 and messages load without error - In Progress");
+
+ Thread.sleep(3000);
+ portalHomePage.clickFooterHome();
+ checkHTTPResponse("https://www2.gov.bc.ca/gov/content/home");
+ Thread.sleep(5000);
+ portalHomePage.clickBackArrow(driver);
+
+ logoutPortal(driver);
+
+ test.info("Test #8 - Using impersonate, External link return status code 200 and messages load without error - Complete");
+
+ test.info("Test #9 - Log into CRM");
+
+ driver.get(CRM_URL);
+
+ loginToCRM(driver, CRM_URL, CRM_USERNAME, CRM_PASSWORD);
+
+ test.info("Test #9 - Log into CRM - Complete");
+
+ test.info("Test #10 - Navigation pain - In progress");
+
+ // Zooms out page
+ JavascriptExecutor js = (JavascriptExecutor) driver;
+ js.executeScript("document.body.style.zoom='75%'");
+
+ CRMHomePage crmHomePage = new CRMHomePage(driver);
+ crmHomePage.selectOrgFacButton();
+ Thread.sleep(2000);
+ crmHomePage.selectContacts();
+ Thread.sleep(2000);
+ crmHomePage.selectNotifications();
+ Thread.sleep(2000);
+ crmHomePage.selectProviderReports();
+ Thread.sleep(2000);
+ crmHomePage.selectApplications();
+ Thread.sleep(2000);
+ crmHomePage.selectSupplementaries();
+ Thread.sleep(2000);
+ crmHomePage.selectFundings();
+ Thread.sleep(2000);
+ crmHomePage.selectAssistanceRequests();
+
+ test.info("Test #10 - Navigation pain - Complete");
+
+ test.pass("Completed - Smoke test passed");
+ }
+ catch(Exception e) {
+ e.printStackTrace();
+ test.fail("Fail - Smoke test failed");
+ Assert.fail("Fail - Smoke test failed");
+ }
+ }
+
+ public static void loginPortal(WebDriver driver, String portalUsername, String portalPassword) throws Exception {
+
+ PortalSignInCredentialPage objPortalSignInCredentialPage = new PortalSignInCredentialPage(driver);
+ Thread.sleep(2000);
+ objPortalSignInCredentialPage.enterUserId(portalUsername);
+ objPortalSignInCredentialPage.enterPassword(portalPassword);
+ objPortalSignInCredentialPage.clickSubmit();
+ objPortalSignInCredentialPage.clickSignatureRequired();
+ }
+
+ public static void logoutPortal(WebDriver driver) throws Exception {
+
+ PortalHomePage portalHomePage = new PortalHomePage(driver);
+ portalHomePage.clickOnUsername();
+ portalHomePage.logout();
+ portalHomePage.login();
+ }
+
+ public static void checkForConsoleErrors(WebDriver driver) throws Exception {
+
+ LogEntries logs = driver.manage().logs().get(LogType.BROWSER);
+ List filteredErrors = Arrays.asList("Unauthorized", "and strict MIME checking is enabled"); // Errors on portal load up that will be filtered out
+ boolean consoleError = false;
+
+ for (LogEntry log : logs) {
+ if (log.getLevel().getName().equals("SEVERE")) {
+ if (filteredErrors.stream().anyMatch(log.toString()::contains)) {
+ continue;
+ }
+ System.out.println("Console error: " + log.getMessage());
+ consoleError = true;
+ }
+ }
+
+ if (consoleError) {
+ throw new Exception("There is one or more console errors");
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ public static void checkHTTPResponse(String url) throws IOException {
+
+ HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
+
+ try {
+ connection.setRequestMethod("GET");
+ int statusCode = connection.getResponseCode();
+
+ // Checks for if the response code is 200 (OK)
+ Assert.assertEquals(statusCode, 200, "Expected response code is not 200");
+ }
+ finally {
+ connection.disconnect();
+ }
+ }
+
+ public static void loginToCRM(WebDriver driver, String crmURL, String crmUsername, String crmPassword) throws Exception {
+
+ driver.get(crmURL);
+
+ Thread.sleep(2000);
+ CRMSignInCredentialPage objCRMSignInCredentialPage = new CRMSignInCredentialPage(driver);
+ objCRMSignInCredentialPage.enterUserId(crmUsername);
+ objCRMSignInCredentialPage.clickNext();
+ Thread.sleep(1000);
+ objCRMSignInCredentialPage.enterPassword(crmPassword);
+ Thread.sleep(1000);
+ objCRMSignInCredentialPage.clickSignIn();
+ Thread.sleep(1000);
+ objCRMSignInCredentialPage.clickYes();
+ objCRMSignInCredentialPage.clickSignInAgain();
+ Thread.sleep(5000);
+ }
+
+ public static void logoutCRM(WebDriver driver) {
+
+ CRMHomePage crmHomePage = new CRMHomePage(driver);
+ crmHomePage.selectProfile();
+ crmHomePage.clickSignOut();
+ }
+}
\ No newline at end of file