Skip to content

Commit

Permalink
Merge pull request #273 from CBIIT/sarwara2
Browse files Browse the repository at this point in the history
ESR-Q and ESR-I creation from Portal View
  • Loading branch information
Mariachaudhry authored Sep 20, 2024
2 parents 128a4bb + 1227434 commit e9b4fbf
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ src/test/java/ServiceNow/PlatformBusinessApps/CCT_CHAT_BOT/Playwright/Steps/Exam
src/test/java/PlaywrightTests_sandbox
src/test/java/ServiceNow/PlatformBusinessApps/SSJ/playwright/Steps/Example.java
src/test/java/CustomBusiness/Egrants/pw
src/test/java/CustomBusiness/Oasys
src/test/java/CustomBusiness/Oasys
src/test/java/ServiceNow/ESR/Playwright/Steps/Example.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,18 @@ Feature: Create ESR Page
Given a user logs into Native View on the NCI at your service page
And navigates to create ESR
And fills out all required information for ESR-I and clicks submit
Then user sees an ESR-I ticket was created
Then user sees an ESR-I ticket was created

@ESR-553 @sarwarahmed1 @Regression @playwright
Scenario: Test creating an ESR-Q ticket from Portal View
Given a user logs into NCI at your service page
And navigates to Engineering Support Requests
And fills out all required information for ESR-Q in portal view and clicks submit
Then user sees an ESR-Q ticket was created in portal view

@ESR-554 @sarwarahmed1 @Regression @playwright
Scenario: Test creating an ESR-I ticket from Portal View
Given a user logs into NCI at your service page
And navigates to Engineering Support Requests
And fills out all required information for ESR-I in portal view and clicks submit
Then user sees an ESR-I ticket was created in portal view
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,29 @@ public void user_sees_an_esr_q_ticket_was_created() {
public void fills_out_all_required_information_for_esr_i_and_clicks_submit() {
CreateESRPageStepsImplementation.fillRequiredInfoForESRICreation();
}

@Then("user sees an ESR-I ticket was created")
public void user_sees_an_esr_i_ticket_was_created() {
CreateESRPageStepsImplementation.clickOnNewESRITicket();
}

@And("fills out all required information for ESR-Q in portal view and clicks submit")
public void fills_out_all_required_information_for_esr_q_in_portal_view_and_clicks_submit() {
CreateESRPageStepsImplementation.fillRequiredInfoForESRQPortal();
}

@Then("user sees an ESR-Q ticket was created in portal view")
public void user_sees_an_esr_q_ticket_was_created_in_portal_view() {
CreateESRPageStepsImplementation.verifyESRQPortalCreation();
}

@And("fills out all required information for ESR-I in portal view and clicks submit")
public void fills_out_all_required_information_for_esr_i_in_portal_view_and_clicks_submit() {
CreateESRPageStepsImplementation.fillRequiredInfoForESRIPortal();
}

@Then("user sees an ESR-I ticket was created in portal view")
public void user_sees_an_esr_i_ticket_was_created_in_portal_view() {
CreateESRPageStepsImplementation.verifyESRIPortalCreation();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import ServiceNow.ESR.Playwright.Pages.CreateESRPage;
import appsCommon.PlaywrightUtils.Playwright_ServiceNow_Common_Methods;
import com.microsoft.playwright.FrameLocator;
import com.microsoft.playwright.Locator;
import com.microsoft.playwright.Page;
import com.microsoft.playwright.options.AriaRole;
import com.nci.automation.utils.MiscUtils;
Expand Down Expand Up @@ -137,4 +138,74 @@ public static void clickOnNewESRITicket() {
page.frameLocator(CreateESRPage.iframeSelector).locator("//tbody/tr/td/a[1]").click();
assertThat(page.frameLocator(CreateESRPage.iframeSelector).locator("(//div[@class='col-xs-12 form-field input_controls sc-form-field ']/select)[1]")).containsText("Implementation");
}

/**
* Fills in all information required for the creation of an ESR-Q ticket in Portal View
*/
public static void fillRequiredInfoForESRQPortal() {
page.getByLabel("Phone").click();
page.getByLabel("Phone").fill("000");
page.getByLabel("Project Name").click();
page.getByLabel("Project Name").fill("Test Project - Portal View");
page.locator("#s2id_sp_formfield_phase a").click();
page.getByRole(AriaRole.OPTION, new Page.GetByRoleOptions().setName("Q-Branch")).click();
page.locator("#s2id_sp_formfield_it_service_area").getByRole(AriaRole.LINK, new Locator.GetByRoleOptions().setName("Lookup using list")).click();
page.getByRole(AriaRole.OPTION, new Page.GetByRoleOptions().setName("Cybersecurity")).click();
page.getByLabel("Project Description").click();
page.getByLabel("Project Description").fill("Test Description");
page.locator("#s2id_sp_formfield_ocio_federal_lead").getByRole(AriaRole.LINK, new Locator.GetByRoleOptions().setName("Lookup using list")).click();
page.getByText("Alex Nordan").click();
page.locator("#s2id_sp_formfield_assignment_group_esr").getByRole(AriaRole.LINK, new Locator.GetByRoleOptions().setName("Lookup using list")).click();
page.getByRole(AriaRole.OPTION, new Page.GetByRoleOptions().setName("CHARMS Technical Support")).click();
page.locator("#s2id_sp_formfield_business_owner").getByRole(AriaRole.LINK, new Locator.GetByRoleOptions().setName("Lookup using list")).click();
page.getByText("Aaliyah Robertson").click();
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Submit").setExact(true)).click();
}

/**
* Navigates into newly created ESR-Q ticket from Portal View and validates it as a Q-Branch ticket
*/
public static void verifyESRQPortalCreation() {
page.navigate("https://service-test.nci.nih.gov/ncisp?id=nci_home");
page.locator("//li[@class='list-group-item ng-scope'][1]").click();
assertThat(page.getByRole(AriaRole.MAIN)).containsText("ESR-Q");
Page page1 = page.waitForPopup(() -> {
page.locator("//span[@ng-if=\"data.table == 'sc_req_item'\"]//a").click();
});
assertThat(page1.frameLocator(CreateESRPage.iframeSelector).locator("(//div[@class='col-xs-12 form-field input_controls sc-form-field ']/select)[1]")).containsText("Q-Branch");
}

/**
* Fills in all information required for the creation of an ESR-I ticket in Portal View
*/
public static void fillRequiredInfoForESRIPortal() {
page.getByLabel("Phone").click();
page.getByLabel("Phone").fill("000");
page.getByLabel("Project Name").click();
page.getByLabel("Project Name").fill("Test Project - Portal View");
page.locator("#s2id_sp_formfield_it_service_area").getByRole(AriaRole.LINK, new Locator.GetByRoleOptions().setName("Lookup using list")).click();
page.getByRole(AriaRole.OPTION, new Page.GetByRoleOptions().setName("Cybersecurity")).click();
page.getByLabel("Project Description").click();
page.getByLabel("Project Description").fill("Test Description");
page.locator("#s2id_sp_formfield_ocio_federal_lead").getByRole(AriaRole.LINK, new Locator.GetByRoleOptions().setName("Lookup using list")).click();
page.getByText("Alex Nordan").click();
page.locator("#s2id_sp_formfield_assignment_group_esr").getByRole(AriaRole.LINK, new Locator.GetByRoleOptions().setName("Lookup using list")).click();
page.getByRole(AriaRole.OPTION, new Page.GetByRoleOptions().setName("CHARMS Technical Support")).click();
page.locator("#s2id_sp_formfield_business_owner").getByRole(AriaRole.LINK, new Locator.GetByRoleOptions().setName("Lookup using list")).click();
page.getByText("Aaliyah Robertson").click();
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Submit").setExact(true)).click();
}

/**
* Navigates into newly created ESR-I ticket from Portal View and validates it as a Implementation ticket
*/
public static void verifyESRIPortalCreation() {
page.navigate("https://service-test.nci.nih.gov/ncisp?id=nci_home");
page.locator("//li[@class='list-group-item ng-scope'][1]").click();
assertThat(page.getByRole(AriaRole.MAIN)).containsText("Implementation");
Page page1 = page.waitForPopup(() -> {
page.locator("//span[@ng-if=\"data.table == 'sc_req_item'\"]//a").click();
});
assertThat(page1.frameLocator(CreateESRPage.iframeSelector).locator("(//div[@class='col-xs-12 form-field input_controls sc-form-field ']/select)[1]")).containsText("Implementation");
}
}

0 comments on commit e9b4fbf

Please sign in to comment.