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

fix: small adjustments #1051

Merged
merged 10 commits into from
Jul 26, 2024
2 changes: 2 additions & 0 deletions backend/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ ca:
- X-User-Businessid
- x-total-count
- X-Total-Count
- x-client-id
- X-Client-Id
methods:
- OPTIONS
- GET
Expand Down
12 changes: 7 additions & 5 deletions backend/src/main/resources/templates/approval.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@
</p>
<div>&nbsp;</div>

<p>
If you need to contact us before then please contact the ${business.districtName} at
<a href="mailto:${business.districtEmail}">${business.districtEmail}.</a>
</p>
<div>&nbsp;</div>
<#if business.districtEmail?has_content>
<p>
If you need to contact us before then please contact the ${business.districtName} at
<a href="mailto:${business.districtEmail}">${business.districtEmail}.</a>
</p>
<div>&nbsp;</div>
</#if>

<p>Thank you,</p>
<p>The Forests Client Management System</p>
Expand Down
12 changes: 7 additions & 5 deletions backend/src/main/resources/templates/registration.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@
you provided.</p>
<div>&nbsp;</div>

<p>
If you need to contact us before then please contact the ${districtName} at
<a href="mailto:${districtEmail}">${districtEmail}.</a>
</p>
<div>&nbsp;</div>
<#if districtEmail?has_content>
<p>
If you need to contact us before then please contact the ${districtName} at
<a href="mailto:${districtEmail}">${districtEmail}.</a>
</p>
<div>&nbsp;</div>
</#if>

<p>Thank you,</p>
<p>The Forests Client Management System Team</p>
Expand Down
12 changes: 7 additions & 5 deletions backend/src/main/resources/templates/rejection.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@
</p>
<div>&nbsp;</div>

<p>
If you need to contact us before then please contact the ${business.districtName} at
<a href="mailto:${business.districtEmail}">${business.districtEmail}.</a>
</p>
<div>&nbsp;</div>
<#if business.districtEmail?has_content>
<p>
If you need to contact us before then please contact the ${business.districtName} at
<a href="mailto:${business.districtEmail}">${business.districtEmail}.</a>
</p>
<div>&nbsp;</div>
</#if>

<p>Thank you,</p>
<p>The Forests Client Management System Team</p>
Expand Down
58 changes: 37 additions & 21 deletions frontend/cypress/e2e/FormBCSCPage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,61 @@
import type { StaticResponse } from "../../node_modules/cypress/types/net-stubbing";
import { delay } from "cypress/types/bluebird";

/* eslint-disable no-undef */
describe("BCSC Form", () => {
const defaultSubmitResponse = {
statusCode: 201,
headers: {
location: "http://localhost:8080/api/clients/submissions/1",
"x-sub-id": "123456",

const submitResponse = {
"success":{
statusCode: 201,
body: {},
headers: {
location: "http://localhost:3000/clients/submissions/1",
"Access-Control-Expose-Headers": "x-sub-count, location",
"x-sub-id": "123456",
},
delay: 1000,
},
"failure": {
statusCode: 400,
body: [],
headers: {},
delay: 1000,
},
delay: 150,
};
let submitResponse: StaticResponse = structuredClone(defaultSubmitResponse);

beforeEach(() => {
submitResponse = structuredClone(defaultSubmitResponse);
beforeEach(function(){

cy.intercept("GET", "/api/codes/districts?page=0&size=250", {
cy.intercept("GET", "**/api/codes/districts?page=0&size=250", {
fixture: "districts.json",
}).as("getDistricts");

cy.intercept("http://localhost:8080/api/clients/name/*", {
cy.intercept("**/api/clients/name/*", {
fixture: "business.json",
}).as("searchCompany");

cy.intercept("GET", "/api/clients/XX9016140", {
cy.intercept("GET", "**/api/clients/XX9016140", {
fixture: "example.json",
}).as("selectCompany");

cy.intercept("GET", "/api/codes/countries/CA",{
cy.intercept("GET", "**/api/codes/countries/CA",{
fixture: "countryCodeCA.json",
}).as("getCanadaByCode");

cy.intercept("POST", "/api/clients/submissions", (req) => {
req.reply(submitResponse);
const response = this.currentTest.title.endsWith("failure") ? submitResponse.failure : submitResponse.success;

cy.intercept("POST", "**/api/clients/submissions",function(req) {
req.reply(response);
}).as("submitForm");

cy.intercept("GET", "**/api/clients/individual/**", {
statusCode: 200,
body: {},
}).as("getIndividual");

cy.intercept("GET", "**/api/codes/contact-types?page=0&size=250", {
statusCode: 200,
body: [{"code":"P","name":"Person"}],
}).as("getContactTypes");

cy.visit("/");
cy.wait(500);

Expand All @@ -45,7 +66,6 @@ describe("BCSC Form", () => {
"Create and manage client accounts"
);


cy.login("[email protected]", "Uat Test", "ca.bc.gov.flnr.fam.dev",
{
address: {
Expand Down Expand Up @@ -97,10 +117,6 @@ describe("BCSC Form", () => {
});

describe("when submission fails", () => {
beforeEach(() => {
submitResponse.statusCode = 400;
submitResponse.body = [];
});
it("should disable the Submit button after clicked, then re-enable it after the failure", () => {
cy.get("#district").find("[part='trigger-button']").click();

Expand Down
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/FormStaffPage.Submission.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ describe("Staff Form Submission", () => {
cy.get("[data-test='wizard-submit-button']").click();
cy.wait("@submitForm").then((interception) => {
cy.wait(5000);
cy.get("h1").should("contain", "Submission still being processed!");
cy.get("h1").should("contain", "This submission is being processed");
cy.get("cds-button[href='/submissions/4444']").should("exist");
});

Expand Down
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/SubmissionReviewPage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ describe("Submission Review Page", () => {
.should("exist")
.should(
"contain",
"It may take a few minutes. Once completed, this page will be automatically updated and the client number will be shown in the \"Client Sumarry\" below."
"It may take a few minutes. Once completed, the client number will display in the \Client summary\” section below."
);

cy.wait(10000);
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/components/forms/TextInputComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const revalidateBus = useEventBus<void>("revalidate-bus");
* @param errorMessage - the error message
*/
const setError = (errorMessage: string | undefined) => {
error.value = errorMessage ?? "";
error.value = errorMessage || "";

/*
The error should be emitted whenever it is found, instead of watching and emitting only when it
Expand Down Expand Up @@ -94,17 +94,17 @@ watch([selectedValue], () => {
});

//We call all the validations
const validateInput = (newValue: string) => {
const validateInput = (newValue: string) => {
if (props.validations) {
setError(
props.validations
.map((validation) => validation(newValue))
.map((validation) => validation(newValue))
.filter((errorMessage) => {
if (errorMessage) return true;
return false;
})
})
.reduce(
(acc, errorMessage) => acc ?? errorMessage,
(acc, errorMessage) => acc || errorMessage,
props.errorMessage,
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useFetchTo } from "@/composables/useFetch";
import type { CodeNameType, BusinessSearchResult } from "@/dto/CommonTypesDto";
import type { Address } from "@/dto/ApplyClientNumberDto";
// Validators
import { getValidations } from "@/helpers/validators/GlobalValidators";
import { getValidations } from "@/helpers/validators/BCeIDFormValidations";
import { submissionValidation } from "@/helpers/validators/SubmissionValidators";
// @ts-ignore
import Delete16 from "@carbon/icons-vue/es/trash-can/16";
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/helpers/validators/BCeIDFormValidations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ export const addValidation = (
if (!formFieldValidations[key]) formFieldValidations[key] = [];
formFieldValidations[key].push(validation);
};

export const getValidations = (key: string): ((value: any) => string)[] =>
key ? formFieldValidations[key] || [] : [];
6 changes: 3 additions & 3 deletions frontend/src/pages/FormStaffProcessingPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ const SVG = useSvg(badgePictogram);
<div class="frame-03" role="status">
<SVG alt="Badge pictogram" class="submission-badge" role="presentation"></SVG>
<div class="form-header form-header-application-submitted">
<h1 class="fluid-heading-04">Submission still being processed!</h1>
<h1 class="fluid-heading-04">This submission is being processed</h1>
<p class="fluid-paragraph-01">
We’ll send the client number and details submitted to <strong>{{ clientEmail }}</strong> once the submission is complete.
We’ll send the client number and submission details to <strong>{{ clientEmail }}</strong> when the process is complete.
</p>
<div class="form-footer-group-buttons">
<cds-button
kind="tertiary"
:href="`/submissions/${submissionId}`"
size="field">
<span>Track submission</span>
<span>Track this submission</span>
</cds-button>
<cds-button
kind="primary"
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/SubmissionReviewPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,11 @@ const isProcessing = computed(() => {
hide-close-button="true"
open="true"
kind="warning"
title="Submission is being processed"
title="This submission is being processed"
>
<div>
<p>
It may take a few minutes. Once completed, this page will be automatically updated and the client number will be shown in the "Client Sumarry" below.
It may take a few minutes. Once completed, the client number will display in the Client summary” section below.
</p>
</div>
</cds-actionable-notification>
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ export const routes = [
},
style: "content",
headersStyle: "headers",
sideMenu: false,
profile: false,
sideMenu: true,
profile: true,
},
},
{
Expand All @@ -153,8 +153,8 @@ export const routes = [
},
style: "content",
headersStyle: "headers",
sideMenu: false,
profile: false,
sideMenu: true,
profile: true,
},
},
{
Expand Down
Loading
Loading