Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OASYS - Void and Restore an invoice #394

Merged
merged 11 commits into from
Feb 10, 2025
57 changes: 57 additions & 0 deletions .github/workflows/CUSTOM BUSINESS (.NET) - OASYS Regression.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CUSTOM BUSINESS (.NET) - OASYS Regression

on:
schedule:
# This corresponds to 4:30 PM EST (9:30 PM UTC) from Monday to Friday
- cron: '30 21 * * MON-FRI'
workflow_dispatch:

jobs:
build:
runs-on: NCI-WINDOWS
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0

- name: Run OASYS Regression Tests
shell: cmd
run: mvn -B -q -Dtest=CUSTOM_BUSINESS.OASYS.runners.RunOASYSRegressionTest test
continue-on-error: true

- name: Generate timestamp
id: timestamp
shell: powershell
run: |
$timeZone = [System.TimeZoneInfo]::FindSystemTimeZoneById("Eastern Standard Time")
$dateTime = [System.TimeZoneInfo]::ConvertTime([System.DateTime]::UtcNow, $timeZone)
$timestamp = $dateTime.ToString("yyyy-MM-dd_hh-mm-ss_tt")
Add-Content -Path $env:GITHUB_ENV -Value "timestamp=$timestamp"

- name: Determine report path
id: reportpath
shell: cmd
run: echo "::set-output name=path::Oasys-regression-reports" >> $GITHUB_ENV

- name: Upload Cucumber Report
uses: actions/upload-artifact@v4
if: always()
with:
name: OASYS-regression-report-${{ env.timestamp }}
path: target/Oasys-regression-reports/*

- name: Upload to SharePoint
shell: powershell
run: |
$Env:PATH = "C:\Users\juarezds\AppData\Local\Programs\Python\Python312;$Env:PATH"
python $Env:GITHUB_WORKSPACE\.github\scripts\upload_to_sharepoint.py
env:
FILES_PATH: target/Egrants-regression-reports/*
SHAREPOINT_SITE_ID: ${{ secrets.SHAREPOINT_SITE_ID }}
SHAREPOINT_DRIVE_ID: ${{ secrets.SHAREPOINT_DRIVE_ID }}
tenant_id: ${{ secrets.SHAREPOINT_TENANT_ID }}
client_id: ${{ secrets.SHAREPOINT_CLIENT_ID }}
client_secret: ${{ secrets.SHAREPOINT_CLIENT_SECRET }}
timestamp: ${{ env.timestamp }}
UPLOAD_FOLDER: "Custom Business Applications - .NET/TEST AUTOMATION REPORTS/OASYS"
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Given User is logged in the application and is on the landing page
And selects Transition Approval as Subcategory
Then clicks on update icon to submit the changes

@EGRANTS-591 @ReplaceExistingFile @nesarh2 @selenium @Regression
@EGRANTS-591 @ReplaceExistingFile @nesarh2 @selenium @In-Progress
Scenario: Test replacing an existing file
And searches for grant "CA125123"
And selects grant year 18 from Years
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public class EgrantsSearchAndFileManagementScenariosPage {
/**
* Choose File - Replace Page
*/
@FindBy(xpath = "//input[@id='customFile']")
@FindBy(xpath = "//label[normalize-space()='Choose file...']")
public WebElement replaceFile;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ public void clicks_on_uploaded_document() {
*/
@When("selects grant year 18 from Years")
public void selects_year_18() {
CommonUtils.clickOnElement(egrantsSearchandFileManagementScenariosPage.year18);
CommonUtils.clickOnElement(egrantsSearchandFileManagementScenariosPage.expandAllGrantYearsButton);
CommonUtils.sleep(500);
CommonUtils.clickOnElement(egrantsSearchandFileManagementScenariosPage.grantYear18);
CommonUtils.sleep(2000);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,27 @@ Scenario: Assign Additional Reviewers for the submitted invoice
And User selects "Test Manager" as Final Approver for the invoice
And User clicks on ADD ADDITIONAL REVIEWERS button
And User selects "Test CS2" as Additional Reviewer for the invoice
Then User clicks on Save button
Then User clicks on Save button

@VoidInvoice @NESARH2 @Regression @playwright
Scenario: Voiding an invoice
When User clicks on Invoice
And User clicks on an invoice in Submitted status
And User clicks on VOID INVOICE button
And User selects Duplicate Invoice as the reason from the drop down
Then User clicks on Void button

@VoidingReviewedInvoice @NESARH2 @Regression @playwright
Scenario: Verify the user can not void a reviewed invoice
When User clicks on Invoice
And User clicks on the reviewed Invoice
And User verifies the invoice status
Then User tries to click on Void button

@RestoreInvoice @NESARH2 @Regression @playwright
Scenario: Restoring an invoice
When User clicks on Invoice
And User clicks on the voided invoice
And User clicks on RESTORE INVOICE button
And User clicks on Continue button to acknowledge the message
Then User verifies the invoice status is changed to "SUBMITTED"
2 changes: 1 addition & 1 deletion src/test/java/CUSTOM_BUSINESS/OASYS/Steps/Contracts.java
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ public void user_will_click_on_export_search_result_button() {
public void a_user_with_test_cor_logs_in_the_application() {
page.navigate(OASYS_Constants.OASYS_SIDE_LOGIN);
page.getByLabel("UserName").click();
page.getByLabel("UserName").fill(OASYS_Constants.OASYS_TEST_USERNAME);
page.getByLabel("UserName").fill(OASYS_Constants.OASYS_TEST_COR);
page.getByLabel("Password").click();
page.getByLabel("Password").fill(OASYS_Constants.OASYS_TEST_PASSWORD);
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Login")).click();
Expand Down
109 changes: 109 additions & 0 deletions src/test/java/CUSTOM_BUSINESS/OASYS/Steps/Invoice_Page.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,113 @@ public void user_clicks_on_save_button() {
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Save")).click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is used to click on an invoice in Submitted status
*/
@And("User clicks on an invoice in Submitted status")
public void user_clicks_on_an_invoice_in_submitted_status() {
page.getByText("PLEASE DO NOT DELETE").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is used to click on the VOID INVOICE button
*/
@And("User clicks on VOID INVOICE button")
public void user_clicks_on_void_invoice_button() {
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Void Invoice").setExact(true)).click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is used to select the reason for voiding the invoice
*/
@And("User selects Duplicate Invoice as the reason from the drop down")
public void user_selects_duplicate_invoice_as_the_reason_from_the_drop_down() {
page.getByLabel("Select Void Reason").locator("span").click();
page.locator("xpath=//span[normalize-space()='Duplicate invoice']").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is used to click on the Void button
*/
@Then("User clicks on Void button")
public void user_clicks_on_void_button() {
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Void")).click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is used to click on the invoice in voided status
*/
@And("User clicks on the reviewed Invoice")
public void user_clicks_on_the_reviewed_invoice() {
page.getByText("PLEASE DO NOT DELETE").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is used to verify the invoice status
*/
@And("User verifies the invoice status")
public void user_verifies_the_invoice_status() {
String actualStatus = page.locator("dynamic-detail-header").innerText();
if (!actualStatus.contains("VOIDED")) {
System.out.println("*** ACTUAL STATUS: " + actualStatus + " ***");
}
assertThat(page.locator("dynamic-detail-header")).containsText("VOIDED");
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is used to click on the VOID INVOICE button when the invoice is in voided status
*/
@Then("User tries to click on Void button")
public void user_tries_to_click_on_void_button() {
boolean isVoidInvoiceButtonVisible = page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Void Invoice").setExact(true)).isVisible();
if (isVoidInvoiceButtonVisible) {
System.out.println("*** THE INVOICE IS NOT IN VOIDED STATUS ***");
}
assertThat(page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Void Invoice").setExact(true))).isHidden();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is used to click the voided invoice
*/
@And("User clicks on the voided invoice")
public void user_clicks_on_the_voided_invoice() {
page.getByText("PLEASE DO NOT DELETE").click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is used to click on the RESTORE INVOICE button
*/
@And("User clicks on RESTORE INVOICE button")
public void user_clicks_on_restore_invoice_button() {
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Restore Invoice").setExact(true)).click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is used to acknowledge the message by clicking on the Continue button
*/
@And("User clicks on Continue button to acknowledge the message")
public void user_clicks_on_continue_button_to_acknowledge_the_message() {
assertThat(page.locator("restore-invoice-dialog")).containsText("Are you sure you want to restore this invoice?");
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Continue")).click();
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* This method is used to verify the invoice status is changed to Submitted
*/
@Then("User verifies the invoice status is changed to {string}")
public void user_verifies_the_invoice_status_is_changed_to_submitted(String Status) {
assertThat(page.locator("dynamic-detail-header")).containsText(Status);
CucumberLogUtils.playwrightScreenshot(page);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class OASYS_Constants {
public static final String ASSIGNED_CS = "CS: CS1, Test";
public static final String ASSIGNED_COR = "COR: COR, Test";
public static final String OASYS_SIDE_LOGIN = "https://oasys-qa.cancer.gov/#/login";
public static final String OASYS_TEST_USERNAME = "COR";
public static final String OASYS_TEST_COR = "COR";
public static final String OASYS_TEST_PASSWORD = "a";
public static final String INVOICE_NUMBER = "INV-TEST001";
public static final String INVOICE_STATUS = "SUBMITTED";
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-progression-reports/OASYS-progression-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 = "@Progression"
, dryRun = false
)
public class RunOASYSProgressionTest extends AbstractTestNGCucumberTests{
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
, dryRun = false
)
public class RunOASYSRegressionTest extends AbstractTestNGCucumberTests{
}
}
15 changes: 15 additions & 0 deletions src/test/java/CUSTOM_BUSINESS/OASYS/runners/RunOASYSSmokeTest.java
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-smoke-reports/OASYS-smoke-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 = "@Smoke"
, dryRun = false
)
public class RunOASYSSmokeTest extends AbstractTestNGCucumberTests{
}