Skip to content

Commit d1922a7

Browse files
authored
Comp 737 (#664)
* [COMP-737] Updated to Node 24, fixed breaking tests * [COMP-737] Add package-lock * [COMP-737] Testing actions now working * [COMP-737] removed code-cov from action and created ticket to fix
1 parent 872316f commit d1922a7

File tree

66 files changed

+10161
-10501
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+10161
-10501
lines changed

.github/workflows/web.ci.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
if: github.repository == 'bcgov/EPIC.compliance'
2424

2525
steps:
26-
- uses: actions/checkout@v2
26+
- uses: actions/checkout@v4
2727
- run: "true"
2828

2929
linting:
@@ -32,12 +32,12 @@ jobs:
3232

3333
strategy:
3434
matrix:
35-
node-version: [18.x]
35+
node-version: [24.x]
3636

3737
steps:
38-
- uses: actions/checkout@v2
38+
- uses: actions/checkout@v4
3939
- name: Use Node.js ${{ matrix.node-version }}
40-
uses: actions/setup-node@v1
40+
uses: actions/setup-node@v4
4141
with:
4242
node-version: ${{ matrix.node-version }}
4343
- name: Install dependencies
@@ -54,13 +54,13 @@ jobs:
5454

5555
strategy:
5656
matrix:
57-
node-version: [18.x]
57+
node-version: [24.x]
5858

5959
steps:
60-
- uses: actions/checkout@v2
60+
- uses: actions/checkout@v4
6161

6262
- name: Use Node.js ${{ matrix.node-version }}
63-
uses: actions/setup-node@v1
63+
uses: actions/setup-node@v4
6464
with:
6565
node-version: ${{ matrix.node-version }}
6666

@@ -73,18 +73,20 @@ jobs:
7373
run: |
7474
npx cypress run --component --headed --browser chrome
7575
76-
- name: Coverage Report
77-
run: |
78-
npx nyc report --reporter=lcov --reporter=text-summary
76+
# Disabled because nyc is not supported and needs to be replaced.
77+
# [COMP-769]
78+
# - name: Coverage Report
79+
# run: |
80+
# npx nyc report --reporter=lcov --reporter=text-summary
7981

8082
build-check:
8183
needs: setup-job
8284
runs-on: ubuntu-24.04
8385

8486
steps:
85-
- uses: actions/checkout@v2
87+
- uses: actions/checkout@v4
8688
- name: Use Node.js ${{ matrix.node-version }}
87-
uses: actions/setup-node@v1
89+
uses: actions/setup-node@v4
8890
with:
8991
node-version: ${{ matrix.node-version }}
9092
- name: Install dependencies

compliance-api/Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ build-req: clean ## Upgrade requirements
5252
pip install -Ur requirements/repo-libraries.txt
5353

5454
install: clean ## Install python virtrual environment
55-
test -f venv/bin/activate || python3 -m venv $(CURRENT_ABS_DIR)/venv ;\
55+
test -f venv/bin/activate || python3.10 -m venv $(CURRENT_ABS_DIR)/venv ;\
5656
. venv/bin/activate ;\
5757
pip install --upgrade pip ;\
58-
pip install -Ur requirements.txt
58+
pip install -Ur requirements.txt ;\
59+
pip install -Ur requirements/dev.txt ;\
60+
pip install -Ur requirements/prod.txt
5961

6062
install-dev: ## Install local application
6163
. venv/bin/activate ; \
@@ -139,7 +141,7 @@ tag: push ## tag image
139141
# COMMANDS - Local #
140142
#################################################################################
141143
run: db ## Run the project in local
142-
. venv/bin/activate && python -m flask run -p 3200
144+
. venv/bin/activate && python -m flask run -p 5000
143145

144146
db: ## Update the local database
145147
. venv/bin/activate && flask db upgrade

compliance-web/cypress.config.cjs

Lines changed: 0 additions & 75 deletions
This file was deleted.

compliance-web/cypress.config.mjs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { defineConfig } from "cypress";
2+
import { defineConfig as defineViteConfig } from "vite";
3+
4+
import react from "@vitejs/plugin-react-swc";
5+
import { TanStackRouterVite } from "@tanstack/router-plugin/vite";
6+
import istanbul from "vite-plugin-istanbul";
7+
import tsconfigPaths from "vite-tsconfig-paths";
8+
9+
import path from "node:path";
10+
import { fileURLToPath } from "node:url";
11+
12+
const dirname = path.dirname(fileURLToPath(import.meta.url));
13+
14+
export default defineConfig({
15+
component: {
16+
devServer: {
17+
framework: "react",
18+
bundler: "vite",
19+
viteConfig: defineViteConfig({
20+
plugins: [
21+
TanStackRouterVite(),
22+
react(),
23+
tsconfigPaths(),
24+
istanbul({ cypress: true, requireEnv: false }),
25+
],
26+
resolve: {
27+
alias: {
28+
"@": path.resolve(dirname, "src"),
29+
},
30+
},
31+
}),
32+
},
33+
},
34+
});

compliance-web/cypress/components/_components/_App/ProjectDetailsForm.cy.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// <reference types="cypress" />
2-
import { mount } from "cypress/react18";
2+
import { mount } from "cypress/react";
33
import ProjectDetailsForm from "@/components/App/ProjectDetailsForm"; // Adjust path accordingly
44
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
55
import { FormProvider, useForm } from "react-hook-form";

compliance-web/cypress/components/_components/_App/_CaseFiles/CaseFileDrawer.cy.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import { mount } from "cypress/react18";
2+
import { mount } from "cypress/react";
33
import CaseFileDrawer from "@/components/App/CaseFiles/CaseFileDrawer";
44
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
55
import { CaseFile } from "@/models/CaseFile";
@@ -90,13 +90,13 @@ describe("CaseFileDrawer Component", () => {
9090

9191
function mountComponent(isEditMode = false) {
9292
const onSubmitSpy = cy.spy().as("onSubmitSpy");
93-
93+
9494
return mount(
9595
<QueryClientProvider client={queryClient}>
9696
<AuthProvider {...OidcConfig}>
97-
<CaseFileDrawer
98-
onSubmit={onSubmitSpy}
99-
caseFile={isEditMode ? mockCaseFile : undefined}
97+
<CaseFileDrawer
98+
onSubmit={onSubmitSpy}
99+
caseFile={isEditMode ? mockCaseFile : undefined}
100100
/>
101101
</AuthProvider>
102102
</QueryClientProvider>
@@ -108,12 +108,12 @@ describe("CaseFileDrawer Component", () => {
108108

109109
// Check title
110110
cy.contains("Create Case File").should("be.visible");
111-
111+
112112
// Check form fields are present
113113
cy.get('input[name="project"]').should("be.visible");
114114
cy.get('input[name="initiation"]').should("be.visible");
115115
cy.get('input[name="primaryOfficer"]').should("be.visible");
116-
116+
117117
// Check submit button
118118
cy.contains("button", "Create").should("be.visible");
119119
});
@@ -123,12 +123,12 @@ describe("CaseFileDrawer Component", () => {
123123

124124
// Check title shows case file number
125125
cy.contains("CF-2023-001").should("be.visible");
126-
126+
127127
// Check form fields are populated with case file data
128128
cy.get('input[name="project"]').should("have.value", "Project 1");
129129
cy.get('input[name="initiation"]').should("have.value", "Initiation 1");
130130
cy.get('input[name="primaryOfficer"]').should("have.value", "User 1");
131-
131+
132132
// Check submit button
133133
cy.contains("button", "Save").should("be.visible");
134134
});

compliance-web/cypress/components/_components/_App/_CaseFiles/CaseFileForm.cy.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// <reference types="cypress" />
2-
import { mount } from "cypress/react18";
2+
import { mount } from "cypress/react";
33
import CaseFileForm from "@/components/App/CaseFiles/CaseFileForm";
44
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
55
import { FormProvider, useForm } from "react-hook-form";

compliance-web/cypress/components/_components/_App/_CaseFiles/_Profile/CaseFileActions.cy.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { mount } from "cypress/react18";
1+
import { mount } from "cypress/react";
22
import CaseFileActions from "@/components/App/CaseFiles/Profile/CaseFileActions";
33
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
44
import ModalProvider from "@/components/Shared/Modals/ModalProvider";

compliance-web/cypress/components/_components/_App/_CaseFiles/_Profile/CaseFileComplaintsTable.cy.tsx

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { mount } from "cypress/react18";
1+
import { mount } from "cypress/react";
22
import CaseFileComplaintsTable from "@/components/App/CaseFiles/Profile/CaseFileComplaintsTable";
33
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
4-
import {
5-
RouterProvider,
4+
import {
5+
RouterProvider,
66
createMemoryHistory,
77
createRootRoute,
88
createRoute,
@@ -58,13 +58,13 @@ describe("CaseFileComplaintsTable", () => {
5858

5959
// Create a simple router for testing
6060
const rootRoute = createRootRoute();
61-
61+
6262
const complaintsRoute = createRoute({
6363
getParentRoute: () => rootRoute,
6464
path: '/ce-database/complaints/$complaintNumber',
6565
component: () => <div>Complaint Detail Page</div>
6666
});
67-
67+
6868
const indexRoute = createRoute({
6969
getParentRoute: () => rootRoute,
7070
path: '/',
@@ -76,11 +76,11 @@ describe("CaseFileComplaintsTable", () => {
7676
});
7777

7878
const routeTree = rootRoute.addChildren([indexRoute, complaintsRoute]);
79-
79+
8080
const memoryHistory = createMemoryHistory({
8181
initialEntries: ['/'],
8282
});
83-
83+
8484
const router = createRouter({
8585
routeTree,
8686
history: memoryHistory,
@@ -117,26 +117,26 @@ describe("CaseFileComplaintsTable", () => {
117117
it("expands accordion when clicked", () => {
118118
// Click on the first accordion to expand it
119119
cy.get('[role="button"]').first().click();
120-
120+
121121
// Should show expanded content
122122
cy.contains("Concern Description").should("exist");
123123
cy.contains("Source").should("exist");
124124
cy.contains("Date Received").should("exist");
125-
125+
126126
// Should show ExpandLessRounded icon when expanded
127127
cy.get('[data-testid="ExpandLessRoundedIcon"]').should("exist");
128128
});
129129

130130
it("displays complaint details when expanded", () => {
131131
// Expand the first accordion
132132
cy.get('[role="button"]').first().click();
133-
133+
134134
// Check for concern description
135135
cy.contains("Test concern description 1").should("exist");
136-
136+
137137
// Check for source
138138
cy.contains("Source 1").should("exist");
139-
139+
140140
// Check for formatted date
141141
cy.contains("2023-04-15").should("exist");
142142
});
@@ -155,29 +155,29 @@ describe("CaseFileComplaintsTable", () => {
155155
// Just check that the link has the correct href
156156
cy.get('a').contains("COMP_123").should('have.attr', 'href')
157157
.and('include', '/ce-database/complaints/');
158-
158+
159159
// And that clicking doesn't throw errors
160160
cy.get('a').contains("COMP_123").click();
161161
});
162162

163163
it("collapses accordion when clicked again", () => {
164164
// Expand the first accordion
165165
cy.get('[role="button"]').first().click();
166-
166+
167167
// Verify it's expanded
168168
cy.contains("Concern Description").should("exist");
169-
169+
170170
// Click again to collapse
171171
cy.get('[role="button"]').first().click();
172-
172+
173173
// Verify it's collapsed (content should not be visible)
174174
cy.contains("Concern Description").should("not.be.visible");
175175
});
176176

177177
it("shows no complaints message when there are no complaints", () => {
178178
// Set empty complaints data
179179
queryClient.setQueryData(["complaints-by-caseFileId", 1], []);
180-
180+
181181
// Re-mount with empty data
182182
const rootRoute = createRootRoute();
183183
const indexRoute = createRoute({
@@ -192,9 +192,9 @@ describe("CaseFileComplaintsTable", () => {
192192
const routeTree = rootRoute.addChildren([indexRoute]);
193193
const memoryHistory = createMemoryHistory({ initialEntries: ['/'] });
194194
const router = createRouter({ routeTree, history: memoryHistory });
195-
195+
196196
mount(<RouterProvider router={router as never} />);
197-
197+
198198
cy.contains("You do not have any created complaints on this file.").should("exist");
199199
});
200-
});
200+
});

0 commit comments

Comments
 (0)