Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… into Alena
  • Loading branch information
nekrashevicha2 committed Jan 3, 2025
2 parents 1950664 + e8d99f6 commit be51843
Show file tree
Hide file tree
Showing 8 changed files with 286 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,29 @@ Scenario: Edit contract assignments
And User clicks on ADD INVOICE Support Staff
And User types "Test COR" in Invoice Support Staff field
And User clicks on Test COR
Then User will click on SAVE button
Then User will click on SAVE button

@CreateContractMessage @NESARH2 @Regression @playwright
Scenario: Verify that a User can create a contract message
When User clicks on Contracts
And user selects "IT Commodities and Solutions" from the list of contracts
And User clicks on Contract Messages
And User clicks on NEW Message button
And User types TEST CONTRACT MESSAGE in the Subject line
And User types a text in the message body
And User clicks on Submit button
Then User verifies the submitted message contains "TEST CONTRACT MESSAGE"

@VendorContacts @NESARH2 @Regression @playwright
Scenario: Verify that a User can add vendor contacts to a contract
When User clicks on Contracts
And user selects "IT Commodities and Solutions" from the list of contracts
And User clicks on Vendor Contacts
And User clicks on ADD NEW button
And User types "Test" in First Name field
And User types "Manager" in Last Name field
And User types "[email protected]" in Email field
And User types "Manager" in Title field
And User types "111-222-3344" in Phone field
And User selects Business Representative from Contact Type
Then User clicks on SAVE button
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package CUSTOM_BUSINESS.Oasys.Pages;
package CUSTOM_BUSINESS.OASYS.Pages;

public class I_Trust_Page {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package CUSTOM_BUSINESS.Oasys.Steps;
package CUSTOM_BUSINESS.OASYS.Steps;

import APPS_COMMON.PlaywrightUtils.Playwright_Common_Utils;
import CUSTOM_BUSINESS.Oasys.StepsImplementation.Oasys_Steps_Implementation;
import CUSTOM_BUSINESS.OASYS.StepsImplementation.OASYS_Steps_Implementation;
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
import static com.nci.automation.web.PlaywrightUtils.page;
import com.microsoft.playwright.*;
import com.microsoft.playwright.options.*;
Expand All @@ -18,7 +19,7 @@ public class Contracts {
*/
@Given("User is logged in the application and navigated to Contract Administration")
public void user_is_logged_in_the_application_and_navigated_to_contract_administration() {
Oasys_Steps_Implementation.user_is_logged_in_oasys();
OASYS_Steps_Implementation.user_is_logged_in_oasys();
page.getByText("Contract Administrationkeyboard_arrow_down").click();
CucumberLogUtils.playwrightScreenshot(page);
}
Expand Down Expand Up @@ -175,4 +176,157 @@ public void user_will_click_on_save_button() {
page.locator("xpath=//span[contains(text(),'Save')]").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is clicking on Contract Messages
*/
@And("User clicks on Contract Messages")
public void user_clicks_on_contract_messages() {
page.locator("xpath=//div/mat-expansion-panel/mat-expansion-panel-header/span/mat-panel-title[contains(text(),'Contract Messages')]").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is clicking on NEW Message button
*/
@And("User clicks on NEW Message button")
public void user_clicks_on_new_message_button() {
page.locator("xpath=//div/div/button/span[contains(text(), ' New Message')]").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is typing TEST CONTRACT MESSAGE in the Subject line
*/
@And("User types TEST CONTRACT MESSAGE in the Subject line")
public void user_types_test_message_in_the_subject() {
page.locator("xpath=//div/input[@ng-reflect-name='Subject']").fill("TEST CONTRACT MESSAGE");
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is typing a text in the message body
*/
@And("User types a text in the message body")
public void user_types_a_text_in_message_body() {
page.locator("xpath=//div[@class='ql-editor ql-blank']").fill("*** THIS IS A TEST CONTRACT MESSAGE ***");
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is clicking on Submit button
*/
@And("User clicks on Submit button")
public void user_clicks_on_submit_button() {
page.locator("xpath=//mat-dialog-actions/button/span[contains(text(),'Submit')]").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is verifying the submitted message. It iterates through the list of messages and checks if the message with the expected subject line is present
* @param MessageSubject
*/
@Then("User verifies the submitted message contains {string}")
public void user_verifies_the_submitted_message(String MessageSubject) {
Locator contractMessages = page.locator("xpath=//div/div/div/div[@class='detail']");
boolean contractMessageFound = false;
for (int i = 0; i < contractMessages.count(); i++) {
if (contractMessages.nth(i).innerText().contains(MessageSubject)) {
contractMessageFound = true;
assertThat(contractMessages.nth(i)).containsText(MessageSubject);
break;
}
}
if (!contractMessageFound) {
throw new AssertionError("*** MESSAGE WITH SUBJECT LINE '" + MessageSubject + "' NOT FOUND.***");
}
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is clicking on Vendor Contacts
*/
@And("User clicks on Vendor Contacts")
public void user_clicks_on_vendor_contacts() {
page.locator("xpath=//mat-expansion-panel/mat-expansion-panel-header/span/mat-panel-title[contains(text(),'Vendor Contacts')]").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is clicking on ADD NEW button
*/
@And("User clicks on ADD NEW button")
public void user_clicks_on_add_new_button() {
page.locator("xpath=//div/button/span[contains(text(),'Add New')]").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is typing a text in the First Name field
* @param FirstName
*/
@And("User types {string} in First Name field")
public void user_types_in_first_name(String FirstName) {
page.locator("xpath=//div/input[@ng-reflect-placeholder='First Name *']").fill(FirstName);
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is typing a text in the Last Name field
* @param LastName
*/
@And("User types {string} in Last Name field")
public void user_types_in_last_name(String LastName) {
page.locator("xpath=//div/input[@ng-reflect-placeholder='Last Name *']").fill(LastName);
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is typing a text in the Email field
* @param Email
*/
@And("User types {string} in Email field")
public void user_types_in_email(String Email) {
page.locator("xpath=//div/input[@ng-reflect-placeholder='Email *']").fill(Email);
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is typing a text in the Title field
* @param Title
*/
@And("User types {string} in Title field")
public void user_types_manager_in_title(String Title) {
page.locator("xpath=//div/input[@ng-reflect-placeholder='Title *']").fill(Title);
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is typing a text in the Phone field
* @param Phone
*/
@And("User types {string} in Phone field")
public void user_types_in_phone(String Phone) {
page.locator("xpath=//div/input[@ng-reflect-placeholder='Phone *']").fill(Phone);
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting Business Representative from Contact Type
*/
@And("User selects Business Representative from Contact Type")
public void user_selects_business_representative_from_contact_type() {
page.locator("xpath=//div/mat-select[@ng-reflect-placeholder='Contact Type *']").click();
page.locator("xpath=//div/mat-option/span[contains(text(), 'Business Representative')]").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is clicking on SAVE button
*/
@Then("User clicks on SAVE button")
public void user_clicks_on_save_button() {
page.locator("xpath=//span[contains(text(),'Save')]").click();
CucumberLogUtils.playwrightScreenshot(page);
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package CUSTOM_BUSINESS.Oasys.StepsImplementation;
package CUSTOM_BUSINESS.OASYS.StepsImplementation;

import CUSTOM_BUSINESS.Oasys.Pages.I_Trust_Page;
import CUSTOM_BUSINESS.OASYS.Pages.I_Trust_Page;
import com.microsoft.playwright.Page;
import com.microsoft.playwright.options.AriaRole;
import com.nci.automation.utils.CucumberLogUtils;
import com.nci.automation.utils.EncryptionUtils;
import static com.nci.automation.web.PlaywrightUtils.page;
import static com.nci.automation.web.TestProperties.*;

public class Oasys_Steps_Implementation {
public class OASYS_Steps_Implementation {

/**
* User is logged into OASYS
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package CUSTOM_BUSINESS.OASYS.runners;

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

@CucumberOptions(plugin = {"html:target/OASYS-regression-reports/OASYS-regression-report.html", "json:target/cucumber.json",
"rerun:target/failed.txt",
"pretty", "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"}
, features = "src/test/java/CUSTOM_BUSINESS/OASYS/features"
, glue = {"CUSTOM_BUSINESS.OASYS.Steps", "Hooks"}
, tags = "@Regression"
, dryRun = false
)
public class RunOASYSRegressionTest extends AbstractTestNGCucumberTests{
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -428,4 +428,75 @@ public void the_field_will_not_be_required(String urlOfRegistrationSite) {
"-- VERIFY THAT 'URL of Registration Site' FIELD IS NOT REQUIRED WHEN 'No' IS SELECTED FOR REGISTRATION FEE FIELD --");
CucumberLogUtils.playwrightScreenshot(page);
}

/**
*
* Clicks the CBIIT Business Services menu item under the Services Tab.
*
* @param cbiitBusinessServices The name of the menu item under the category
* @param services The name of the category under which the menu item is located
*/
@When("I click the {string} menu item under {string}")
public void i_click_the_menu_item_under(String cbiitBusinessServices, String services) {
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName(services).setExact(true)).waitFor();
assertThat(page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName(services).setExact(true))).isVisible();
assertThat(page.locator("#fresponsive")).containsText(services);
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName(services).setExact(true)).click();
CucumberLogUtils.playwrightScreenshot(page);
assertThat(page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName(cbiitBusinessServices)).first()).isVisible();
assertThat(page.locator("#fresponsive")).containsText(cbiitBusinessServices);
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName(cbiitBusinessServices)).first().click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* Verifies if the "Travel Planning System" catalog item is available on the page.
*
* @param travelPlanningSystem The name of the catalog item to be verified for availability
*/
@Then("the catalog item {string} should be available")
public void the_catalog_item_should_be_available(String travelPlanningSystem) {
page.getByRole(AriaRole.MAIN).locator("a").filter(new Locator.FilterOptions().setHasText(travelPlanningSystem)).waitFor();
assertThat(page.getByRole(AriaRole.MAIN).locator("a").filter(new Locator.FilterOptions().setHasText(travelPlanningSystem))).isVisible();
assertThat(page.getByRole(AriaRole.MAIN)).containsText(travelPlanningSystem);
page.getByRole(AriaRole.MAIN).locator("a").filter(new Locator.FilterOptions().setHasText(travelPlanningSystem)).click();
CucumberLogUtils.playwrightScreenshot(page);

CucumberLogUtils.scenario.log("---- VERIFYING THE BREAD CRUMB ----");
page.locator("//a[@class='ng-binding ng-scope'][normalize-space()='CBIIT Business Services']").isVisible();
assertThat(page.locator("//a[@class='ng-binding ng-scope'][normalize-space()='CBIIT Business Services']")).containsText("CBIIT Business Services");
assertThat(page.getByLabel("Page breadcrumbs").getByText(travelPlanningSystem)).isVisible();
assertThat(page.getByLabel("Page breadcrumbs").getByRole(AriaRole.LIST)).containsText(travelPlanningSystem);
assertThat(page.locator("#catItemTop")).containsText(travelPlanningSystem);
page.locator("#catItemTop").getByRole(AriaRole.HEADING, new Locator.GetByRoleOptions().setName(travelPlanningSystem)).scrollIntoViewIfNeeded();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* Navigates to a Exceed Threshold field on the Travel Request Portal Form Page.
*
* @param exceedThreshold the text to be checked in the field
*/
@When("I navigate to field {string},")
public void i_navigate_to_field(String exceedThreshold) {
page.navigate(Travel_Request_Portal_Form_Constants.TRAVEL_PLANNING_SYSTEM_PORTAL_FORM_URL);
CucumberLogUtils.playwrightScreenshot(page);
page.locator("span").filter(new Locator.FilterOptions().setHasText(Pattern.compile("^Exceed Threshold\\?$"))).scrollIntoViewIfNeeded();
assertThat(page.locator("span").filter(new Locator.FilterOptions().setHasText(Pattern.compile("^Exceed Threshold\\?$")))).isVisible();
assertThat(page.locator("#exceed_threshold")).containsText(exceedThreshold);
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* Asserts that the help text displayed on the page matches the expected help text.
*
* @param helpText The expected help text to be displayed on the page
*/
@Then("I should see help text that states: {string}")
public void i_should_see_help_text_that_states(String helpText) {
page.locator("#exceed_threshold").scrollIntoViewIfNeeded();
assertThat(page.getByText("Select 'Yes' if total travel")).isVisible();
assertThat(page.locator("#exceed_threshold")).containsText(helpText);
CucumberLogUtils.playwrightScreenshot(page);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,16 @@ Feature: SNOWTRAVEL Portal Form Scenarios
Given I am a CGH User "Ann Chao"
And I am Completing a Travel Planning Request form,
When I select "No" for the "Registration Fees?" field
Then the "URL of Registration Site" field will not be required.
Then the "URL of Registration Site" field will not be required.

@SNOWTRAVEL-200 @Chaudhryma @Regression @playwright
Scenario: Test Travel Planning System Catalog Item is Not Appearing in test environments - Clone restoration confirmation
Given I am an authenticated DOC CGH Travel Request User "Dimetria Branch"
When I click the "CBIIT Business Services" menu item under "Services"
Then the catalog item "Travel Planning System" should be available

@SNOWTRAVEL-256 @Chaudhryma @Regression @playwright
Scenario: Test Help text for the "Exceed Threshold?" field in the Travel Planning Request Form
Given I am a CGH User "Ann Chao"
When I navigate to field "Exceed Threshold?",
Then I should see help text that states: "Select 'Yes' if total travel expenses are expected to exceed $5,000."

0 comments on commit be51843

Please sign in to comment.