Skip to content

Commit

Permalink
Merge pull request #351 from CBIIT/Nesarh2
Browse files Browse the repository at this point in the history
OASYS - Edit contract information and assignment
  • Loading branch information
Mariachaudhry authored Dec 20, 2024
2 parents f9d32b8 + aa5a7a6 commit 1314fe8
Show file tree
Hide file tree
Showing 8 changed files with 279 additions and 2 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +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/ServiceNow/ESR/Playwright/Steps/Example.java
*/Steps/Example.java
19 changes: 19 additions & 0 deletions src/main/java/com/nci/automation/web/TestProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ public class TestProperties {
public static final String E_GRANTS_STAGE_URL = "https://egrants-web-stage.nci.nih.gov/";
public static String E_GRANTS_URL;

/**
* OASYS URLS
*/
public static final String OASYS_TEST_URL = "https://oasys-qa.cancer.gov/#/";
public static final String OASYS_STAGE_URL = "https://oasys-stage.cancer.gov/#/";
public static String OASYS_URL;

/**
* COMETS ANALYTICS URLS
*/
Expand Down Expand Up @@ -449,6 +456,18 @@ public static String getEGrantsUrl() {
return E_GRANTS_URL;
}

public static String getOasysUrl() {
switch (ENV.toLowerCase()) {
case "stage":
OASYS_URL = OASYS_STAGE_URL;
break;
case "test":
OASYS_URL = OASYS_TEST_URL;
break;
}
return OASYS_URL;
}

public static String getCometsAnalyticsUrl() {
switch (ENV.toLowerCase()) {
case "stage":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Feature: This Feature File contains Quick Link, logged in user verifications and
And the IC Coordinator provides the Email Address
And the IC Coordinator provides access to Management and Dashboard tabs
And the IC Coordinator selects Program Staff as the Role
And the IC Coordinator selects "Qaulity, Associates" as the Coordinator
And the IC Coordinator selects "Quality, Associates" as the Coordinator
Then the IC Coordinator clicks on Add New button to confirm adding the new user

@AddExistingUser @nesarh2 @selenium @Regression @EGRANTS-586
Expand Down
28 changes: 28 additions & 0 deletions src/test/java/CUSTOM_BUSINESS/Oasys/Features/Contracts.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Feature: Contract Flow

Background: common steps
Given User is logged in the application and navigated to Contract Administration

@ContractInformation @NESARH2 @Regression @playwright
Scenario: Edit contract information
When User clicks on Contracts
And user selects "IT Commodities and Solutions" from the list of contracts
And user clicks on Edit Contract Information button
And user changes the Severability to Severable
And User selects Yes from the IT related dropdown
And User selects Open Market for the Procurement Mechanism
And User selects No for Will funding need to be added for expected activities within the next three months?
And User selects No for Does the COR advise continued performance?
And User selects Stop Work for What notice will be sent in the event of a shutdown?
Then User clicks on Save button to confirm the changes

@EditContractAssignments @NESARH2 @Regression @playwright
Scenario: Edit contract assignments
When User clicks on Contracts
And user selects "IT Commodities and Solutions" from the list of contracts
And User clicks on Assignments
And User clicks on Edit button
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
14 changes: 14 additions & 0 deletions src/test/java/CUSTOM_BUSINESS/Oasys/Pages/I_Trust_Page.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package CUSTOM_BUSINESS.Oasys.Pages;

public class I_Trust_Page {

/**
* USERNAME TEXT BOX
*/
public static String usernameTextBox = "#USER";

/**
* PASSWORD TEXT BOX
*/
public static String passwordTextBox = "#PASSWORD";
}
178 changes: 178 additions & 0 deletions src/test/java/CUSTOM_BUSINESS/Oasys/Steps/Contracts.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
package CUSTOM_BUSINESS.Oasys.Steps;

import APPS_COMMON.PlaywrightUtils.Playwright_Common_Utils;
import CUSTOM_BUSINESS.Oasys.StepsImplementation.Oasys_Steps_Implementation;
import static com.nci.automation.web.PlaywrightUtils.page;
import com.microsoft.playwright.*;
import com.microsoft.playwright.options.*;
import com.nci.automation.utils.CucumberLogUtils;
import io.cucumber.java.en.And;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;

public class Contracts {

/**
* This method is logging in the application and navigating to Contract Administration
*/
@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();
page.getByText("Contract Administrationkeyboard_arrow_down").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is navigating to Contracts page
*/
@When("User clicks on Contracts")
public void user_clicks_on_contracts() {
page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("Contract").setExact(true)).click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting a contract from the list of contracts
* @param ITcommodities
*/
@And("user selects {string} from the list of contracts")
public void user_selects_from_the_list_of_contracts(String ITcommodities) {
page.getByRole(AriaRole.ROW, new Page.GetByRoleOptions().setName("IT Commodities and Solutions HHSN316201500067W Other SWORD & SHIELD ENTERPRISE")).locator("div").first().click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is clicking on Edit Contract Information button
*/
@And("user clicks on Edit Contract Information button")
public void user_clicks_on_edit_contract_information_button() {
page.getByRole(AriaRole.REGION, new Page.GetByRoleOptions().setName("Contract Information")).getByRole(AriaRole.BUTTON).click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is changing the Severability to Severable
*/
@And("user changes the Severability to Severable")
public void user_changes_the_severability_to_severable() {
page.locator("xpath=//div/mat-select[@ng-reflect-placeholder='Severability']").click();
page.locator("xpath=//span[@class='mat-option-text'][normalize-space()='Severable']").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting Yes from the IT related dropdown
*/
@And("User selects Yes from the IT related dropdown")
public void user_selects_from_the_it_related_dropdown() {
page.locator("xpath=//div/mat-select[@ng-reflect-placeholder='IT Related *']").click();
page.locator("xpath=//mat-option/span[contains(text(),'Yes')]").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting Open Market for the Procurement Mechanism
*/
@And("User selects Open Market for the Procurement Mechanism")
public void user_selects_for_the_procurement_mechanism() {
page.locator("xpath=//div/mat-select[@ng-reflect-placeholder='Procurment Mechanism *']").click();
page.locator("xpath=//mat-option/span[contains(text(),'Open Market')]").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting No for Will funding need to be added for expected activities within the next three months?
*/
@When("User selects No for Will funding need to be added for expected activities within the next three months?")
public void user_selects_No_for_will_funding_need_to_be_added_for_expected_activities_within_the_next_three_months() {
page.locator("xpath=//div/mat-select[@ng-reflect-placeholder='Will funding need to be added ']").click();
page.locator("xpath=//mat-option/span[contains(text(),'No')]").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting No for Does the COR advise continued performance?
*/
@And("User selects No for Does the COR advise continued performance?")
public void user_selects_for_does_the_cor_advise_continued_performance() {
page.locator("xpath=//div/mat-select[@ng-reflect-placeholder='Does the COR Advise Continued ']").click();
page.locator("xpath=//mat-option/span[contains(text(),'No')]").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting Stop Work for What notice will be sent in the event of a shutdown?
*/
@When("User selects Stop Work for What notice will be sent in the event of a shutdown?")
public void user_selects_for_what_notice_will_be_sent_in_the_event_of_a_shutdown() {
page.locator("xpath=//div/mat-select[@ng-reflect-placeholder='What notice will be sent in th']").click();
page.locator("xpath=//span[@class='mat-option-text'][normalize-space()='Stop Work']").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is saving the changes made to the contract
*/
@Then("User clicks on Save button to confirm the changes")
public void user_clicks_on_save_button_to_confirm_the_changes() {
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Save")).click();
CucumberLogUtils.playwrightScreenshot(page);
}

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

/**
* This method is clicking on Edit button
*/
@When("User clicks on Edit button")
public void user_clicks_on_edit_button() {
page.locator("xpath=(//div/div/button/span[contains(text(), 'Edit')])[4]").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is clicking on Add Invoice Support Staff
*/
@When("User clicks on ADD INVOICE Support Staff")
public void user_clicks_on_add_invoice_support_staff() {
page.locator("xpath=//div/input[@ng-reflect-placeholder='Add Invoice Support Staff']").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is typing Test COR in Invoice Support Staff field
* @param TestCor
*/
@When("User types {string} in Invoice Support Staff field")
public void user_types_in_invoice_support_staff_field(String TestCor) {
page.locator("xpath=//div/input[@ng-reflect-placeholder='Add Invoice Support Staff']").fill(TestCor);
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is clicking on Test COR
*/
@When("User clicks on Test COR")
public void user_clicks_on_test_cor() {
page.locator("//span[contains(text(),'Test COR')]").click();
CucumberLogUtils.playwrightScreenshot(page);
}

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

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 {

/**
* User is logged into OASYS
*/
public static void user_is_logged_in_oasys() {
page.navigate(getOasysUrl());
page.locator(I_Trust_Page.usernameTextBox).fill(I_TRUST_USERNAME);
page.locator(I_Trust_Page.passwordTextBox).fill(EncryptionUtils.decrypt(I_TRUST_PASSWORD));
page.locator(I_Trust_Page.passwordTextBox).press("Enter");
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("ACCEPT")).click();
CucumberLogUtils.playwrightScreenshot(page);
}
}
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{
}

0 comments on commit 1314fe8

Please sign in to comment.