Skip to content

Commit

Permalink
Merge pull request #325 from CBIIT/chaudhryma
Browse files Browse the repository at this point in the history
[Platform Business Apps]- Travel Request automation ~Chaudhryma
  • Loading branch information
iamdez99 authored Nov 15, 2024
2 parents 5e9a406 + e33bd73 commit 044e753
Show file tree
Hide file tree
Showing 10 changed files with 446 additions and 172 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package ServiceNow.PlatformBusinessApps.SNOWPROJ.Runners;
package ServiceNow.PlatformBusinessApps.OCPL_Training.Runners;

import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;

@CucumberOptions(plugin = {"html:target/html-reports/cucumber-default-report.html",
@CucumberOptions(plugin = {"html:target/OCPL-Training-Progression-reports/OCPL-Training-Progression-report.html",
"json:target/cucumber.json", "rerun:target/failed.txt",
"pretty", "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"}
, features = "src/test/java/ServiceNow/PlatformBusinessApps/SNOWPROJ/Features"
, glue = {"ServiceNow.PlatformBusinessApps.SNOWPROJ.Steps", "Hooks"}
, features = "src/test/java/ServiceNow/PlatformBusinessApps/OCPL_Traning/Features"
, glue = {"ServiceNow.PlatformBusinessApps.OCPL_Traning.Steps", "Hooks"}
, tags = "@Progression"
, dryRun = false
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package ServiceNow.PlatformBusinessApps.SNOWPROJ.Runners;
package ServiceNow.PlatformBusinessApps.OCPL_Training.Runners;

import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;

@CucumberOptions(plugin = {"html:target/OCPL-Regression-reports/cucumber-default-report.html",
@CucumberOptions(plugin = {"html:target/OCPL-Training-Regression-reports/OCPL-Training-Regression-report.html",
"json:target/cucumber.json", "rerun:target/failed.txt",
"pretty", "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"}
, features = "src/test/java/ServiceNow/PlatformBusinessApps/SNOWPROJ/Features"
, glue = {"ServiceNow.PlatformBusinessApps.SNOWPROJ.Steps", "Hooks"}
, features = "src/test/java/ServiceNow/PlatformBusinessApps/OCPL_Traning/Features"
, glue = {"ServiceNow.PlatformBusinessApps.OCPL_Traning.Steps", "Hooks"}
, tags = "@Regression"
, dryRun = false
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ServiceNow.PlatformBusinessApps.SNOWPROJ.Steps;
package ServiceNow.PlatformBusinessApps.OCPL_Training.Steps;

import appsCommon.PlaywrightUtils.Playwright_ServiceNow_Common_Methods;
import com.microsoft.playwright.FrameLocator;
Expand Down Expand Up @@ -180,18 +180,18 @@ public void verify_the_response_in_the_body_of_email_in_the_system_log_emails(St
page.getByPlaceholder("Filter").press("Enter");
assertThat(page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("Emails"))).isVisible();
page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("Emails")).click();
page.frameLocator("iframe[name=\"gsft_main\"]").getByLabel("Search a specific field of").selectOption("subject");
page.frameLocator("iframe[name=\"gsft_main\"]").getByLabel("Search", new FrameLocator.GetByLabelOptions().setExact(true)).click();
page.frameLocator("iframe[name=\"gsft_main\"]").getByLabel("Search", new FrameLocator.GetByLabelOptions().setExact(true)).fill(ocplTrainingRequest);
page.frameLocator("iframe[name=\"gsft_main\"]").getByLabel("Search", new FrameLocator.GetByLabelOptions().setExact(true)).press("Enter");
assertThat(page.frameLocator("iframe[name=\"gsft_main\"]").getByLabel("Emails.").locator("tbody")).containsText(ocplTrainingRequest);
page.frameLocator("iframe[name=\"gsft_main\"]").locator("(//a[@aria-label='Preview record: OCPL Training Request'])[1]").click();
page.frameLocator("iframe[name=\"gsft_main\"]").locator("//a[normalize-space()='Open Record']").isVisible();
page.frameLocator("iframe[name=\"gsft_main\"]").locator("//a[normalize-space()='Open Record']").click();
page.frameLocator("iframe[name=\"gsft_main\"]").getByRole(AriaRole.BUTTON, new FrameLocator.GetByRoleOptions().setName("Preview Email")).scrollIntoViewIfNeeded();
assertThat(page.frameLocator("iframe[name=\"gsft_main\"]").getByRole(AriaRole.BUTTON, new FrameLocator.GetByRoleOptions().setName("Preview Email"))).isVisible();
page.frameLocator("iframe[name=\"gsft_main\"]").locator("(//a[normalize-space()='Preview Email'])").click();
assertThat(page.frameLocator("iframe[name=\"gsft_main\"]").frameLocator("iframe[title=\"Preview Email\"]").getByRole(AriaRole.PARAGRAPH)).containsText("Are you requesting Compensatory Time for Travel (CTT) during this training? = Yes");
assertThat(page.frameLocator("iframe[name=\"gsft_main\"]").frameLocator("iframe[title=\"Preview Email\"]").getByRole(AriaRole.PARAGRAPH)).containsText("Are you requesting Comp Time (CT) during this training? = No");
page.frameLocator("iframe[name='gsft_main']").getByLabel("Search a specific field of").selectOption("subject");
page.frameLocator("iframe[name='gsft_main']").getByLabel("Search", new FrameLocator.GetByLabelOptions().setExact(true)).click();
page.frameLocator("iframe[name='gsft_main']").getByLabel("Search", new FrameLocator.GetByLabelOptions().setExact(true)).fill(ocplTrainingRequest);
page.frameLocator("iframe[name='gsft_main']").getByLabel("Search", new FrameLocator.GetByLabelOptions().setExact(true)).press("Enter");
assertThat(page.frameLocator("iframe[name='gsft_main']").getByLabel("Emails.").locator("tbody")).containsText(ocplTrainingRequest);
page.frameLocator("iframe[name='gsft_main']").locator("(//a[@aria-label='Preview record: OCPL Training Request'])[1]").click();
page.frameLocator("iframe[name='gsft_main']").locator("//a[normalize-space()='Open Record']").isVisible();
page.frameLocator("iframe[name='gsft_main']").locator("//a[normalize-space()='Open Record']").click();
page.frameLocator("iframe[name='gsft_main']").getByRole(AriaRole.BUTTON, new FrameLocator.GetByRoleOptions().setName("Preview Email")).scrollIntoViewIfNeeded();
assertThat(page.frameLocator("iframe[name='gsft_main']").getByRole(AriaRole.BUTTON, new FrameLocator.GetByRoleOptions().setName("Preview Email"))).isVisible();
page.frameLocator("iframe[name='gsft_main']").locator("(//a[normalize-space()='Preview Email'])").click();
assertThat(page.frameLocator("iframe[name='gsft_main']").frameLocator("iframe[title=\"Preview Email\"]").getByRole(AriaRole.PARAGRAPH)).containsText("Are you requesting Compensatory Time for Travel (CTT) during this training? = Yes");
assertThat(page.frameLocator("iframe[name='gsft_main']").frameLocator("iframe[title=\"Preview Email\"]").getByRole(AriaRole.PARAGRAPH)).containsText("Are you requesting Comp Time (CT) during this training? = No");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Feature: SNOWTRAVEL Native View Form Scenarios

@SNOWTRAVEL-124 @Chaudhryma @Smoke @Regression @playwright
Scenario: Test Create Travel Request Application Module
Given I am an authenticated DOC CGH Travel Request User
Given I am an authenticated DOC CGH Travel Request User "Dimetria Branch"
When I search "Travel Planning System", in the filter navigator,
Then I will see Modules created for the "Travel Requests", "Assigned to Me", "Assigned to My Group",and "My Approvals" underneath Travel Planning System Application

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Feature: SNOWTRAVEL Portal Form Scenarios

@SNOWTRAVEL-121 @SNOWTRAVEL-130 @Chaudhryma @Smoke @Regression @playwright
Scenario: Test Travel Start Date and Travel End Date Field Additions
Given I am an authenticated DOC CGH Travel Request User
Given I am an authenticated DOC CGH Travel Request User "Dimetria Branch"
When I navigate to the Trip Information section of the form,
Then I should see the required "Travel Start Date" field to enter date
And also see the required "Travel End Date" field to enter date
Expand All @@ -20,7 +20,7 @@ Feature: SNOWTRAVEL Portal Form Scenarios

@SNOWTRAVEL-125 @Chaudhryma @Smoke @Regression @playwright
Scenario: Test 1: CGH Field Enhancements on Travel Request Form
Given I am an authenticated DOC CGH Travel Request User
Given I am an authenticated DOC CGH Travel Request User "Dimetria Branch"
When I am on the "Travel Planning System" form
Then I verify the first four questions on the form under "Travel Questions" section
And the first question "Do you have a defined role at the meeting/conference or intended for professional development?" is optional
Expand All @@ -30,19 +30,33 @@ Feature: SNOWTRAVEL Portal Form Scenarios

@SNOWTRAVEL-125 @Chaudhryma @Smoke @Regression @playwright
Scenario: Test 2: CGH Field Enhancements on Travel Request Form
Given I am an authenticated DOC CGH Travel Request User
Given I am an authenticated DOC CGH Travel Request User "Dimetria Branch"
When I am on the "Travel Planning System" form
Then I will not see the following help text language under the field "Destination Type" under the "Event" section:"Local needs to be submitted 2 weeks before event date."

@SNOWTRAVEL-125 @Chaudhryma @Regression @playwright
Scenario: Test 3: CGH Field Enhancements on Travel Request Form
Given I am an authenticated DOC CGH Travel Request User
Given I am an authenticated DOC CGH Travel Request User "Dimetria Branch"
When I am on the "Travel Planning System" form
Then I will not see the Header on the form "Travel Cash Advance",
And the following fields "Cash (Direct Deposit) Advance Requested" and "Reason for Cash Advance" under Travel Cash Advance section will be removed

@SNOWTRAVEL-121 @Chaudhryma @Smoke @Regression @playwright
Scenario: Test 2: Travel Request Form invisibility to non-CGH users
Given I am not a CGH user
Given I am not a CGH user "Warren Kibbe"
When I log in to the NCI at Your Service Portal,
Then I should not see the Travel Planning System in the catalog item.
Then I should not see the Travel Planning System in the catalog item.

@SNOWTRAVEL-272 @Chaudhryma @Regression @playwright
Scenario: Test Update "Event Type" Field to be Required
Given I am a CGH User "Ann Chao" who is Completing a Travel Planning Request form,
When I navigate to the field "Event Type",
Then I will see that the field is now required,
And I will not be able to submit the form without completing this field.

@SNOWTRAVEL-182 @Chaudhryma @Regression @playwright
Scenario: Test 1: For CGH Make the "URL of Registration Site" field required if "Registration Fees?" is YES
Given I am a CGH User "Ann Chao"
And I am Completing a Travel Planning Request form,
When "Yes" is selected for the "Registration Fees?" field,
Then the "URL of Registration Site" field will be required.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public static void i_will_see_modules_created_for_the_and_underneath_application
assertThat(page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName(myApprovals))).isVisible();
assertThat(page.getByRole(AriaRole.LIST)).containsText(myApprovals);
page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName(myApprovals)).click();
assertThat(page.frameLocator("iframe[name=\"gsft_main\"]").getByRole(AriaRole.BUTTON, new FrameLocator.GetByRoleOptions().setName(Travel_Request_NV_Contants.NV_MY_APPROVAL_MODULE_APPROVALS_TEXT))).isVisible();
assertThat(page.frameLocator("iframe[name=\"gsft_main\"]").getByRole(AriaRole.HEADING)).containsText(Travel_Request_NV_Contants.NV_MY_APPROVAL_MODULE_APPROVALS_TEXT);
assertThat(page.frameLocator("iframe[name='gsft_main']").getByRole(AriaRole.BUTTON, new FrameLocator.GetByRoleOptions().setName(Travel_Request_NV_Contants.NV_MY_APPROVAL_MODULE_APPROVALS_TEXT))).isVisible();
assertThat(page.frameLocator("iframe[name='gsft_main']").getByRole(AriaRole.HEADING)).containsText(Travel_Request_NV_Contants.NV_MY_APPROVAL_MODULE_APPROVALS_TEXT);
CucumberLogUtils.playwrightScreenshot(page);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,17 @@ public static void i_navigate_to_the_trip_information_section_of_the_form() {
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("OK").setExact(true)).click();
page.getByLabel("Show Calendar for Event End").click();
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("OK").setExact(true)).click();

CucumberLogUtils.scenario.log("---- EVENT TYPE IS NOW A REQUIRED FIELD ----");
page.locator("#sp_grp_checkbox_event_type_label").scrollIntoViewIfNeeded();
assertThat(page.locator("#sp_grp_checkbox_event_type_label")).containsText("Event Type");
assertThat(page.getByRole(AriaRole.GROUP, new Page.GetByRoleOptions().setName("Mandatory Event Type")).getByLabel("Mandatory")).isVisible();
page.getByLabel("Event", new Page.GetByLabelOptions().setExact(true)).getByText("Event Type").click();
page.locator("#advisory_board").isVisible();
page.getByText("Advisory Board").click();

CucumberLogUtils.scenario.log("---- REGISTRATION FEE -- A REQUIRED FIELD ----");
page.locator("#registration_fees").scrollIntoViewIfNeeded();
assertThat(page.locator("#registration_fees")).containsText(Travel_Request_Portal_Form_Constants.REGISTRATION_FEES_FIELD_TEXT);
CommonUtils.sleep(2000);
page.getByRole(AriaRole.GROUP, new Page.GetByRoleOptions().setName("Registration Fee").setExact(true)).locator("a").click();
Expand Down Expand Up @@ -158,16 +169,16 @@ public static void the_field_will_map_to_the_travel_start_date_field_in_the_vari
page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("Travel Requests")).click();
CucumberLogUtils.playwrightScreenshot(page);

//click on the most top record and click on open record button
page.frameLocator("iframe[name=\"gsft_main\"]").locator("(//*[@class='list_decoration_cell col-small col-center ']//a)[1]").hover();
page.frameLocator("iframe[name=\"gsft_main\"]").locator("(//*[@class='list_decoration_cell col-small col-center ']//a)[1]").click();
page.frameLocator("iframe[name=\"gsft_main\"]").locator("//*[@class='btn btn-sm btn-default pop-over-button pull-right']").click();
CucumberLogUtils.scenario.log("---- CLICK ON THE MOST TOP RECORD AND CLICK ON OPEN RECORD BUTTON ----");
page.frameLocator("iframe[name='gsft_main']").locator("(//*[@class='list_decoration_cell col-small col-center ']//a)[1]").hover();
page.frameLocator("iframe[name='gsft_main']").locator("(//*[@class='list_decoration_cell col-small col-center ']//a)[1]").click();
page.frameLocator("iframe[name='gsft_main']").locator("//*[@class='btn btn-sm btn-default pop-over-button pull-right']").click();
CucumberLogUtils.playwrightScreenshot(page);
page.frameLocator("iframe[name=\"gsft_main\"]").locator("#tabs2_section").getByText(Travel_Request_Portal_Form_Constants.VARIABLES_TAB).click();
page.frameLocator("iframe[name=\"gsft_main\"]").locator("//span[@aria-label='Trip Information']").scrollIntoViewIfNeeded();
assertThat(page.frameLocator("iframe[name=\"gsft_main\"]").getByLabel("Trip Information", new FrameLocator.GetByLabelOptions().setExact(true))).containsText(Travel_Request_Portal_Form_Constants.TRIP_INFORMATION_HEADER_TEXT);
assertThat(page.frameLocator("iframe[name=\"gsft_main\"]").getByRole(AriaRole.HEADING, new FrameLocator.GetByRoleOptions().setName(travelStartDate))).isVisible();
assertThat(page.frameLocator("iframe[name=\"gsft_main\"]").getByLabel("Variables form section")).containsText(travelStartDate);
page.frameLocator("iframe[name='gsft_main']").locator("#tabs2_section").getByText(Travel_Request_Portal_Form_Constants.VARIABLES_TAB).click();
page.frameLocator("iframe[name='gsft_main']").locator("//span[@aria-label='Trip Information']").scrollIntoViewIfNeeded();
assertThat(page.frameLocator("iframe[name='gsft_main']").getByLabel("Trip Information", new FrameLocator.GetByLabelOptions().setExact(true))).containsText(Travel_Request_Portal_Form_Constants.TRIP_INFORMATION_HEADER_TEXT);
assertThat(page.frameLocator("iframe[name='gsft_main']").getByRole(AriaRole.HEADING, new FrameLocator.GetByRoleOptions().setName(travelStartDate))).isVisible();
assertThat(page.frameLocator("iframe[name='gsft_main']").getByLabel("Variables form section")).containsText(travelStartDate);
CucumberLogUtils.playwrightScreenshot(page);
}

Expand All @@ -177,8 +188,8 @@ public static void the_field_will_map_to_the_travel_start_date_field_in_the_vari
* @param travelEndDate the value entered for the travel end date
*/
public static void the_field_will_map_to_the_travel_end_date_in_the_variables_section_of_the_ritm_in_nv(String travelEndDate) {
assertThat(page.frameLocator("iframe[name=\"gsft_main\"]").getByRole(AriaRole.HEADING, new FrameLocator.GetByRoleOptions().setName(travelEndDate))).isVisible();
assertThat(page.frameLocator("iframe[name=\"gsft_main\"]").getByLabel("Variables form section")).containsText(travelEndDate);
assertThat(page.frameLocator("iframe[name='gsft_main']").getByRole(AriaRole.HEADING, new FrameLocator.GetByRoleOptions().setName(travelEndDate))).isVisible();
assertThat(page.frameLocator("iframe[name='gsft_main']").getByLabel("Variables form section")).containsText(travelEndDate);
CucumberLogUtils.playwrightScreenshot(page);
}

Expand Down
Loading

0 comments on commit 044e753

Please sign in to comment.