Skip to content

Commit

Permalink
Merge pull request #371 from CBIIT/Nesarh2
Browse files Browse the repository at this point in the history
Import a contract and verify search filters
  • Loading branch information
Mariachaudhry authored Jan 17, 2025
2 parents d42b0c7 + 93ef575 commit 0b581ab
Show file tree
Hide file tree
Showing 3 changed files with 360 additions and 1 deletion.
41 changes: 40 additions & 1 deletion src/test/java/CUSTOM_BUSINESS/OASYS/Features/Contracts.feature
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,43 @@ Scenario: Verify that Test COR can not access All Contracts
And user selects "IT Commodities and Solutions" from the list of contracts
And User clicks on FILES tab
And User selects Testing Folder and clicks on DELETE icon
Then User clicks on DELETE button to confirm the deletion
Then User clicks on DELETE button to confirm the deletion

@ImportContract @NESARH2 @Regression @playwright
Scenario: Verify that a user can create a contract
When User clicks on Contracts
And User clicks on Import button on the contract page
And User clicks on Contract
And User types the Contract Number
And User selects a Vendor
And User clicks on Open to Correspondence
And User selects Non Severable for the Severability
And User selects "Yes" from the IT related dropdown
And User selects "No" from IDIQ
And User types the Project title
And User selects "No" from Conference Support
And User selects "Yes" from Government Oversight Required
And User selects "Not Applicable" from High Risk
And User selects "Core IT" from Excepted Contracts
And User selects "FFP" from Type of Contract
And User selects GSA for the Procurement Mechanism
And User selects "BPA Call" from Award Type
And User selects "NITAAC" from Internal Issuing Agency
And User selects "DoD" from External Issuing Agency
And User selects "Other" from Services Rendered for Federal Employees
And User selects "Yes" from Multiple Year
And User selects a date for Funded Through Date
And User selects "Yes" for Will funding need to be added for expected activities within the next three months?
And User selects "Yes" for Does the COR advise continued performance?
And User selects "Partial Stop Work" for What notice will be sent in the event of a shutdown?
And User will click on SAVE button
Then User verifies the contract header

@ContractSearchFilters @NESARH2 @Regression @playwright
Scenario: Using search filters to narrow down search results
When User clicks on Contracts
And User types "Dell EMC Isilon Hardware and Software Support and Maintenance" in the Contract Title field
And User selects "RUSSELL John" from the Staff Assignment dropdown on the contract page
And User selects Show inactive contracts
And User clicks on SEARCH button to search for defined contracts
Then User will verify if "Dell EMC Isilon Hardware and Software Support and Maintenance" is listed in the search results
317 changes: 317 additions & 0 deletions src/test/java/CUSTOM_BUSINESS/OASYS/Steps/Contracts.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import java.nio.file.Paths;
import java.util.regex.Pattern;

public class Contracts {

Expand Down Expand Up @@ -454,4 +455,320 @@ public void user_clicks_on_delete_button_to_confirm_the_deletion() {
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Delete")).click();
CucumberLogUtils.playwrightScreenshot(page);
}

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

/**
* This method is clicking on Contract from the dropdown
*/
@When("User clicks on Contract")
public void user_clicks_on_contract() {
page.locator("xpath=//div/button[contains(text(),' CONTRACT')]").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is passing the Contract Number
*/
@When("User types the Contract Number")
public void user_types_the_contract_number() {
page.locator("xpath=//div/input[@ng-reflect-placeholder='Contract Number *']").fill(OASYS_Constants.CONTRACT_HEADER);
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting a vendor from the dropdown
*/
@When("User selects a Vendor")
public void user_selects_a_vendor() {
page.locator("xpath=//div/input[@ng-reflect-placeholder='Type to Search...']").click();
page.locator("xpath=//div/input[@ng-reflect-placeholder='Type to Search...']").fill(OASYS_Constants.VENDOR);
page.locator("xpath=//span[contains(text(),'SWORD & SHIELD ENTERPRISE SECURITY INC')]").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is clicking on Open to Correspondence checkbox
*/
@When("User clicks on Open to Correspondence")
public void user_clicks_on_open_to_correspondence() {
page.getByText("Open to Correspondence").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting NonSeverable from the Severability dropdown
*/
@When("User selects Non Severable for the Severability")
public void user_selects_non_severable_for_the_severability() {
page.getByLabel("Severability").getByText("Severability").click();
page.getByText("Non Severable").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting Yes from the IT related dropdown
* @param Yes
*/
@When("User selects {string} from the IT related dropdown")
public void user_selects_from_the_it_related_dropdown(String Yes) {
page.getByLabel("IT Related *").getByText("IT Related *").click();
page.getByText(Yes, new Page.GetByTextOptions().setExact(true)).click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting No from the IDIQ dropdown
* @param No
*/
@When("User selects {string} from IDIQ")
public void user_selects_from_idiq(String No) {
page.getByLabel("IDIQ").getByText("IDIQ").click();
page.getByText(No, new Page.GetByTextOptions().setExact(true)).click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is inserting the Project title in the Project Title field
*/
@When("User types the Project title")
public void user_types_the_project_title() {
page.getByLabel("Project Title").click();
page.getByLabel("Project Title").fill(OASYS_Constants.PROJECT_TITLE);
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting No from the Conference Support dropdown
* @param No
*/
@When("User selects {string} from Conference Support")
public void user_selects_from_conference_support(String No) {
page.getByText("Conference SupportConference").click();
page.locator("xpath=//mat-option/span[normalize-space()='No']").click();
//page.getByText(No, new Page.GetByTextOptions().setExact(true)).click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting Yes from the Government Oversight Required dropdown
* @param Yes
*/
@When("User selects {string} from Government Oversight Required")
public void user_selects_from_government_oversight_required(String Yes) {
page.locator("compass-form").filter(new Locator.FilterOptions().setHasText("Open to")).click();
page.getByLabel("Government Oversight Required").getByText("Government Oversight Required").click();
page.getByRole(AriaRole.OPTION, new Page.GetByRoleOptions().setName(Yes)).locator("span").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting Not Applicable from the High Risk dropdown
* @param Not_Applicable
*/
@When("User selects {string} from High Risk")
public void user_selects_from_high_risk(String Not_Applicable) {
page.getByLabel("High Risk").getByText("High Risk").click();
page.getByText(Not_Applicable).click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting CoreIT from the Expected Contracts dropdown
* @param CoreIT
*/
@When("User selects {string} from Excepted Contracts")
public void user_selects_from_excepted_contracts(String CoreIT) {
page.getByLabel("Excepted Contracts").getByText("Excepted Contracts").click();
page.getByText(CoreIT).click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting FFP from the Type of Contract dropdown
* @param FFP
*/
@When("User selects {string} from Type of Contract")
public void user_selects_from_type_of_contract(String FFP) {
page.getByText("Type of ContractType of").click();
page.getByText(FFP).click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting Open Market for the Procurement Mechanism
*/
@When("User selects GSA for the Procurement Mechanism")
public void user_selects_gsa_for_the_procurement_mechanism() {
page.getByLabel("Procurment Mechanism *").getByText("Procurment Mechanism *").click();
page.getByText("GSA").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting BPA Call from the Award Type dropdown
* @param BPA_Call
*/
@When("User selects {string} from Award Type")
public void user_selects_from_award_type(String BPA_Call) {
page.getByLabel("Award Type").getByText("Award Type").click();
page.getByText(BPA_Call).click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting Other from the Internal Issuing Agency dropdown
* @param NITACC
*/
@When("User selects {string} from Internal Issuing Agency")
public void user_selects_from_internal_issuing_agency(String NITACC) {
page.getByText("Internal Issuing AgencyInternal Issuing Agency").click();
page.getByText(NITACC).click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting DoD from the External Issuing Agency dropdown
* @param DoD
*/
@When("User selects {string} from External Issuing Agency")
public void user_selects_from_external_issuing_agency(String DoD) {
page.getByText("External Issuing AgencyExternal Issuing Agency").click();
page.getByRole(AriaRole.OPTION, new Page.GetByRoleOptions().setName(DoD)).locator("span").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting Other from the Services Rendered for Federal Employees dropdown
* @param Other
*/
@When("User selects {string} from Services Rendered for Federal Employees")
public void user_selects_from_services_rendered_for_federal_employees(String Other) {
page.getByLabel("Services Rendered for Federal").click();
page.getByRole(AriaRole.OPTION, new Page.GetByRoleOptions().setName(Other)).locator("span").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting Yes from the Multiple Year dropdown
* @param Yes
*/
@When("User selects {string} from Multiple Year")
public void user_selects_from_multiple_year(String Yes) {
page.getByLabel("Multiple Year").getByText("Multiple Year").click();
page.locator("xpath=//mat-option/span[normalize-space()='" + Yes + "']").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting a date for Funded Through Date
*/
@When("User selects a date for Funded Through Date")
public void user_selects_a_date_for_funded_through_date() {
page.getByLabel("Funded Through Date").click();
page.getByLabel("Next month").click(new Locator.ClickOptions().setClickCount(9));
page.getByLabel("Next month").click();
page.getByText("24", new Page.GetByTextOptions().setExact(true)).click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting Yes for Will funding need to be added for expected activities within the next three months?
* @param Yes
*/
@When("User selects {string} for Will funding need to be added for expected activities within the next three months?")
public void user_selects_for_will_funding_need_to_be_added_for_expected_activities_within_the_next_three_months(String Yes) {
page.getByLabel("Will funding need to be added").getByText("Will funding need to be added").click();
page.getByRole(AriaRole.OPTION, new Page.GetByRoleOptions().setName(Yes)).locator("span").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting Yes for Does the COR advise continued performance?
* @param Yes
*/
@When("User selects {string} for Does the COR advise continued performance?")
public void user_selects_for_does_the_cor_advise_continued_performance(String Yes) {
page.getByLabel("Does the COR Advise Continued").getByText("Does the COR Advise Continued").click();
page.getByRole(AriaRole.OPTION, new Page.GetByRoleOptions().setName(Yes)).locator("span").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting Stop Work for What notice will be sent in the event of a shutdown?
* @param StopWork
*/
@When("User selects {string} 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(String StopWork) {
page.getByText("What notice will be sent in the event of a shutdown?What notice will be sent in").click();
page.getByText(StopWork, new Page.GetByTextOptions().setExact(true)).click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is verifying the Contract Header
*/
@Then("User verifies the contract header")
public void user_verifies_the_contract_header() {
assertThat(page.locator("xpath=(//div/div[@class='left-title-display']//div/span)[1]")).containsText(OASYS_Constants.CONTRACT_HEADER);
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is passing the Contract Title in the Contract Title field
* @param ContractTitle
*/
@And("User types {string} in the Contract Title field")
public void user_types_in_contract_title_field(String ContractTitle) {
page.getByLabel("Title").click();
page.getByLabel("Title").fill(ContractTitle);
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting the Contract Specialist from the Staff Assignment dropdown
* @param ContractSpecialist
*/
@And("User selects {string} from the Staff Assignment dropdown on the contract page")
public void user_selects_from_the_staff_assignment_dropdown_on_the_contract_page(String ContractSpecialist) {
page.locator("div").filter(new Locator.FilterOptions().setHasText(Pattern.compile("^Staff Assignment$"))).click();
page.getByRole(AriaRole.COMBOBOX, new Page.GetByRoleOptions().setName("Staff Assignment")).fill(ContractSpecialist);
page.getByText("(I) RUSSELL John (john.").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is selecting Inactive Contracts
*/
@And("User selects Show inactive contracts")
public void user_selects_show_inactive_contracts() {
page.locator(".mat-checkbox-inner-container").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is clicking on SEARCH button to search for defined contracts
*/
@And("User clicks on SEARCH button to search for defined contracts")
public void user_clicks_on_search_button_to_search_for_defined_contracts() {
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Search").setExact(true)).click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is verifying if the expected contract is listed in the search results
* @param ExpectedContractTile
*/
@Then("User will verify if {string} is listed in the search results")
public void user_will_verify_if_is_listed_in_the_search_results(String ExpectedContractTile) {
assertThat(page.locator("mat-row")).containsText(ExpectedContractTile);
CucumberLogUtils.playwrightScreenshot(page);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@

public class OASYS_Constants {
public static final String TEST_FILE_PATH = System.getProperty("user.dir") + "/src/test/java/CUSTOM_BUSINESS/OASYS/Resources/TESTDOCUMENT.pdf";
public static final String PROJECT_TITLE = "TEST CONTRACT IMPORT";
public static final String CONTRACT_HEADER = "HHSTESTN01500067W";
public static final String VENDOR = "SWORD & SHIELD ENTERPRISE";
}

0 comments on commit 0b581ab

Please sign in to comment.