Skip to content

Commit

Permalink
Merge pull request #362 from CBIIT/chaudhryma
Browse files Browse the repository at this point in the history
CCR OIT Helpdesk Automation ~Chaudhryma
  • Loading branch information
Mariachaudhry authored Jan 10, 2025
2 parents 11b7c97 + 69c953a commit dc3f140
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
@@ -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 {
}
Original file line number Diff line number Diff line change
@@ -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 {
}
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit dc3f140

Please sign in to comment.