diff --git a/.github/workflows/CUSTOM BUSINESS (.NET) - OASYS Regression.yml b/.github/workflows/CUSTOM BUSINESS (.NET) - OASYS Regression.yml new file mode 100644 index 000000000..9bb81c482 --- /dev/null +++ b/.github/workflows/CUSTOM BUSINESS (.NET) - OASYS Regression.yml @@ -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" \ No newline at end of file diff --git a/src/test/java/CUSTOM_BUSINESS/Egrants/features/EgrantsSearchAndFileManagementScenarios.feature b/src/test/java/CUSTOM_BUSINESS/Egrants/features/EgrantsSearchAndFileManagementScenarios.feature index 0a841a3f4..96f9dd1cc 100644 --- a/src/test/java/CUSTOM_BUSINESS/Egrants/features/EgrantsSearchAndFileManagementScenarios.feature +++ b/src/test/java/CUSTOM_BUSINESS/Egrants/features/EgrantsSearchAndFileManagementScenarios.feature @@ -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 diff --git a/src/test/java/CUSTOM_BUSINESS/Egrants/pages/EgrantsSearchAndFileManagementScenariosPage.java b/src/test/java/CUSTOM_BUSINESS/Egrants/pages/EgrantsSearchAndFileManagementScenariosPage.java index adc584dcf..590127f86 100644 --- a/src/test/java/CUSTOM_BUSINESS/Egrants/pages/EgrantsSearchAndFileManagementScenariosPage.java +++ b/src/test/java/CUSTOM_BUSINESS/Egrants/pages/EgrantsSearchAndFileManagementScenariosPage.java @@ -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; /** diff --git a/src/test/java/CUSTOM_BUSINESS/Egrants/steps/EgrantsSearchAndFileManagementSteps.java b/src/test/java/CUSTOM_BUSINESS/Egrants/steps/EgrantsSearchAndFileManagementSteps.java index d4a4245bb..4cf072d65 100644 --- a/src/test/java/CUSTOM_BUSINESS/Egrants/steps/EgrantsSearchAndFileManagementSteps.java +++ b/src/test/java/CUSTOM_BUSINESS/Egrants/steps/EgrantsSearchAndFileManagementSteps.java @@ -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); } diff --git a/src/test/java/CUSTOM_BUSINESS/OASYS/Features/Invoice_Page.feature b/src/test/java/CUSTOM_BUSINESS/OASYS/Features/Invoice_Page.feature index d1959c2f7..417ffe792 100644 --- a/src/test/java/CUSTOM_BUSINESS/OASYS/Features/Invoice_Page.feature +++ b/src/test/java/CUSTOM_BUSINESS/OASYS/Features/Invoice_Page.feature @@ -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 \ No newline at end of file + 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" \ No newline at end of file diff --git a/src/test/java/CUSTOM_BUSINESS/OASYS/Steps/Contracts.java b/src/test/java/CUSTOM_BUSINESS/OASYS/Steps/Contracts.java index 7931f8ed2..68c5cfc9b 100644 --- a/src/test/java/CUSTOM_BUSINESS/OASYS/Steps/Contracts.java +++ b/src/test/java/CUSTOM_BUSINESS/OASYS/Steps/Contracts.java @@ -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(); diff --git a/src/test/java/CUSTOM_BUSINESS/OASYS/Steps/Invoice_Page.java b/src/test/java/CUSTOM_BUSINESS/OASYS/Steps/Invoice_Page.java index aaa949d33..09887ca4a 100644 --- a/src/test/java/CUSTOM_BUSINESS/OASYS/Steps/Invoice_Page.java +++ b/src/test/java/CUSTOM_BUSINESS/OASYS/Steps/Invoice_Page.java @@ -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); + } } \ No newline at end of file diff --git a/src/test/java/CUSTOM_BUSINESS/OASYS/Utils/OASYS_Constants.java b/src/test/java/CUSTOM_BUSINESS/OASYS/Utils/OASYS_Constants.java index 668cb4288..bb1e9a9f1 100644 --- a/src/test/java/CUSTOM_BUSINESS/OASYS/Utils/OASYS_Constants.java +++ b/src/test/java/CUSTOM_BUSINESS/OASYS/Utils/OASYS_Constants.java @@ -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"; diff --git a/src/test/java/CUSTOM_BUSINESS/OASYS/runners/RunOASYSProgressionTest.java b/src/test/java/CUSTOM_BUSINESS/OASYS/runners/RunOASYSProgressionTest.java new file mode 100644 index 000000000..652de6370 --- /dev/null +++ b/src/test/java/CUSTOM_BUSINESS/OASYS/runners/RunOASYSProgressionTest.java @@ -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{ +} \ No newline at end of file diff --git a/src/test/java/CUSTOM_BUSINESS/OASYS/runners/RunOASYSRegressionTest.java b/src/test/java/CUSTOM_BUSINESS/OASYS/runners/RunOASYSRegressionTest.java index e011d1949..c89f18573 100644 --- a/src/test/java/CUSTOM_BUSINESS/OASYS/runners/RunOASYSRegressionTest.java +++ b/src/test/java/CUSTOM_BUSINESS/OASYS/runners/RunOASYSRegressionTest.java @@ -12,4 +12,4 @@ , dryRun = false ) public class RunOASYSRegressionTest extends AbstractTestNGCucumberTests{ -} +} \ No newline at end of file diff --git a/src/test/java/CUSTOM_BUSINESS/OASYS/runners/RunOASYSSmokeTest.java b/src/test/java/CUSTOM_BUSINESS/OASYS/runners/RunOASYSSmokeTest.java new file mode 100644 index 000000000..ef46ff8bb --- /dev/null +++ b/src/test/java/CUSTOM_BUSINESS/OASYS/runners/RunOASYSSmokeTest.java @@ -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{ +} \ No newline at end of file