generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'CE-314' of https://github.com/bcgov/nr-compliance-enfor…
…cement into CE-314
- Loading branch information
Showing
24 changed files
with
617 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Get Latest Merged PR Number | ||
description: Get the latest merged PR number from the release branch, this is the production candidate | ||
branding: | ||
icon: git-pull-request | ||
color: blue | ||
|
||
inputs: | ||
token: | ||
description: Specify token (GH or PAT), instead of inheriting one from the calling workflow | ||
default: ${{ github.token }} | ||
|
||
outputs: | ||
pr: | ||
description: "Latest merged pull request number" | ||
value: ${{ steps.vars.outputs.pr }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- id: vars | ||
shell: bash | ||
run: | | ||
git fetch origin | ||
release_branch="${{ github.event.pull_request.head.ref }}" | ||
echo "Detected release branch: $release_branch" | ||
latest_pr=$(git log origin/$release_branch --pretty=format:'%s' | grep -oP '(?<=#)\d+' | head -n 1) | ||
if [ -z "$latest_pr" ]; then | ||
echo "No merged PR found on $release_branch" | ||
exit 1 | ||
elif [[ ! "$latest_pr" =~ ^[0-9]+$ ]]; then | ||
echo "PR number format incorrect: $latest_pr" | ||
exit 1 | ||
fi | ||
echo "Latest PR number from $release_branch: $latest_pr" | ||
echo "pr=$latest_pr" >> $GITHUB_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-550 Bytes
(100%)
backend/templates/complaint/CDOGS-ERS-COMPLAINT-TEMPLATE-v1.docx
Binary file not shown.
Binary file modified
BIN
-322 Bytes
(100%)
backend/templates/complaint/CDOGS-HWCR-COMPLAINT-TEMPLATE-v1.docx
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
import COMPLAINT_TYPES from "../../src/app/types/app/complaint-types"; | ||
|
||
const complaintTypes = [COMPLAINT_TYPES.HWCR, COMPLAINT_TYPES.ERS]; | ||
|
||
describe("External File Reference", () => { | ||
beforeEach(function () { | ||
cy.viewport("macbook-16"); | ||
cy.kcLogout().kcLogin(); | ||
}); | ||
|
||
function enterReferenceNumber(number: string, shouldSave: boolean) { | ||
cy.get("#external-file-reference-number-input").click({ force: true }); | ||
cy.get("#external-file-reference-number-input").clear().type(number, { delay: 0 }); | ||
if (shouldSave) { | ||
cy.get("#external-file-reference-save-button").click(); | ||
} | ||
} | ||
|
||
function navigateToComplaint(index: number) { | ||
if (COMPLAINT_TYPES.HWCR.includes(complaintTypes[index])) { | ||
cy.navigateToDetailsScreen(COMPLAINT_TYPES.HWCR, "23-031226", true); | ||
} else { | ||
cy.navigateToDetailsScreen(COMPLAINT_TYPES.ERS, "23-027918", true); | ||
} | ||
} | ||
|
||
function deleteReferenceNumber() { | ||
cy.get("#external-file-reference").then(function ($externalref) { | ||
if ($externalref.find("#external-file-reference-delete-button").length) { | ||
cy.get("#external-file-reference-delete-button").click(); | ||
cy.get(".modal-footer > .btn-primary").click(); | ||
} else { | ||
cy.log("No reference number to delete"); | ||
} | ||
}); | ||
} | ||
|
||
function validateFormIsEmpty() { | ||
cy.get("#external-file-reference-number-input").should("exist"); | ||
cy.get("#external-file-reference-number-div").should(($div) => { | ||
expect($div).to.not.contain.text("111111"); | ||
expect($div).to.not.contain.text("222222"); | ||
expect($div).to.not.contain.text("333333"); | ||
}); | ||
} | ||
|
||
//Core tests - try these on both complaint types | ||
|
||
Cypress._.times(complaintTypes.length, (index) => { | ||
it(`Can enter an external reference number: ${complaintTypes[index]}`, () => { | ||
//navigatetoComplaint | ||
navigateToComplaint(index); | ||
|
||
//make sure that there isn't an old one there from a failed run | ||
deleteReferenceNumber(); | ||
|
||
//enter the number | ||
enterReferenceNumber("111111", true); | ||
|
||
//validate the number | ||
cy.get("#external-file-reference-number-div").should(($div) => { | ||
expect($div).to.contain.text("111111"); | ||
}); | ||
}); | ||
|
||
it(`Can edit an external reference number: ${complaintTypes[index]}`, () => { | ||
//navigatetoComplaint | ||
navigateToComplaint(index); | ||
|
||
//press Edit | ||
cy.get("#external-file-reference-edit-button").click(); | ||
|
||
//enter the number | ||
enterReferenceNumber("222222", true); | ||
|
||
//validate the number | ||
cy.get("#external-file-reference-number-div").should(($div) => { | ||
expect($div).to.contain.text("222222"); | ||
}); | ||
}); | ||
|
||
it(`Can delete an external reference number: ${complaintTypes[index]}`, () => { | ||
//navigatetoComplaint | ||
navigateToComplaint(index); | ||
|
||
//press Delete | ||
deleteReferenceNumber(); | ||
|
||
//validate the toast | ||
cy.get(".Toastify__toast-body").then(($toast) => { | ||
expect($toast).to.contain.text("Updates have been saved"); | ||
}); | ||
|
||
//validate that the empty input is showing | ||
validateFormIsEmpty(); | ||
}); | ||
}); | ||
|
||
//Secondary tests - only need to try these on one complaint type | ||
it("Can cancel pending changes to a reference file number (new)", () => { | ||
//navigatetoComplaint | ||
navigateToComplaint(0); | ||
|
||
//attempt to delete if there is old data | ||
deleteReferenceNumber(); | ||
|
||
//enter the number | ||
enterReferenceNumber("333333", false); | ||
|
||
cy.get("#external-file-reference").then(function ($externalref) { | ||
cy.get("#external-file-reference-cancel-button").click(); | ||
cy.get(".modal-footer > .btn-primary").click(); | ||
}); | ||
|
||
//validate that the empty input is showing | ||
validateFormIsEmpty(); | ||
}); | ||
|
||
it("Will not accept a reference file number with letters", () => { | ||
//navigatetoComplaint | ||
navigateToComplaint(1); | ||
|
||
//make sure that there isn't an old one there from a failed run | ||
deleteReferenceNumber(); | ||
|
||
//enter the number | ||
enterReferenceNumber("444BADNUMBER44", true); | ||
|
||
//validate the error message | ||
cy.hasErrorMessage(["#external-file-reference-number-div"]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.