diff --git a/src/test/java/ServiceNow/PlatformBusinessApps/OFFBOARD/Constants/CBIIT_OFFBOARD_FORM_Constants.java b/src/test/java/ServiceNow/PlatformBusinessApps/OFFBOARD/Constants/CBIIT_OFFBOARD_FORM_Constants.java index d25931caa..cf815a7e3 100644 --- a/src/test/java/ServiceNow/PlatformBusinessApps/OFFBOARD/Constants/CBIIT_OFFBOARD_FORM_Constants.java +++ b/src/test/java/ServiceNow/PlatformBusinessApps/OFFBOARD/Constants/CBIIT_OFFBOARD_FORM_Constants.java @@ -90,5 +90,23 @@ public class CBIIT_OFFBOARD_FORM_Constants { public static String CBIIT_OFFBOARD_FORM_SUBMIT_BUTTON = "Submit"; /* CBIIT 'HARDWARE RETURN TICKET NUMBER' TEXT BOX VALUE */ - public static String cbiit_Hardware_Return_Ticket_NumberTextBoxValue = "NCI-RITM0139815"; + public static String CBIIT_HARDWARE_RETURN_TICKET_NUMBERTEXTBOXVALUE = "NCI-RITM0139815"; + + /* CBIIT "DATE OF TRANSFER" TEXT */ + public static String CBIIT_OFFBOARDING_DATE_OF_TRANSFER_TEXT = "Date of Transfer"; + + /* CBIIT "HN/SAC CODE (TRANSFER TO)" TEXT */ + public static String CBIIT_HN_SAC_CODE_TRANSFER_TO_TEXT = "HN/SAC Code (Transfer to)"; + + /* CBIIT "HN/SAC CODE (TRANSFER TO)" TEXT BOX VALUE */ + public static String CBIIT_HN_SAC_CODE_TRANSFER_TO_TEXT_BOX_Value = "Test Free Text field &^$%6"; + + /* CBIIT "ONSITE LOCATION" TEXT */ + public static String CBIIT_ONSITE_LOCATION_TEXT = "Onsite Location"; + + /* CBIIT 'ONSITE LOCATION' SELECTED DROP DOWN VALUE */ + public static String CBIIT_ONSITE_LOCATION_SELECTED_DROP_DOWN_VALUE = "Pennsylvania"; + + /* CBIIT "RETURN HARDWARE FORM URL" TEXT */ + public static String CBIIT_RETURN_HARDWARE_FORM_URL_TEXT = "Return Hardware Form URL"; } \ No newline at end of file diff --git a/src/test/java/ServiceNow/PlatformBusinessApps/OFFBOARD/Features/CBIIT OffBoarding Form.feature b/src/test/java/ServiceNow/PlatformBusinessApps/OFFBOARD/Features/CBIIT OffBoarding Form.feature index e86fce0d6..2179c4e77 100644 --- a/src/test/java/ServiceNow/PlatformBusinessApps/OFFBOARD/Features/CBIIT OffBoarding Form.feature +++ b/src/test/java/ServiceNow/PlatformBusinessApps/OFFBOARD/Features/CBIIT OffBoarding Form.feature @@ -11,12 +11,23 @@ Feature: CBIIT Off-boarding form Scenarios """ @OFFBOARD-35 @chaudhryma @Regression @playwright - Scenario: Test Reorganize Catalog Item Form Fields + Scenario: Test 1: Reorganize Catalog Item Form Fields Given I am an Offboarding requester When I open the Offboarding request form - Then I should see "Departure or Transfer Request" field + Then I should see "Departure or Transfer Request" field to put in a "Departure" Request for an employee And If user selects “NO” for the “Is the employee located On Site?” field, then show the “FedEx Label Needed” field. And the “FedEx Label Needed” field should be under “Employee Address” field. And If user selects “Yes” for the “FedEx Label Needed” field, then show the “Are Boxes Needed for Items to be returned?” field. + And the “Are Boxes Needed for Items to be returned?” field should be under “FedEx Label Needed” field. + And If user selects “No”, for the “Are Boxes Needed for Items to be returned?” field, then “Number of Boxes Needed?” field does not display And If user selects “Yes”, for the “Are Boxes Needed for Items to be returned?” field, then show “Number of Boxes Needed?” field - And If user selects “Yes”, for the “ Hardware Return Ticket Already Created” field , then just show “Hardware Return Ticket Number” field. \ No newline at end of file + And If user selects “Yes”, for the “ Hardware Return Ticket Already Created” field , then just show “Hardware Return Ticket Number” field. + + @OFFBOARD-35 @chaudhryma @Regression @playwright + Scenario: Test 2: Reorganize Catalog Item Form Fields + Given I am an Offboarding requester + When I open the Offboarding request form + Then I should see "Departure or Transfer Request" field to put in a "Transfer" Request + And If user select “Yes” for the answer to “Is the employee located On Site?” field, show “Onsite Location” field. + And If user selects “No”, for the “ Hardware Return Ticket Already Created” field , then show both the “Return Hardware Request” link and “Hardware Return Ticket Number” field. + And verify that the Hardware Request link URL should be "https://service-test.nci.nih.gov/ncisp?id=nci_sc_cat_item&sys_id=3fc39c056ff56e00e04fd15eae3ee46c" \ No newline at end of file diff --git a/src/test/java/ServiceNow/PlatformBusinessApps/OFFBOARD/Pages/OFFBOARD_Page.java b/src/test/java/ServiceNow/PlatformBusinessApps/OFFBOARD/Pages/OFFBOARD_Page.java index c39380e90..ff2b2bbc8 100644 --- a/src/test/java/ServiceNow/PlatformBusinessApps/OFFBOARD/Pages/OFFBOARD_Page.java +++ b/src/test/java/ServiceNow/PlatformBusinessApps/OFFBOARD/Pages/OFFBOARD_Page.java @@ -65,6 +65,9 @@ public class OFFBOARD_Page { /* CBIIT 'FEDEX LABEL NEEDED' TEXT BOX FIELD LOCATOR */ public static String cbiit_FedexLabelNeededTextBoxFieldLocator = "#s2id_sp_formfield_fedex_label a"; + /* CBIIT 'HARDWARE RETURN TICKET ALREADY CREATED' TEXT BOX FIELD LOCATOR */ + public static String cbiit_Hardware_Return_Ticket_Already_CreatedTextBoxFieldLocator = "#s2id_sp_formfield_already_created a"; + /* CBIIT 'ARE BOXES NEEDED FOR ITEMS TO BE RETURNED' FIELD LOCATOR */ public static String cbiit_AreBoxesNeededForItemsToBeReturnedFieldLocator = "#boxes_needed"; @@ -74,9 +77,33 @@ public class OFFBOARD_Page { /* CBIIT 'NUMBER OF BOXES NEEDED?' TEXT BOX FIELD LOCATOR */ public static String cbiit_NumberOfBoxesNeededTextBoxFieldLocator = "#s2id_sp_formfield_boxes_needed a"; + /* CBIIT 'RETURN HARDWARE FORM URL' FIELD LOCATOR */ + public static String cbiit_Return_Hardware_Form_URL_FieldLocator = "#hardware_url"; + /* CBIIT 'HARDWARE RETURN TICKET NUMBER' FIELD LOCATOR */ public static String cbiit_Hardware_Return_Ticket_NumberFieldLocator = "#hardware_ticket_number"; /* CBIIT 'HARDWARE RETURN TICKET NUMBER' TEXT BOX FIELD LOCATOR */ public static String cbiit_Hardware_Return_Ticket_NumberTextBoxFieldLocator = "#s2id_autogen10"; + + /* CBIIT 'REQUEST DETAILS' LABEL */ + public static String cbiit_RequestDetails = "Request Details"; + + /* CBIIT 'DATE OF TRANSFER' FIELD LOCATOR */ + public static String cbiit_DateOfTransferFieldLocator = "#transfer_date"; + + /* CBIIT 'SHOW CALENDAR FOR DATE OF TRANSFER' FIELD LOCATOR */ + public static String cbiit_ShowCalendarForDateOfTransferFieldLocator = "Show Calendar for Date of Transfer"; + + /* CBIIT 'DATE PICKER IS OPENED' FIELD LOCATOR */ + public static String cbiit_DatePickerIsOpenedFieldLocator = "Date picker is opened"; + + /* CBIIT 'HN/SAC CODE (TRANSFER TO)' FIELD LOCATOR */ + public static String cbiit_HnSacTransferToFieldLocator = "#hnc_sac_code"; + + /* CBIIT 'ONSITE LOCATION' FIELD LOCATOR */ + public static String cbiit_OnlineLocationFieldLocator = "#s2id_autogen8-label"; + + /* CBIIT 'ONSITE LOCATION' FIELD DROP DOWN LOCATOR */ + public static String cbiit_OnlineLocationFieldDropDownLocator = "#s2id_sp_formfield_location a"; } \ No newline at end of file diff --git a/src/test/java/ServiceNow/PlatformBusinessApps/OFFBOARD/Steps/CBIIT_OFFBOARD_Form_Steps.java b/src/test/java/ServiceNow/PlatformBusinessApps/OFFBOARD/Steps/CBIIT_OFFBOARD_Form_Steps.java index e32fee820..a3450600e 100644 --- a/src/test/java/ServiceNow/PlatformBusinessApps/OFFBOARD/Steps/CBIIT_OFFBOARD_Form_Steps.java +++ b/src/test/java/ServiceNow/PlatformBusinessApps/OFFBOARD/Steps/CBIIT_OFFBOARD_Form_Steps.java @@ -36,9 +36,9 @@ public void i_open_the_offboarding_request_form() { OFFBOARD_StepsImpl.i_open_the_offboarding_request_form(); } - @Then("I should see {string} field") - public void i_should_see_field(String departureOrTransferField) { - OFFBOARD_StepsImpl.i_should_see_field(departureOrTransferField); + @Then("I should see {string} field to put in a {string} Request for an employee") + public void i_should_see_field_to_put_in_a_request_for_an_employee(String departureOrTransferField, String departure) { + OFFBOARD_StepsImpl.i_should_see_field_to_put_in_a_request_for_an_employee(departureOrTransferField, departure); } @Then("If user selects “NO” for the “Is the employee located On Site?” field, then show the “FedEx Label Needed” field.") @@ -47,7 +47,7 @@ public void if_user_selects_no_for_the_isTheEmployeeLocatedOnSiteField_then_show } @Then("the “FedEx Label Needed” field should be under “Employee Address” field.") - public void the_fedexLabelNeeded_field_should_be_under_employee_address_field() throws Exception{ + public void the_fedexLabelNeeded_field_should_be_under_employee_address_field() { OFFBOARD_StepsImpl.the_fedexLabelNeeded_field_should_be_under_employeeAddress_field(); } @@ -56,6 +56,16 @@ public void if_user_selects_yes_for_the_fedexLabelNeeded_field_then_show_the_are OFFBOARD_StepsImpl.if_user_selects_yes_for_the_fedexLabelNeeded_field_then_show_the_areBoxesNeededForItemsToBeReturned_field(); } + @Then("the “Are Boxes Needed for Items to be returned?” field should be under “FedEx Label Needed” field.") + public void the_areBoxesNeededForItemsToBeReturned_field_should_be_under_fedexLabelNeeded(){ + OFFBOARD_StepsImpl.the_areBoxesNeededForItemsToBeReturned_field_should_be_under_fedexLabelNeeded(); + } + + @Then("If user selects “No”, for the “Are Boxes Needed for Items to be returned?” field, then “Number of Boxes Needed?” field does not display") + public void if_user_selects_no_for_the_areBoxesNeededForItemsToBeReturned_field_then_numberOfBoxesNeeded_field_does_not_display() { + OFFBOARD_StepsImpl.if_user_selects_no_for_the_areBoxesNeededForItemsToBeReturned_field_then_numberOfBoxesNeeded_field_does_not_display(); + } + @Then("If user selects “Yes”, for the “Are Boxes Needed for Items to be returned?” field, then show “Number of Boxes Needed?” field") public void if_user_selects_yes_for_the_areBoxesNeededForItemsToBeReturned_field_then_show_numberOfBoxesNeeded_field() { OFFBOARD_StepsImpl.if_user_selects_yes_for_the_areBoxesNeededForItemsToBeReturned_field_then_show_numberOfBoxesNeeded_field(); @@ -65,4 +75,24 @@ public void if_user_selects_yes_for_the_areBoxesNeededForItemsToBeReturned_field public void if_user_selects_yes_for_the_hardwareReturnTicketAlreadyCreated_field_then_just_show_hardwareReturnTicketNumber_field() { OFFBOARD_StepsImpl.if_user_selects_yes_for_the_hardwareReturnTicketAlreadyCreated_field_then_just_show_hardwareReturnTicketNumber_field(); } + + @Then("I should see {string} field to put in a {string} Request") + public void i_should_see_field_to_put_in_a_request(String departureOrTransferField, String transfer) { + OFFBOARD_StepsImpl.i_should_see_field_to_put_in_a_request(departureOrTransferField, transfer); + } + + @Then("If user select “Yes” for the answer to “Is the employee located On Site?” field, show “Onsite Location” field.") + public void if_user_select_yes_for_the_answer_to_isTheEmployeeLocatedOnSite_field_show_onsiteLocation_field() { + OFFBOARD_StepsImpl.if_user_select_yes_for_the_answer_to_isTheEmployeeLocatedOnSite_field_show_onsiteLocation_field(); + } + + @Then("If user selects “No”, for the “ Hardware Return Ticket Already Created” field , then show both the “Return Hardware Request” link and “Hardware Return Ticket Number” field.") + public void if_user_selects_no_for_the_hardwareReturnTicketAlreadyCreated_field_then_show_both_the_returnHardwareRequest_link_and_hardwareReturnTicketNumber_field() { + OFFBOARD_StepsImpl.if_user_selects_no_for_the_hardwareReturnTicketAlreadyCreated_field_then_show_both_the_returnHardwareRequest_link_and_hardwareReturnTicketNumber_field(); + } + + @Then("verify that the Hardware Request link URL should be {string}") + public void verify_that_the_hardware_request_link_url_should_be(String expectedURL) { + OFFBOARD_StepsImpl.verify_that_the_hardware_request_link_url_should_be(expectedURL); + } } \ No newline at end of file diff --git a/src/test/java/ServiceNow/PlatformBusinessApps/OFFBOARD/StepsImplementation/OFFBOARD_StepsImpl.java b/src/test/java/ServiceNow/PlatformBusinessApps/OFFBOARD/StepsImplementation/OFFBOARD_StepsImpl.java index d0a0e0fbf..3fa99bccf 100644 --- a/src/test/java/ServiceNow/PlatformBusinessApps/OFFBOARD/StepsImplementation/OFFBOARD_StepsImpl.java +++ b/src/test/java/ServiceNow/PlatformBusinessApps/OFFBOARD/StepsImplementation/OFFBOARD_StepsImpl.java @@ -16,6 +16,8 @@ import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat; public class OFFBOARD_StepsImpl { + public static Page returnHardwarePage; + public static String returnHardwarePageUrl; /** * THIS METHOD NAVIGATES TO CBIIT OFFBOARDING PORTAL PAGE @@ -63,13 +65,14 @@ public static void i_open_the_offboarding_request_form() { * Verifies that the specified departure or transfer field is visible on the page. * * @param departureOrTransferField the text of the departure or transfer field + * @param departure the departure value */ - public static void i_should_see_field(String departureOrTransferField) { + public static void i_should_see_field_to_put_in_a_request_for_an_employee(String departureOrTransferField, String departure) { PlaywrightUtils.page.waitForSelector(OFFBOARD_Page.cbiit_OffBoardingRequestFormDepartureOrTransferFieldTextLocator); assertThat(PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_OffBoardingRequestFormDepartureOrTransferFieldTextLocator)).containsText(departureOrTransferField); CucumberLogUtils.playwrightScreenshot(PlaywrightUtils.page); PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_OffBoardingDepartureOrTransferRequestDropDownLocator).click(); - PlaywrightUtils.page.getByRole(AriaRole.OPTION, new Page.GetByRoleOptions().setName(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARD_DEPARTURE_OPTION_SELECTED)).click(); + PlaywrightUtils.page.getByRole(AriaRole.OPTION, new Page.GetByRoleOptions().setName(departure)).click(); assertThat(PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_OffBoardingBeforeFivePMLocator)).containsText(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARDING_BEFORE_FIVE_PM_TEXT); PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_OffBoardingBeforeFivePMDropDownLocator).click(); PlaywrightUtils.page.getByRole(AriaRole.OPTION, new Page.GetByRoleOptions().setName(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARD_FORM_YES_OPTION_SELECTED)).click(); @@ -109,14 +112,19 @@ public static void if_user_selects_no_for_the_isTheEmployeeLocatedOnSiteField_th * * @throws Exception if the bounding box cannot be retrieved for one or both fields */ - public static void the_fedexLabelNeeded_field_should_be_under_employeeAddress_field() throws Exception { - BoundingBox fedexLabelNeededFieldBounds = PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_FedexLabelNeededFieldLocator).boundingBox(); - BoundingBox employeeAddressFieldBounds = PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_EmployeeAddressFieldLocator).boundingBox(); - if (fedexLabelNeededFieldBounds == null || employeeAddressFieldBounds == null) { - throw new Exception("Could not retrieve bounding box for one or both fields."); + public static void the_fedexLabelNeeded_field_should_be_under_employeeAddress_field() { + try { + BoundingBox fedexLabelNeededFieldBounds = PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_FedexLabelNeededFieldLocator).boundingBox(); + BoundingBox employeeAddressFieldBounds = PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_EmployeeAddressFieldLocator).boundingBox(); + if (fedexLabelNeededFieldBounds == null || employeeAddressFieldBounds == null) { + throw new Exception("Could not find the element location for one or both fields on the page"); + } + Assert.assertTrue(fedexLabelNeededFieldBounds.y > employeeAddressFieldBounds.y, "The “FedEx Label Needed” field is under “Employee Address” field"); + CucumberLogUtils.playwrightScreenshot(PlaywrightUtils.page); + } catch ( + Exception e) { + e.printStackTrace(); } - Assert.assertTrue(fedexLabelNeededFieldBounds.y > employeeAddressFieldBounds.y, "The “FedEx Label Needed” field is under “Employee Address” field"); - CucumberLogUtils.playwrightScreenshot(PlaywrightUtils.page); } /** @@ -137,14 +145,43 @@ public static void if_user_selects_yes_for_the_fedexLabelNeeded_field_then_show_ } /** - * If the user selects "Yes" for the "Are Boxes Needed for Items to be returned" field, - * then show the "Number of Boxes Needed" field. - * This method interacts with the page and verifies certain conditions. + * Checks if the "Are Boxes Needed for Items to be returned?" field is positioned under the "FedEx Label Needed" field. + * + * @throws Exception if the bounding box cannot be retrieved for one or both fields */ - public static void if_user_selects_yes_for_the_areBoxesNeededForItemsToBeReturned_field_then_show_numberOfBoxesNeeded_field() { + public static void the_areBoxesNeededForItemsToBeReturned_field_should_be_under_fedexLabelNeeded() { + try { + BoundingBox areBoxesNeededForItemsToBeReturnedFieldBounds = PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_AreBoxesNeededForItemsToBeReturnedFieldLocator).boundingBox(); + BoundingBox fedexLabelNeededFieldBounds = PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_FedexLabelNeededFieldLocator).boundingBox(); + if (areBoxesNeededForItemsToBeReturnedFieldBounds == null || fedexLabelNeededFieldBounds == null) { + throw new Exception("Could not find the element location for one or both fields on the page"); + } + Assert.assertTrue(areBoxesNeededForItemsToBeReturnedFieldBounds.y > fedexLabelNeededFieldBounds.y, "The “Are Boxes Needed for Items to be returned?” field is under “FedEx Label Needed” field"); + CucumberLogUtils.playwrightScreenshot(PlaywrightUtils.page); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * This method checks if the user selects "No" for the "areBoxesNeededForItemsToBeReturned" field, + * then the "numberOfBoxesNeeded" field should not be displayed. + */ + public static void if_user_selects_no_for_the_areBoxesNeededForItemsToBeReturned_field_then_numberOfBoxesNeeded_field_does_not_display() { PlaywrightUtils.page.waitForSelector(OFFBOARD_Page.cbiit_AreBoxesNeededForItemsToBeReturnedFieldLocator); assertThat(PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_AreBoxesNeededForItemsToBeReturnedFieldLocator)).containsText(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARDING_ARE_BOXES_NEEDED_FOR_ITEMS_TO_BE_RETURNED_TEXT); assertThat(PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_NumberOfBoxesNeededFieldLocator).getByText(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARDING_NUMBER_OF_BOXES_NEEDED_TEXT)).isHidden(); + PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_NumberOfBoxesNeededTextBoxFieldLocator).click(); + PlaywrightUtils.page.getByRole(AriaRole.OPTION, new Page.GetByRoleOptions().setName(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARD_FORM_NO_OPTION_SELECTED).setExact(true)).click(); + assertThat(PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_NumberOfBoxesNeededFieldLocator).getByText(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARDING_NUMBER_OF_BOXES_NEEDED_TEXT)).isHidden(); + CucumberLogUtils.playwrightScreenshot(PlaywrightUtils.page); + } + + /** + * If the user selects "Yes" for the "Are Boxes Needed for Items to be returned" field, + * then show the "Number of Boxes Needed" field. + */ + public static void if_user_selects_yes_for_the_areBoxesNeededForItemsToBeReturned_field_then_show_numberOfBoxesNeeded_field() { PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_NumberOfBoxesNeededTextBoxFieldLocator).click(); PlaywrightUtils.page.getByRole(AriaRole.OPTION, new Page.GetByRoleOptions().setName(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARD_FORM_YES_OPTION_SELECTED)).click(); assertThat(PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_NumberOfBoxesNeededFieldLocator).getByText(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARDING_NUMBER_OF_BOXES_NEEDED_TEXT)).isVisible(); @@ -157,7 +194,6 @@ public static void if_user_selects_yes_for_the_areBoxesNeededForItemsToBeReturne /** * If the user selects "Yes" for the "Hardware Return Ticket Already Created" field, * then just show the "Hardware Return Ticket Number" field. - * This method interacts with the page and verifies certain conditions. */ public static void if_user_selects_yes_for_the_hardwareReturnTicketAlreadyCreated_field_then_just_show_hardwareReturnTicketNumber_field() { assertThat(PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_SpanLocator).filter(new Locator.FilterOptions().setHasText(Pattern.compile(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARDING_HARDWARE_RETURN_TICKET_ALREADY_CREATED_FIELD_TEXT)))).isVisible(); @@ -169,7 +205,97 @@ public static void if_user_selects_yes_for_the_hardwareReturnTicketAlreadyCreate assertThat(PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_Hardware_Return_Ticket_NumberFieldLocator).getByText(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARDING_HARDWARE_RETURN_TICKET_NUMBER_TEXT)).isVisible(); CucumberLogUtils.playwrightScreenshot(PlaywrightUtils.page); PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_Hardware_Return_Ticket_NumberTextBoxFieldLocator).click(); - PlaywrightUtils.page.getByText(CBIIT_OFFBOARD_FORM_Constants.cbiit_Hardware_Return_Ticket_NumberTextBoxValue).click(); + PlaywrightUtils.page.getByText(CBIIT_OFFBOARD_FORM_Constants.CBIIT_HARDWARE_RETURN_TICKET_NUMBERTEXTBOXVALUE).click(); + assertThat(PlaywrightUtils.page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARD_FORM_SUBMIT_BUTTON))).isVisible(); + PlaywrightUtils.page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARD_FORM_SUBMIT_BUTTON)).click(); + assertThat(PlaywrightUtils.page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName(CBIIT_OFFBOARD_FORM_Constants.CBIIT_SERVICESLINK).setExact(true))).isVisible(); + CucumberLogUtils.playwrightScreenshot(PlaywrightUtils.page); + } + + /** + * Verifies that the specified departure or transfer field is visible on the page and performs certain interactions with the page. + * + * @param departureOrTransferField the text of the departure or transfer field + * @param transfer the transfer value + */ + public static void i_should_see_field_to_put_in_a_request(String departureOrTransferField, String transfer) { + PlaywrightUtils.page.waitForSelector(OFFBOARD_Page.cbiit_OffBoardingRequestFormDepartureOrTransferFieldTextLocator); + assertThat(PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_OffBoardingRequestFormDepartureOrTransferFieldTextLocator)).containsText(departureOrTransferField); + CucumberLogUtils.playwrightScreenshot(PlaywrightUtils.page); + PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_OffBoardingDepartureOrTransferRequestDropDownLocator).click(); + PlaywrightUtils.page.getByRole(AriaRole.OPTION, new Page.GetByRoleOptions().setName(transfer)).click(); + assertThat(PlaywrightUtils.page.getByLabel(OFFBOARD_Page.cbiit_RequestDetails).getByText(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARDING_DATE_OF_TRANSFER_TEXT)).isVisible(); + assertThat(PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_DateOfTransferFieldLocator)).containsText(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARDING_DATE_OF_TRANSFER_TEXT); + PlaywrightUtils.page.getByLabel(OFFBOARD_Page.cbiit_ShowCalendarForDateOfTransferFieldLocator).click(); + PlaywrightUtils.page.getByLabel(OFFBOARD_Page.cbiit_DatePickerIsOpenedFieldLocator).click(); + PlaywrightUtils.page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARD_FORM_OK_OPTION_SELECTED)).click(); + assertThat(PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_HnSacTransferToFieldLocator)).containsText(CBIIT_OFFBOARD_FORM_Constants.CBIIT_HN_SAC_CODE_TRANSFER_TO_TEXT); + PlaywrightUtils.page.getByLabel(CBIIT_OFFBOARD_FORM_Constants.CBIIT_HN_SAC_CODE_TRANSFER_TO_TEXT).click(); + PlaywrightUtils.page.getByLabel(CBIIT_OFFBOARD_FORM_Constants.CBIIT_HN_SAC_CODE_TRANSFER_TO_TEXT).fill(CBIIT_OFFBOARD_FORM_Constants.CBIIT_HN_SAC_CODE_TRANSFER_TO_TEXT_BOX_Value); + PlaywrightUtils.page.getByLabel(CBIIT_OFFBOARD_FORM_Constants.CBIIT_HN_SAC_CODE_TRANSFER_TO_TEXT).press(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARD_FORM_ENTER_KEY); + PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_OffBoardingFormPointOfContactSearchTextBoxLocator).click(); + PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_OffBoardingFormPointOfContactSearchLocator).fill(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARD_POINT_OF_CONTACT_NAME); + PlaywrightUtils.page.getByText(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARD_POINT_OF_CONTACT_NAME).click(); + CucumberLogUtils.playwrightScreenshot(PlaywrightUtils.page); + } + + /** + * If the user selects "Yes" for the answer to the "isTheEmployeeLocatedOnSite" field, + * this method shows the "onsiteLocation" field and performs certain interactions with the page. + */ + public static void if_user_select_yes_for_the_answer_to_isTheEmployeeLocatedOnSite_field_show_onsiteLocation_field() { + PlaywrightUtils.page.waitForSelector(OFFBOARD_Page.cbiit_OffBoardingFormIsTheEmployeeLocatedOnSiteLocator); + assertThat(PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_EmployeeAddressFieldLocator).getByText(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARDING_EMPLOYEE_ADDRESS_FIELD_TEXT)).isHidden(); + assertThat(PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_OnlineLocationFieldLocator).getByLabel(CBIIT_OFFBOARD_FORM_Constants.CBIIT_ONSITE_LOCATION_TEXT)).isHidden(); + CucumberLogUtils.playwrightScreenshot(PlaywrightUtils.page); + PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_OffBoardingFormIsTheEmployeeLocatedOnSiteDropDownLocator).click(); + PlaywrightUtils.page.getByRole(AriaRole.OPTION, new Page.GetByRoleOptions().setName(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARD_FORM_YES_OPTION_SELECTED).setExact(true)).click(); + assertThat(PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_OnlineLocationFieldLocator).getByLabel(CBIIT_OFFBOARD_FORM_Constants.CBIIT_ONSITE_LOCATION_TEXT)).isVisible(); + assertThat(PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_OnlineLocationFieldLocator)).containsText(CBIIT_OFFBOARD_FORM_Constants.CBIIT_ONSITE_LOCATION_TEXT); + PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_OnlineLocationFieldDropDownLocator).click(); + PlaywrightUtils.page.getByRole(AriaRole.OPTION, new Page.GetByRoleOptions().setName(CBIIT_OFFBOARD_FORM_Constants.CBIIT_ONSITE_LOCATION_SELECTED_DROP_DOWN_VALUE)).click(); + CucumberLogUtils.playwrightScreenshot(PlaywrightUtils.page); + } + + /** + * if the user selects "No" for the "hardware Return Ticket Already Created" field. + * then shows both the "return Hardware Request" link and "hardware Return Ticket Number(s)" field + */ + public static void if_user_selects_no_for_the_hardwareReturnTicketAlreadyCreated_field_then_show_both_the_returnHardwareRequest_link_and_hardwareReturnTicketNumber_field() { + assertThat(PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_SpanLocator).filter(new Locator.FilterOptions().setHasText(Pattern.compile(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARDING_HARDWARE_RETURN_TICKET_ALREADY_CREATED_FIELD_TEXT)))).isVisible(); + assertThat(PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_Hardware_Return_Ticket_NumberFieldLocator).getByText(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARDING_HARDWARE_RETURN_TICKET_NUMBER_TEXT)).isHidden(); + assertThat(PlaywrightUtils.page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName(CBIIT_OFFBOARD_FORM_Constants.CBIIT_RETURN_HARDWARE_FORM_URL_TEXT))).isHidden(); + CucumberLogUtils.playwrightScreenshot(PlaywrightUtils.page); + PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_Hardware_Return_Ticket_Already_CreatedTextBoxFieldLocator).click(); + PlaywrightUtils.page.getByRole(AriaRole.OPTION, new Page.GetByRoleOptions().setName(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARD_FORM_NO_OPTION_SELECTED).setExact(true)).click(); + assertThat(PlaywrightUtils.page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName(CBIIT_OFFBOARD_FORM_Constants.CBIIT_RETURN_HARDWARE_FORM_URL_TEXT))).isVisible(); + assertThat(PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_Return_Hardware_Form_URL_FieldLocator)).containsText(CBIIT_OFFBOARD_FORM_Constants.CBIIT_RETURN_HARDWARE_FORM_URL_TEXT); + CucumberLogUtils.playwrightScreenshot(PlaywrightUtils.page); + PlaywrightUtils.page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName(CBIIT_OFFBOARD_FORM_Constants.CBIIT_RETURN_HARDWARE_FORM_URL_TEXT)).scrollIntoViewIfNeeded(); + assertThat(PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_Hardware_Return_Ticket_NumberFieldLocator).getByText(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARDING_HARDWARE_RETURN_TICKET_NUMBER_TEXT)).isVisible(); + assertThat(PlaywrightUtils.page.getByText(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARDING_HARDWARE_RETURN_TICKET_NUMBER_TEXT)).isVisible(); + assertThat(PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_Hardware_Return_Ticket_NumberFieldLocator)).containsText(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARDING_HARDWARE_RETURN_TICKET_NUMBER_TEXT); + assertThat(PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_Hardware_Return_Ticket_NumberTextBoxFieldLocator)).isVisible(); + } + + /** + * Verifies that the URL of the "Return Hardware Request" link is as expected. + * + * @param expectedURL the expected URL of the "Return Hardware Request" link + */ + public static void verify_that_the_hardware_request_link_url_should_be(String expectedURL) { + returnHardwarePage = PlaywrightUtils.page.waitForPopup(() -> { + PlaywrightUtils.page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName(CBIIT_OFFBOARD_FORM_Constants.CBIIT_RETURN_HARDWARE_FORM_URL_TEXT)).click(); + }); + CucumberLogUtils.playwrightScreenshot(returnHardwarePage); + returnHardwarePageUrl = returnHardwarePage.url(); + Assert.assertEquals(returnHardwarePageUrl,expectedURL,"Verifies that the URL of the 'Return Hardware Request' link is as expected."); + returnHardwarePage.close(); + CucumberLogUtils.playwrightScreenshot(PlaywrightUtils.page); + PlaywrightUtils.page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName(CBIIT_OFFBOARD_FORM_Constants.CBIIT_RETURN_HARDWARE_FORM_URL_TEXT)).scrollIntoViewIfNeeded(); + PlaywrightUtils.page.waitForSelector(OFFBOARD_Page.cbiit_Hardware_Return_Ticket_NumberTextBoxFieldLocator); + PlaywrightUtils.page.locator(OFFBOARD_Page.cbiit_Hardware_Return_Ticket_NumberTextBoxFieldLocator).click(); + PlaywrightUtils.page.getByText(CBIIT_OFFBOARD_FORM_Constants.CBIIT_HARDWARE_RETURN_TICKET_NUMBERTEXTBOXVALUE).click(); assertThat(PlaywrightUtils.page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARD_FORM_SUBMIT_BUTTON))).isVisible(); PlaywrightUtils.page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName(CBIIT_OFFBOARD_FORM_Constants.CBIIT_OFFBOARD_FORM_SUBMIT_BUTTON)).click(); assertThat(PlaywrightUtils.page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName(CBIIT_OFFBOARD_FORM_Constants.CBIIT_SERVICESLINK).setExact(true))).isVisible(); diff --git a/src/test/java/ServiceNow/PlatformBusinessApps/SEER/Features/DUA Agreements.feature b/src/test/java/ServiceNow/PlatformBusinessApps/SEER/Features/DUA Agreements.feature index b4363a111..471b7b80a 100644 --- a/src/test/java/ServiceNow/PlatformBusinessApps/SEER/Features/DUA Agreements.feature +++ b/src/test/java/ServiceNow/PlatformBusinessApps/SEER/Features/DUA Agreements.feature @@ -5,7 +5,7 @@ Feature: DUA Agreements Given a user is on the SEER Data Access Request Then DUA Agreements are verified - @ODS-344 @ODS-359 @ODS-342 @ODS-357 @ODS-343 @ODS-358 @ODS-377 @ODS-390 @ODS-328 @ODS-356 @ODS425 @ODS426 @ODS427 @bucurgb @Regression @selenium + @ODS-344 @ODS-359 @ODS-342 @ODS-357 @ODS-343 @ODS-358 @ODS-377 @ODS-390 @ODS-328 @ODS-356 @ODS425 @ODS426 @ODS427 @bucurgb @Regression @Smoke @selenium Scenario: Verifying SEER ODS Research Plus Data Usage Agreements Given a user is on the SEER Data Access Research Plus Request Then DUA Research Plus Agreements are verified \ No newline at end of file diff --git a/src/test/java/ServiceNow/PlatformBusinessApps/SEER/Features/Landing Page.feature b/src/test/java/ServiceNow/PlatformBusinessApps/SEER/Features/Landing Page.feature index 7fea2b6fb..935f784ee 100644 --- a/src/test/java/ServiceNow/PlatformBusinessApps/SEER/Features/Landing Page.feature +++ b/src/test/java/ServiceNow/PlatformBusinessApps/SEER/Features/Landing Page.feature @@ -1,6 +1,6 @@ Feature: SEER Data Access Landing Page Scenarios -@ODS-319 @ODS-329 @bucurgb @Regression @selenium +@ODS-319 @ODS-329 @bucurgb @Regression @Smoke @selenium Scenario: Test Update public submission page text for user who already has access Given a user is on the SEER Data Access landing page When the user attempts to request research data with existing email address "Diegotest@email.com" @@ -12,7 +12,7 @@ Feature: SEER Data Access Landing Page Scenarios """ And "← Back to SEER Database details" button is also displayed -@ODS-318 @ODS-338 @ODS-321 @ODS-331 @ODS-322 @ODS-332 @ODS-323 @ODS-333 @ODS-324 @ODS-335 @ODS-325 @ODS-334 @bucurgb @Regression @selenium +@ODS-318 @ODS-338 @ODS-321 @ODS-331 @ODS-322 @ODS-332 @ODS-323 @ODS-333 @ODS-324 @ODS-335 @ODS-325 @ODS-334 @bucurgb @Regression @Smoke @selenium Scenario: Test Data access request landing page updates Given a user is on the SEER Data Access landing page Then the SEER Data Access landing page has the following text displayed diff --git a/src/test/java/ServiceNow/PlatformBusinessApps/SEER/Features/SEER Data Access Request Page.feature b/src/test/java/ServiceNow/PlatformBusinessApps/SEER/Features/SEER Data Access Request Page.feature index cf7f8d4b0..e3f995031 100644 --- a/src/test/java/ServiceNow/PlatformBusinessApps/SEER/Features/SEER Data Access Request Page.feature +++ b/src/test/java/ServiceNow/PlatformBusinessApps/SEER/Features/SEER Data Access Request Page.feature @@ -1,6 +1,6 @@ Feature: SEER Data Access Request Scenarios - @ODS-376 @ODS-389 @ODS-375 @ODS-388 @bucurgb @Regression @selenium + @ODS-376 @ODS-389 @ODS-375 @ODS-388 @bucurgb @Regression @Smoke @selenium Scenario: Non-Institutional flow - Verifying SEER Data Access Request page contents and agreements for Non-Institutional flow Given a SEER User Registration has been successfully submitted And user verifies email address by clicking on the email verification link that is sent to the user after submitting a SEER User registration form diff --git a/src/test/java/ServiceNow/PlatformBusinessApps/SEER/Features/SEER Research Plus Login Page.feature b/src/test/java/ServiceNow/PlatformBusinessApps/SEER/Features/SEER Research Plus Login Page.feature index fbe1ea14d..becfbe79c 100644 --- a/src/test/java/ServiceNow/PlatformBusinessApps/SEER/Features/SEER Research Plus Login Page.feature +++ b/src/test/java/ServiceNow/PlatformBusinessApps/SEER/Features/SEER Research Plus Login Page.feature @@ -1,6 +1,6 @@ Feature: SEER Research Plus Login Scenarios - @ODS-349 @chaudhryma @Regression @selenium @NEEDS_UPDATE @AWAITING_REQUIREMENT_UPDATE + @ODS-349 @chaudhryma @NEEDS_UPDATE @AWAITING_REQUIREMENT_UPDATE Scenario: Verifying that "SEER Research Plus" button land on log in page for sanity check Given a user is on the SEER Data Access landing page When the user clicks the SEER Research Plus button diff --git a/src/test/java/ServiceNow/PlatformBusinessApps/SEER/Features/SEER User Registration Page.feature b/src/test/java/ServiceNow/PlatformBusinessApps/SEER/Features/SEER User Registration Page.feature index 0e3266443..d84c0935a 100644 --- a/src/test/java/ServiceNow/PlatformBusinessApps/SEER/Features/SEER User Registration Page.feature +++ b/src/test/java/ServiceNow/PlatformBusinessApps/SEER/Features/SEER User Registration Page.feature @@ -9,7 +9,7 @@ Feature: SEER User Registration Scenarios And submits the registration form Then the user is not able to submit the registration form because the State and Zip Code fields are required - @ODS-284 @bucurgb @Regression @selenium + @ODS-284 @bucurgb @Regression @Smoke @selenium Scenario: Verifying "Thank you - your registration is complete." page contents Given a user is on the SEER Data Access landing page When the user enters email address for a Non-Institutional Account @@ -56,7 +56,7 @@ Feature: SEER User Registration Scenarios And the 'SEER Incidence Database' bread crumb displays And when clicking, user is directed to "https://seer.cancer.gov/data/" - @ODS-373 @ODS-386 @ODS-286 @bucurgb @Regression @selenium + @ODS-373 @ODS-386 @ODS-286 @bucurgb @Regression @Smoke @selenium Scenario: Verifying bread crumbs on "Thank you - your registration is complete." page Given a user is on the SEER Data Access landing page When user enters email address for a Non-Institutional Account @@ -65,7 +65,7 @@ Feature: SEER User Registration Scenarios Then user is directed to the 'Thank you - your registration is complete.' page Then the following breadcrumbs are displayed "Home", "SEER Data & Software", "SEER Incidence Database", "Request SEER Incidence Data", "Submission Confirmation" - @ODS-372 @ODS-385 @ODS-396 @ODS-399 @bucurgb @Regression @selenium + @ODS-372 @ODS-385 @ODS-396 @ODS-399 @bucurgb @Regression @Smoke @selenium Scenario: Verifying that ASCII characters including periods and Commas can be used in the address field - Partially Given a user is on the SEER Data Access landing page When user enter an email address for a Non-Institutional Account @@ -73,7 +73,7 @@ Feature: SEER User Registration Scenarios And submits the registration form Then user is directed to the 'Thank you - your registration is complete.' page - @ODS-370 @ODS-392 @bucurgb @Regression @selenium + @ODS-370 @ODS-392 @bucurgb @Regression @Smoke @selenium Scenario: Verifying that "Requestors associated with HHS agencies should login with their PIV cards to request the data." is present Given a user is on the SEER Data Access landing page Then a user should see (which Federal Government Agencies can sign in with a PIV): @@ -81,7 +81,7 @@ Feature: SEER User Registration Scenarios Requestors associated with HHS agencies should login with their PIV cards to request the data. """ - @ODS-362 @ODS-345 @ODS-363 @ODS-345 @ODS-363 @ODS-345 @bucurgb @Regression @selenium + @ODS-362 @ODS-345 @ODS-363 @ODS-345 @ODS-363 @ODS-345 @bucurgb @Regression @Smoke @selenium Scenario: SEER Research Database user access logic cycle Given a new user who does not have an active SEER Research Database access request When enter email for SEER Research Database and click on the Register for Research Data