From 870850be55180bf436213f0562b6374d8c31a658 Mon Sep 17 00:00:00 2001 From: mariachaudhry Date: Thu, 9 Jan 2025 00:32:44 -0500 Subject: [PATCH 1/2] CCR OIT Helpdesk Automation --- .../nci/automation/web/TestProperties.java | 2 +- .../features/CCR_OIT_HELPDESK.feature | 7 ++ ..._CCR_OIT_Helpdesk_PW_Progression_Test.java | 15 +++++ ...n_CCR_OIT_Helpdesk_PW_Regression_Test.java | 15 +++++ .../steps/CCR_OIT_HELPDESK_Steps.java | 64 +++++++++++++++++++ .../Top_Accomplishment_Submission.feature | 2 +- ...ccomplishment_New_Submission_StepImpl.java | 4 +- ...p_Accomplishment_New_Submission_Steps.java | 2 +- 8 files changed, 106 insertions(+), 5 deletions(-) create mode 100644 src/test/java/PLATFORM_BUSINESS/CCR_Help_Desk/features/CCR_OIT_HELPDESK.feature create mode 100644 src/test/java/PLATFORM_BUSINESS/CCR_Help_Desk/runners/Run_CCR_OIT_Helpdesk_PW_Progression_Test.java create mode 100644 src/test/java/PLATFORM_BUSINESS/CCR_Help_Desk/runners/Run_CCR_OIT_Helpdesk_PW_Regression_Test.java create mode 100644 src/test/java/PLATFORM_BUSINESS/CCR_Help_Desk/steps/CCR_OIT_HELPDESK_Steps.java diff --git a/src/main/java/com/nci/automation/web/TestProperties.java b/src/main/java/com/nci/automation/web/TestProperties.java index 9627b4b3e..3c18f075a 100644 --- a/src/main/java/com/nci/automation/web/TestProperties.java +++ b/src/main/java/com/nci/automation/web/TestProperties.java @@ -4,7 +4,7 @@ public class TestProperties { public static String ENV = "test"; public static String BROWSER = "chrome"; - public static boolean HEADLESS = true; + public static boolean HEADLESS = false; public static int SET_SLOW_MO_TIME = 1000; /** diff --git a/src/test/java/PLATFORM_BUSINESS/CCR_Help_Desk/features/CCR_OIT_HELPDESK.feature b/src/test/java/PLATFORM_BUSINESS/CCR_Help_Desk/features/CCR_OIT_HELPDESK.feature new file mode 100644 index 000000000..39d4d1e40 --- /dev/null +++ b/src/test/java/PLATFORM_BUSINESS/CCR_Help_Desk/features/CCR_OIT_HELPDESK.feature @@ -0,0 +1,7 @@ +Feature: CCR/OIT HelpDesk testing + + @CCRHELPDES-153 @chaudhryma @Regression @playwright + Scenario: Test Allow CCR OIT Help Desk access for all NIH users + Given I am an authenticated NCI Frederick user 'Ellen Volkmar', + When I go to the CCR OIT Help Desk catalog item, + Then I should be able to access the help desk to submit a request. \ No newline at end of file diff --git a/src/test/java/PLATFORM_BUSINESS/CCR_Help_Desk/runners/Run_CCR_OIT_Helpdesk_PW_Progression_Test.java b/src/test/java/PLATFORM_BUSINESS/CCR_Help_Desk/runners/Run_CCR_OIT_Helpdesk_PW_Progression_Test.java new file mode 100644 index 000000000..2017eba9e --- /dev/null +++ b/src/test/java/PLATFORM_BUSINESS/CCR_Help_Desk/runners/Run_CCR_OIT_Helpdesk_PW_Progression_Test.java @@ -0,0 +1,15 @@ +package PLATFORM_BUSINESS.CCR_Help_Desk.runners; + +import io.cucumber.testng.AbstractTestNGCucumberTests; +import io.cucumber.testng.CucumberOptions; + +@CucumberOptions(plugin = {"html:target/ccr_helpdesk-progression-reports/ccr_helpdesk-progression-report.html", + "json:target/cucumber.json", "rerun:target/failed.txt", + "pretty", "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"} + , features = "src/test/java/PLATFORM_BUSINESS/CCR_Help_Desk/features" + , glue = {"PLATFORM_BUSINESS.CCR_Help_Desk.steps", "Hooks"} + , tags = "@Progression" + , dryRun = false +) +public class Run_CCR_OIT_Helpdesk_PW_Progression_Test extends AbstractTestNGCucumberTests { +} \ No newline at end of file diff --git a/src/test/java/PLATFORM_BUSINESS/CCR_Help_Desk/runners/Run_CCR_OIT_Helpdesk_PW_Regression_Test.java b/src/test/java/PLATFORM_BUSINESS/CCR_Help_Desk/runners/Run_CCR_OIT_Helpdesk_PW_Regression_Test.java new file mode 100644 index 000000000..983c42980 --- /dev/null +++ b/src/test/java/PLATFORM_BUSINESS/CCR_Help_Desk/runners/Run_CCR_OIT_Helpdesk_PW_Regression_Test.java @@ -0,0 +1,15 @@ +package PLATFORM_BUSINESS.CCR_Help_Desk.runners; + +import io.cucumber.testng.AbstractTestNGCucumberTests; +import io.cucumber.testng.CucumberOptions; + +@CucumberOptions(plugin = {"html:target/ccr_Help_Desk-regression-reports/ccr_Help_Desk-regression-report.html", + "json:target/cucumber.json", "rerun:target/failed.txt", + "pretty", "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"} + , features = "src/test/java/PLATFORM_BUSINESS/CCR_Help_Desk/features" + , glue = {"PLATFORM_BUSINESS.CCR_Help_Desk.steps", "Hooks"} + , tags = "@Regression" + , dryRun = false +) +public class Run_CCR_OIT_Helpdesk_PW_Regression_Test extends AbstractTestNGCucumberTests { +} \ No newline at end of file diff --git a/src/test/java/PLATFORM_BUSINESS/CCR_Help_Desk/steps/CCR_OIT_HELPDESK_Steps.java b/src/test/java/PLATFORM_BUSINESS/CCR_Help_Desk/steps/CCR_OIT_HELPDESK_Steps.java new file mode 100644 index 000000000..c14f808d4 --- /dev/null +++ b/src/test/java/PLATFORM_BUSINESS/CCR_Help_Desk/steps/CCR_OIT_HELPDESK_Steps.java @@ -0,0 +1,64 @@ +package PLATFORM_BUSINESS.CCR_Help_Desk.steps; + +import APPS_COMMON.PlaywrightUtils.Playwright_ServiceNow_Common_Methods; +import com.microsoft.playwright.Page; +import com.microsoft.playwright.options.AriaRole; +import io.cucumber.java.en.Given; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; +import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat; +import static com.nci.automation.web.PlaywrightUtils.page; + +public class CCR_OIT_HELPDESK_Steps { + + /** + * Logs into native view using the side door test account and impersonates an NCI Frederick user. + * + * @param ellenVolkmar The name of the NCI Frederick user to impersonate + */ + @Given("I am an authenticated NCI Frederick user {string},") + public void i_am_an_authenticated_nci_frederick_user(String ellenVolkmar) { + Playwright_ServiceNow_Common_Methods.side_Door_Test_Account_Login_Impersonate(ellenVolkmar); + assertThat(page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Services").setExact(true))).isVisible(); + assertThat(page.locator("//a[@role='button'][normalize-space()='Services']")).containsText("Services"); + page.locator("//a[@role='button'][normalize-space()='Services']").click(); + page.locator("//a[@class='level-2-link ng-binding dropdown-toggle dropdown'][normalize-space()='CCR Services']").click(); + } + + /** + * Navigates to the CCR OIT Help Desk catalog item by clicking on the OIT Help Desk link, + */ + @When("I go to the CCR OIT Help Desk catalog item,") + public void i_go_to_the_ccr_oit_help_desk_catalog_item() { + page.locator("//h4[normalize-space()='OIT Help Desk']").waitFor(); + assertThat(page.getByText("OIT Help Desk Get assistance")).isVisible(); + assertThat(page.getByRole(AriaRole.MAIN)).containsText("OIT Help Desk"); + page.locator("//h4[normalize-space()='OIT Help Desk']").click(); + } + + /** + * Method to access the help desk to submit a request. + * This method performs the necessary actions to access the OIT Help Desk in order to submit a request. + * It waits for the OIT Help Desk page to load, checks visibility of required elements, fills in necessary information, + * and submits the request. Finally, it asserts the presence of a confirmation message. + */ + @Then("I should be able to access the help desk to submit a request.") + public void i_should_be_able_to_access_the_help_desk_to_submit_a_request() { + page.locator("//h1[normalize-space()='OIT Help Desk']").waitFor(); + page.locator("//h1[normalize-space()='OIT Help Desk']").isVisible(); + page.locator("//span[@aria-label='Required - Requested for']").scrollIntoViewIfNeeded(); + page.locator("//span[@aria-label='Required - Requested for']").isVisible(); + assertThat(page.getByLabel("Required - Application")).isVisible(); + page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("Lookup using list")).click(); + page.getByRole(AriaRole.OPTION, new Page.GetByRoleOptions().setName("ADTool")).click(); + assertThat(page.locator("#short_description").getByText("Short description")).isVisible(); + page.getByLabel("Short description").click(); + page.getByLabel("Short description").fill("Test"); + assertThat(page.locator("#description").getByText("Details")).isVisible(); + page.frameLocator("iframe[title=\"Rich Text Area\"]").getByRole(AriaRole.PARAGRAPH).click(); + page.frameLocator("iframe[title=\"Rich Text Area\"]").getByLabel("Details").fill("Test"); + assertThat(page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Submit").setExact(true))).isVisible(); + page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Submit").setExact(true)).click(); + assertThat(page.getByRole(AriaRole.HEADING, new Page.GetByRoleOptions().setName("How can we help, Ellen?"))).isVisible(); + } +} \ No newline at end of file diff --git a/src/test/java/PLATFORM_BUSINESS/NERD/playwright/Features/Top_Accomplishment_Submission.feature b/src/test/java/PLATFORM_BUSINESS/NERD/playwright/Features/Top_Accomplishment_Submission.feature index 7c627bba2..a45160a6c 100644 --- a/src/test/java/PLATFORM_BUSINESS/NERD/playwright/Features/Top_Accomplishment_Submission.feature +++ b/src/test/java/PLATFORM_BUSINESS/NERD/playwright/Features/Top_Accomplishment_Submission.feature @@ -6,7 +6,7 @@ Feature: Top Accomplishments Submission When they access the 'NERD' Catalog Then they can create a record called "Top Accomplishments" And add attachments via the record itself - And 'Category' Field Auto Populated with the following value "Top Accomplishments" + And 'Category' Field Auto Populated with the following value "Top Accomplishment" And 'Rank' field is mandatory drop-down with the following options "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Not Top 10" And 'Fiscal Year' field is mandatory dropdown with the following options for Previous year "2023", and Current year "2024" And 'Title' field is mandatory short text field diff --git a/src/test/java/PLATFORM_BUSINESS/NERD/playwright/StepImplementation/Top_Accomplishment_New_Submission_StepImpl.java b/src/test/java/PLATFORM_BUSINESS/NERD/playwright/StepImplementation/Top_Accomplishment_New_Submission_StepImpl.java index 733ffbf3e..3d2640fba 100644 --- a/src/test/java/PLATFORM_BUSINESS/NERD/playwright/StepImplementation/Top_Accomplishment_New_Submission_StepImpl.java +++ b/src/test/java/PLATFORM_BUSINESS/NERD/playwright/StepImplementation/Top_Accomplishment_New_Submission_StepImpl.java @@ -11,11 +11,11 @@ public class Top_Accomplishment_New_Submission_StepImpl { * Method to upload the Pdf attachment to Top Accomplishment Submission */ public static void uploadAttachmentInNativeView() { - String uploadAttchment = System.getProperty("user.dir") + "/src/test/java/CHARMS/Resources/Family Cohort Study Consent.pdf"; + String uploadAttachment = System.getProperty("user.dir") + "/src/test/java/CHARMS/Resources/Family Cohort Study Consent.pdf"; page.frameLocator("iframe[name='gsft_main']").locator("#add_attachment").waitFor(); page.frameLocator("iframe[name='gsft_main']").locator("#add_attachment").click(); CommonUtils.sleep(2000); - page.frameLocator("iframe[name='gsft_main']").locator("input[aria-hidden='true'][id='attachFile']").setInputFiles(Paths.get(uploadAttchment)); + page.frameLocator("iframe[name='gsft_main']").locator("input[aria-hidden='true'][id='attachFile']").setInputFiles(Paths.get(uploadAttachment)); CommonUtils.sleep(2000); page.frameLocator("iframe[name='gsft_main']").getByLabel("Close", new FrameLocator.GetByLabelOptions().setExact(true)).click(); } diff --git a/src/test/java/PLATFORM_BUSINESS/NERD/playwright/Steps/Top_Accomplishment_New_Submission_Steps.java b/src/test/java/PLATFORM_BUSINESS/NERD/playwright/Steps/Top_Accomplishment_New_Submission_Steps.java index 56bdfd539..71dc1699f 100644 --- a/src/test/java/PLATFORM_BUSINESS/NERD/playwright/Steps/Top_Accomplishment_New_Submission_Steps.java +++ b/src/test/java/PLATFORM_BUSINESS/NERD/playwright/Steps/Top_Accomplishment_New_Submission_Steps.java @@ -686,7 +686,7 @@ public void is_an_optional_list_collector_field_and_offers_multi_selection_so_mo page.frameLocator("iframe[name='gsft_main']").getByRole(AriaRole.BUTTON, new FrameLocator.GetByRoleOptions().setName("Lookup using list")).click(); }); CucumberLogUtils.playwrightScreenshot(nedUserPage); - assertThat(nedUserPage.getByText("Showing rows 1 to 20 of 145,907 to 20 of 145,9070UsersUser", new Page.GetByTextOptions().setExact(true))).isVisible(); + assertThat(nedUserPage.getByText("Showing rows 1 to 20 of 145,954 to 20 of 145,9540UsersUser", new Page.GetByTextOptions().setExact(true))).isVisible(); assertThat(nedUserPage.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Margie Blochlinger"))).containsText("Margie Blochlinger"); CucumberLogUtils.playwrightScreenshot(nedUserPage); nedUserPage.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Margie Blochlinger")).click(); From 58708be472c3d6d5a13cb407f193582fdcf90077 Mon Sep 17 00:00:00 2001 From: mariachaudhry Date: Thu, 9 Jan 2025 00:35:16 -0500 Subject: [PATCH 2/2] .. --- src/main/java/com/nci/automation/web/TestProperties.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/nci/automation/web/TestProperties.java b/src/main/java/com/nci/automation/web/TestProperties.java index 3c18f075a..9627b4b3e 100644 --- a/src/main/java/com/nci/automation/web/TestProperties.java +++ b/src/main/java/com/nci/automation/web/TestProperties.java @@ -4,7 +4,7 @@ public class TestProperties { public static String ENV = "test"; public static String BROWSER = "chrome"; - public static boolean HEADLESS = false; + public static boolean HEADLESS = true; public static int SET_SLOW_MO_TIME = 1000; /**