Compare commits

...

79 Commits

Author SHA1 Message Date
Allan Carr
0a68d2791d IO-3202 HasFeatureAccess Boolean
Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
2025-04-08 09:51:52 -07:00
Allan Carr
3691d32aaa IO-3202 HasFeatureAccess Boolean
Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
2025-04-07 17:36:39 -07:00
Dave Richer
7e741e4af9 Merged in release/2025-03-28 (pull request #2238)
release/2025-03-28 - Add Cookies Provider
2025-04-02 15:47:49 +00:00
Dave Richer
f556d59ad7 release/2025-03-28 - Add Cookies Provider 2025-04-02 11:38:40 -04:00
Dave Richer
7843ca9b1a Merged in release/2025-03-28 (pull request #2235)
[DO NOT MERGE ]Release/2025-03-28 into master-AIO - IO-2999, IO-3092, IO-3176, IO-3178, IO-3181, IO-3183, IO-3185, IO-3187
2025-04-02 12:51:24 +00:00
Patrick Fic
c8701aba63 Add region capture to Crisp. 2025-04-01 10:03:17 -07:00
Dave Richer
f6e65f82e5 Merged in feature/IO-3181-Test-Framework-Selection (pull request #2233)
Feature/IO-3181 Test Framework Selection
2025-03-28 16:17:31 +00:00
Dave Richer
8b7bb099f3 feature/IO-3181-Test-Framework-Selection - Skeletons complete 2025-03-28 12:16:36 -04:00
Allan Carr
663d91b648 Merged in feature/IO-3187-Admin-Enhancements (pull request #2231)
IO-3187 Admin Enhancements

Approved-by: Dave Richer
2025-03-27 14:04:09 +00:00
Allan Carr
2a7686ec75 IO-3187 Admin Enhancements
Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
2025-03-26 15:21:42 -07:00
Dave Richer
549cb56cdf feature/IO-3181-Test-Framework-Selection - Skeletons complete 2025-03-26 16:54:05 -04:00
Dave Richer
146bb6c5c0 feature/IO-3181-Test-Framework-Selection - Skeletons complete 2025-03-26 16:52:59 -04:00
Dave Richer
67b6da7c31 feature/IO-3181-Test-Framework-Selection - Skeletons complete 2025-03-26 16:51:53 -04:00
Allan Carr
624894621b Merged in feature/IO-3176-IntelliPay-Payment-Mapping (pull request #2229)
IO-3176 IntelliPay Payment Mapping

Approved-by: Dave Richer
2025-03-26 18:13:51 +00:00
Allan Carr
3fba215266 Merge branch 'release/2025-03-28' into feature/IO-3176-IntelliPay-Payment-Mapping
Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
2025-03-25 20:17:50 -07:00
Allan Carr
bbf291e8f3 IO-3176 IntelliPay Payment Mapping
Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
2025-03-25 20:16:34 -07:00
Dave Richer
341fc09c22 release/2025-03-28 - Modify vite config 2025-03-25 16:51:33 -04:00
Dave Richer
fb30529808 release/2025-03-28 - Modify vite config 2025-03-25 16:48:03 -04:00
Dave Richer
46999145fc release/2025-03-28 - Package locks 2025-03-25 16:38:03 -04:00
Allan Carr
9d1f810af2 Merge branch 'release/2025-03-28' into feature/IO-3176-IntelliPay-Payment-Mapping
Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
2025-03-25 12:22:36 -07:00
Dave Richer
b9693aae95 Merge remote-tracking branch 'origin/test-AIO' into release/2025-03-28 2025-03-25 15:04:46 -04:00
Dave Richer
02f5f1985c release/2025-03-28 - Up two deps 2025-03-25 15:01:50 -04:00
Dave Richer
37edceee84 Merged in feature/IO-3092-imgproxy (pull request #2225)
Feature/IO-3092 imgproxy
2025-03-25 18:58:34 +00:00
Allan Carr
1fd63012b0 Merged in release/2025-03-28 (pull request #2222)
Release/2025 03 28
2025-03-25 00:03:29 +00:00
Dave Richer
cf084fa168 Merged in release/2025-03-28 (pull request #2218)
IO-3176 IntelliPay Payment Method Mapping
2025-03-19 18:19:45 +00:00
Dave Richer
96af289640 Merged in release/2025-03-28 (pull request #2216)
IO-2999 IO Test Report Server Migration
2025-03-17 18:37:32 +00:00
Dave Richer
f8df351de6 Merged in release/2025-03-14 (pull request #2214)
Release/2025 03 14
2025-03-14 15:29:10 +00:00
Dave Richer
b8c096f4ff Merged in release/2025-03-14 (pull request #2211)
IO-3172 RO Basic Payments V2
2025-03-13 21:03:15 +00:00
Dave Richer
93ad23b615 Merged in release/2025-03-14 (pull request #2209)
Release/2025 03 14
2025-03-13 19:34:49 +00:00
Dave Richer
0a918535bb Merged in release/2025-03-14 (pull request #2208)
IO-3096-GlobalNotifications - Verify status reporter is a function and exists prior to calling it in cleanup task
2025-03-13 19:00:54 +00:00
Dave Richer
4863b16b5f Merged in release/2025-03-14 (pull request #2206)
IO-3096-GlobalNotifications - Add in a function to exclude extra logging from production
2025-03-13 17:58:20 +00:00
Dave Richer
a27f5e2153 Merged in release/2025-03-14 (pull request #2203)
IO-3170-HotfixFoRedis
2025-03-13 15:52:48 +00:00
Dave Richer
3ffea50072 Merged in release/2025-03-14 (pull request #2201)
IO-3166-Global-Notifications-Part-2: Remove unused event handler (hasura),
2025-03-13 15:32:21 +00:00
Dave Richer
34af7d3880 Merged in release/2025-03-14 (pull request #2198)
IO-3166-Global-Notifications-Part-2: add additional key prefixes for dev v prod
2025-03-13 01:14:18 +00:00
Dave Richer
4432721c27 Merged in release/2025-03-14 (pull request #2195)
IO-3166-Global-Notifications-Part-2: Make sure BULLMQ prefixes do not collide
2025-03-13 00:03:35 +00:00
Dave Richer
65ad4d9426 Merged in release/2025-03-14 (pull request #2192)
Release/2025-03-14 into test-AIO - IO-3172 IO-3166
2025-03-12 16:09:26 +00:00
Dave Richer
18924b4f08 Merged in release/2025-03-14 (pull request #2188)
Release/2025 03 14
2025-03-11 19:16:00 +00:00
Dave Richer
c524f5f0e0 Merged in release/2025-03-14 (pull request #2185)
Release/2025 03 14
2025-03-11 17:18:59 +00:00
Dave Richer
2fbac78eec Merged in release/2025-03-14 (pull request #2181)
IO-3166-Global-Notifications-Part-2: getAwsClusterFix
2025-03-07 21:00:29 +00:00
Dave Richer
4734971d48 Merged in release/2025-03-14 (pull request #2178)
IO-3170-Enhanced-GetRedisEndpointsFromAWS - Fix to prevent breaking
2025-03-07 20:30:58 +00:00
Dave Richer
fc1055c644 Merged in release/2024-03-14 (pull request #2174)
IO-3166-Global-Notifications-Part-2 - Improved GetRedisNodesFromAWS
2025-03-07 20:13:18 +00:00
Dave Richer
24798390b5 Merged in release/2024-03-14 (pull request #2170)
IO-3166-Global-Notifications-Part-2 - Small styling change
2025-03-07 18:52:24 +00:00
Dave Richer
a992dead04 Merged in release/2024-03-14 (pull request #2167)
IO-3166-Global-Notifications-Part-2 - Checkpoint
2025-03-07 16:05:48 +00:00
Dave Richer
f039cd8d0d Merged in release/2024-03-14 (pull request #2164)
Release/2024 03 14
2025-03-06 22:44:23 +00:00
Dave Richer
494e691230 Merged in release/2024-03-14 (pull request #2161)
Release/2024 03 14
2025-03-06 21:08:05 +00:00
Dave Richer
4cc7366290 Merged in release/2024-03-14 (pull request #2158)
Release/2024 03 14
2025-03-06 18:40:37 +00:00
Dave Richer
fd9d660a61 Merged in release/2024-03-14 (pull request #2155)
Release/2024 03 14
2025-03-05 22:33:06 +00:00
Dave Richer
0b5bd4f718 Merged in release/2024-03-14 (pull request #2152)
Release/2024 03 14
2025-03-05 18:56:08 +00:00
Dave Richer
7511b42bd4 Merged in release/2024-03-14 (pull request #2149)
Release/2024 03 14
2025-03-05 16:47:40 +00:00
Dave Richer
26f94c4d5b Merged in release/2024-03-14 (pull request #2146)
Release/2024 03 14
2025-03-04 22:56:23 +00:00
Dave Richer
aa55f4840b Merged in release/2024-03-14 (pull request #2142)
Release/2024 03 14
2025-03-04 16:58:41 +00:00
Dave Richer
2810428d19 test-AIO - Merge in GlobalNotifications branch 2025-03-04 11:35:12 -05:00
Patrick Fic
83da64f96b Merged in feature/IO-3162-sentry-improvements (pull request #2137)
IO-3162 Resize test CI boxes.
2025-02-28 23:27:49 +00:00
Patrick Fic
1f8d027f97 Merged in feature/IO-3162-sentry-improvements (pull request #2136)
feature/IO-3162-sentry-improvements

Approved-by: Patrick Fic
2025-02-28 23:19:23 +00:00
Patrick Fic
2f8ba20a5b Merged in feature/IO-3162-sentry-improvements (pull request #2135)
feature/IO-3162-sentry-improvements

Approved-by: Patrick Fic
2025-02-28 23:04:41 +00:00
Patrick Fic
b525f920e0 Merged in feature/IO-3162-sentry-improvements (pull request #2134)
feature/IO-3162-sentry-improvements
2025-02-28 22:49:41 +00:00
Dave Richer
91fe6745fe Merged in release/2025-02-28 (pull request #2133)
IO-2561 Return Items Modal
2025-02-28 17:37:25 +00:00
Patrick Fic
b9073fe3f5 Merged in feature/IO-3092-imgproxy (pull request #2132)
IO-3092 Refactor exports.

Approved-by: Dave Richer
2025-02-28 17:35:07 +00:00
Patrick Fic
2c95b49ae1 Merged in feature/IO-3092-imgproxy (pull request #2130)
Feature/IO-3092 imgproxy
2025-02-27 21:55:00 +00:00
Patrick Fic
9bde06e110 Merged in release/2025-02-28 (pull request #2127)
Add catch error handling.

Approved-by: Dave Richer
2025-02-21 16:50:57 +00:00
Patrick Fic
30449ca113 Merged in release/2025-02-28 (pull request #2126)
Remove email from handler.

Approved-by: Patrick Fic
2025-02-21 00:38:01 +00:00
Patrick Fic
0405d19f98 Merged in release/2025-02-28 (pull request #2125)
release/2025-02-28

Approved-by: Patrick Fic
2025-02-20 23:46:37 +00:00
Patrick Fic
2c5310403b Merged in release/2025-02-28 (pull request #2124)
release/2025-02-28

Approved-by: Patrick Fic
2025-02-20 23:38:06 +00:00
Dave Richer
e2ef4f1caf Merged in release/2025-02-28 (pull request #2119)
feature/IO-3146-Hotfix-For-Email-Translations
2025-02-19 15:40:47 +00:00
Allan Carr
b32a2d4d86 Merged in release/2025-02-14 (pull request #2116)
Release/2025 02 14

Approved-by: Dave Richer
2025-02-13 17:38:26 +00:00
Dave Richer
7c92484ae0 Merged in release/2025-02-14 (pull request #2113)
Release/2025-02-14 into test-AIO - IO-3127 IO-3128 IO-3077 IO-3131
2025-02-12 19:07:08 +00:00
Allan Carr
67cada5d8e Merged in hotfix/2025-02-06 (pull request #2109)
Hotfix/2025 02 06
2025-02-06 16:34:52 +00:00
Dave Richer
4bf68b637f Merged in release/2025-01-31 (pull request #2101)
release/2025-01-31 - fix teams icon
2025-02-04 18:48:35 +00:00
Dave Richer
b40c433865 Merged in release/2025-01-31 (pull request #2100)
Release/2025 01 31 into test-AIO - IO-3096 IO-2825 IO-3123
2025-02-04 18:04:45 +00:00
Dave Richer
55ed499ab5 Merged in release/2025-01-31 (pull request #2095)
Release/2025 01 31
2025-01-31 18:25:32 +00:00
Dave Richer
353bc3bc05 Merged in release/2025-01-31 (pull request #2091)
Release/2025 01 31 into test-AIO - IO-2681
2025-01-30 20:18:08 +00:00
Dave Richer
df5c96345c Merged in release/2025-01-31 (pull request #2089)
Release/2025 01 31
2025-01-30 17:12:44 +00:00
Dave Richer
2c7c187c45 Merged in release/2025-01-31 (pull request #2084)
Release/2025 01 31 into test-AIO - IO-3108 IO-2676
2025-01-27 18:11:07 +00:00
Dave Richer
3a5a78d60a Merged in release/2025-01-31 (pull request #2076)
feature/IO-3103-Ant5-Notifications - Job Icons fixed (spacing)
2025-01-22 18:48:25 +00:00
Dave Richer
6dd2871c07 Merged in release/2025-01-31 (pull request #2074)
Release/2025 01 31 into test-AIO -  IO-2952, IO-3099, IO-3101, IO-3103
2025-01-22 18:11:57 +00:00
Dave Richer
ef36ab9da0 Merged in release/2025-01-17 (pull request #2065)
hotfix/AdditionalProductFruitsIds - Add additional IDs for product fruits
2025-01-17 18:14:49 +00:00
Dave Richer
a917f6bcdf Merged in release/2025-01-17 (pull request #2063)
Release/2025 01 17 into test-AIO - IO-2951 IO-999 IO-3096
2025-01-17 17:54:01 +00:00
Dave Richer
c5d6457146 Merged in release/2025-01-17 (pull request #2060)
IO-3063 LOU on Schedule PopOver
2025-01-16 15:24:29 +00:00
Dave Richer
f3831e934f Merged in release/2025-01-17 (pull request #2058)
Release/2025 01 17
2025-01-15 15:50:58 +00:00
37 changed files with 3170 additions and 1591 deletions

7
.gitignore vendored
View File

@@ -121,3 +121,10 @@ logs/oAuthClient-log.log
/*.env.*
.idea/*
.idea
# Vitest
vitest-report*/
vitest-coverage/
*.vitest.log
test-output.txt

View File

@@ -12,3 +12,5 @@ VITE_APP_AXIOS_BASE_API_URL=/api/
VITE_APP_REPORTS_SERVER_URL=https://reports.test.imex.online
VITE_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc
VITE_APP_INSTANCE=IMEX
TEST_USERNAME="test@imex.dev"
TEST_PASSWORD="test123"

View File

@@ -14,3 +14,5 @@ VITE_APP_REPORTS_SERVER_URL=https://reports.test.romeonline.io
VITE_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc
VITE_APP_COUNTRY=USA
VITE_APP_INSTANCE=ROME
TEST_USERNAME="test@imex.dev"
TEST_PASSWORD="test123"

11
client/.gitignore vendored
View File

@@ -1,3 +1,14 @@
# Vitest
vitest-report*/
vitest-coverage/
*.vitest.log
test-output.txt
# Playwright
playwright-report/
test-results/
playwright/.cache/
*.playwright.log
# Sentry Config File
.sentryclirc

2490
client/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -24,7 +24,6 @@
"@sentry/vite-plugin": "^3.2.2",
"@splitsoftware/splitio-react": "^2.0.1",
"@tanem/react-nprogress": "^5.0.53",
"@vitejs/plugin-react": "^4.3.4",
"antd": "^5.24.5",
"apollo-link-logger": "^2.0.1",
"apollo-link-sentry": "^4.2.0",
@@ -100,7 +99,14 @@
"build:production:imex": "env-cmd -f .env.production.imex npm run build",
"build:production:rome": "env-cmd -f .env.production.rome npm run build",
"madge": "madge --image ./madge-graph.svg --extensions js,jsx,ts,tsx --circular .",
"eulaize": "node src/utils/eulaize.js"
"eulaize": "node src/utils/eulaize.js",
"test:unit": "vitest run",
"test:watch": "vitest",
"test:e2e:imex": "playwright test --config playwright.config.js",
"test:e2e:rome": "playwright test --config playwright.rome.config.js",
"test:e2e:imex:headed": "playwright test --config playwright.config.js --headed",
"test:e2e:rome:headed": "playwright test --config playwright.rome.config.js --headed",
"test:e2e:report": "playwright show-report"
},
"browserslist": {
"production": [
@@ -128,7 +134,12 @@
"@emotion/babel-plugin": "^11.13.5",
"@emotion/react": "^11.14.0",
"@eslint/js": "^9.23.0",
"@playwright/test": "^1.51.1",
"@sentry/webpack-plugin": "^3.2.2",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.2.0",
"@vitejs/plugin-react": "^4.3.4",
"browserslist": "^4.24.4",
"browserslist-to-esbuild": "^2.1.1",
"chalk": "^5.4.1",
@@ -136,8 +147,10 @@
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-react": "^7.37.4",
"globals": "^15.15.0",
"jsdom": "^26.0.0",
"memfs": "^4.17.0",
"os-browserify": "^0.3.0",
"playwright": "^1.51.1",
"react-error-overlay": "^6.1.0",
"redux-logger": "^3.0.6",
"source-map-explorer": "^2.5.3",
@@ -147,6 +160,7 @@
"vite-plugin-node-polyfills": "^0.23.0",
"vite-plugin-pwa": "^0.21.2",
"vite-plugin-style-import": "^2.0.0",
"vitest": "^3.0.9",
"workbox-window": "^7.3.0"
}
}

View File

@@ -0,0 +1,25 @@
import { defineConfig } from "@playwright/test";
import dotenv from "dotenv";
dotenv.config({
path: "./.env.development.imex",
prefix: "TEST_"
});
export default defineConfig({
testDir: "./tests/e2e",
testMatch: "*.e2e.js",
timeout: 60 * 1000,
reporter: [["list"], ["html"]],
use: {
baseURL: "https://localhost:3000",
browser: "chromium",
ignoreHTTPSErrors: true
},
webServer: {
command: "npm run start:imex",
ignoreHTTPSErrors: true,
url: "https://localhost:3000/health", // Health check endpoint will tell us when the server is ready
reuseExistingServer: !process.env.CI // Reuse server locally, not in CI
}
});

View File

@@ -0,0 +1,25 @@
import { defineConfig } from "@playwright/test";
import dotenv from "dotenv";
dotenv.config({
path: "./.env.development.rome",
prefix: "TEST_"
});
export default defineConfig({
testDir: "./tests/e2e",
testMatch: "*.e2e.js",
timeout: 60 * 1000,
reporter: [["list"], ["html"]],
use: {
baseURL: "https://localhost:3000",
browser: "chromium",
ignoreHTTPSErrors: true
},
webServer: {
command: "npm run start:rome",
ignoreHTTPSErrors: true,
url: "https://localhost:3000/health", // Health check endpoint will tell us when the server is ready
reuseExistingServer: !process.env.CI // Reuse server locally, not in CI
}
});

View File

@@ -10,6 +10,7 @@ import client from "../utils/GraphQLClient";
import App from "./App";
import * as Sentry from "@sentry/react";
import themeProvider from "./themeProvider";
import { CookiesProvider } from "react-cookie";
// Base Split configuration
const config = {
@@ -38,26 +39,28 @@ function AppContainer() {
const { t } = useTranslation();
return (
<ApolloProvider client={client}>
<ConfigProvider
input={{ autoComplete: "new-password" }}
locale={enLocale}
theme={themeProvider}
form={{
validateMessages: {
// eslint-disable-next-line no-template-curly-in-string
required: t("general.validation.required", { label: "${label}" })
}
}}
>
<GlobalLoadingBar />
<SplitFactoryProvider config={config}>
<SplitClientProvider>
<App />
</SplitClientProvider>
</SplitFactoryProvider>
</ConfigProvider>
</ApolloProvider>
<CookiesProvider>
<ApolloProvider client={client}>
<ConfigProvider
input={{ autoComplete: "new-password" }}
locale={enLocale}
theme={themeProvider}
form={{
validateMessages: {
// eslint-disable-next-line no-template-curly-in-string
required: t("general.validation.required", { label: "${label}" })
}
}}
>
<GlobalLoadingBar />
<SplitFactoryProvider config={config}>
<SplitClientProvider>
<App />
</SplitClientProvider>
</SplitFactoryProvider>
</ConfigProvider>
</ApolloProvider>
</CookiesProvider>
);
}

View File

@@ -1,3 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Alert component should render Alert component 1`] = `ShallowWrapper {}`;

View File

@@ -1,19 +0,0 @@
import { shallow } from "enzyme";
import React from "react";
import Alert from "./alert.component";
describe("Alert component", () => {
let wrapper;
beforeEach(() => {
const mockProps = {
type: "error",
message: "Test error message."
};
wrapper = shallow(<Alert {...mockProps} />);
});
it("should render Alert component", () => {
expect(wrapper).toMatchSnapshot();
});
});

View File

@@ -0,0 +1,31 @@
import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import AlertComponent from "./alert.component";
describe("AlertComponent", () => {
it("renders with default props", () => {
render(<AlertComponent message="Default Alert" />);
expect(screen.getByText("Default Alert")).toBeInTheDocument();
expect(screen.getByRole("alert")).toHaveClass("ant-alert");
});
it("applies type prop correctly", () => {
render(<AlertComponent message="Success Alert" type="success" />);
const alert = screen.getByRole("alert");
expect(screen.getByText("Success Alert")).toBeInTheDocument();
expect(alert).toHaveClass("ant-alert-success");
});
it("displays description when provided", () => {
render(<AlertComponent message="Error Alert" description="Something went wrong" type="error" />);
expect(screen.getByText("Error Alert")).toBeInTheDocument();
expect(screen.getByText("Something went wrong")).toBeInTheDocument();
expect(screen.getByRole("alert")).toHaveClass("ant-alert-error");
});
it("is closable and shows icon when props are set", () => {
render(<AlertComponent message="Warning Alert" type="warning" showIcon closable />);
expect(screen.getByText("Warning Alert")).toBeInTheDocument();
expect(screen.getByRole("button", { name: /close/i })).toBeInTheDocument(); // Close button
});
});

View File

@@ -1,5 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`AllocationsAssignmentComponent component should create an allocation on save 1`] = `ReactWrapper {}`;
exports[`AllocationsAssignmentComponent component should render AllocationsAssignmentComponent component 1`] = `ReactWrapper {}`;

View File

@@ -1,35 +0,0 @@
import { mount } from "enzyme";
import React from "react";
import { MockBodyshop } from "../../utils/TestingHelpers";
import { AllocationsAssignmentComponent } from "./allocations-assignment.component";
describe("AllocationsAssignmentComponent component", () => {
let wrapper;
beforeEach(() => {
const mockProps = {
bodyshop: MockBodyshop,
handleAssignment: jest.fn(),
assignment: {},
setAssignment: jest.fn(),
visibilityState: [false, jest.fn()],
maxHours: 4
};
wrapper = mount(<AllocationsAssignmentComponent {...mockProps} />);
});
it("should render AllocationsAssignmentComponent component", () => {
expect(wrapper).toMatchSnapshot();
});
it("should render a list of employees", () => {
const empList = wrapper.find("#employeeSelector");
expect(empList.children()).to.have.lengthOf(2);
});
it("should create an allocation on save", () => {
wrapper.find("Button").simulate("click");
expect(wrapper).toMatchSnapshot();
});
});

View File

@@ -20,6 +20,7 @@ function FeatureWrapper({
children,
upsellComponent,
bypass,
// eslint-disable-next-line no-unused-vars
...restProps
}) {
const { t } = useTranslation();
@@ -78,7 +79,11 @@ export function HasFeatureAccess({ featureName, bodyshop, bypass, debug = false
}
return true;
}
return bodyshop?.features?.allAccess || dayjs(bodyshop?.features[featureName]).isAfter(dayjs());
return (
bodyshop?.features?.allAccess ||
bodyshop?.features?.[featureName] ||
dayjs(bodyshop?.features[featureName]).isAfter(dayjs())
);
}
export default connect(mapStateToProps, null)(FeatureWrapper);

View File

@@ -340,6 +340,7 @@ export function* SetAuthLevelFromShopDetails({ payload }) {
args: [],
imex: () => {
window.$crisp.push(["set", "user:company", [payload.shopname]]);
window.$crisp.push(["set", "session:segments", [[`region:${payload.region_config}`]]]);
if (authRecord[0] && authRecord[0].user.validemail) {
window.$crisp.push(["set", "user:email", [authRecord[0].user.email]]);
}

View File

@@ -1,4 +0,0 @@
import { configure } from "enzyme";
import Adapter from "enzyme-adapter-react-16";
configure({ adapter: new Adapter() });

View File

@@ -3679,7 +3679,8 @@
"signinerror": {
"auth/user-disabled": "User account disabled. ",
"auth/user-not-found": "A user with this email does not exist.",
"auth/wrong-password": "The email and password combination you provided is incorrect."
"auth/wrong-password": "The email and password combination you provided is incorrect.",
"auth/invalid-email": "A user with this email does not exist."
}
}
},

View File

@@ -3679,7 +3679,8 @@
"signinerror": {
"auth/user-disabled": "",
"auth/user-not-found": "",
"auth/wrong-password": ""
"auth/wrong-password": "",
"auth/invalid-email": ""
}
}
},

View File

@@ -3679,7 +3679,8 @@
"signinerror": {
"auth/user-disabled": "",
"auth/user-not-found": "",
"auth/wrong-password": ""
"auth/wrong-password": "",
"auth/invalid-email": ""
}
}
},

View File

@@ -1,139 +0,0 @@
export const MockBodyshop = {
address1: "123 Fake St",
address2: "Unit #100",
city: "Vancouver",
country: "Canada",
created_at: "2019-12-10T20:03:06.420853+00:00",
email: "snaptsoft@gmail.com",
federal_tax_id: "GST10150492",
id: "52b7357c-0edd-4c95-85c3-dfdbcdfad9ac",
insurance_vendor_id: "F123456",
logo_img_path: "https://www.snapt.ca/assets/logo-placeholder.png",
md_ro_statuses: {
statuses: [
"Open",
"Scheduled",
"Arrived",
"Repair Plan",
"Parts",
"Body",
"Prep",
"Paint",
"Reassembly",
"Sublet",
"Detail",
"Completed",
"Delivered",
"Invoiced",
"Exported"
],
open_statuses: ["Open", "Scheduled", "Arrived", "Repair Plan", "Parts", "Body", "Prep", "Paint"],
default_arrived: "Arrived",
default_exported: "Exported",
default_imported: "Open",
default_invoiced: "Invoiced",
default_completed: "Completed",
default_delivered: "Delivered",
default_scheduled: "Scheduled"
},
md_order_statuses: {
statuses: ["Ordered", "Received", "Canceled", "Backordered"],
default_bo: "Backordered",
default_ordered: "Ordered",
default_canceled: "Canceled",
default_received: "Received"
},
shopname: "Testing Collision",
state: "BC",
state_tax_id: "PST1000-2991",
updated_at: "2020-03-23T22:06:03.509544+00:00",
zip_post: "V6B 1M9",
region_config: "CA_BC",
md_responsibility_centers: {
costs: [
"Aftermarket",
"ATS",
"Body",
"Detail",
"Daignostic",
"Electrical",
"Chrome",
"Frame",
"Mechanical",
"Refinish",
"Structural",
"Existing",
"Glass",
"LKQ",
"OEM",
"OEM Partial",
"Re-cored",
"Remanufactured",
"Other",
"Sublet",
"Towing"
],
profits: [
"Aftermarket",
"ATS",
"Body",
"Detail",
"Daignostic",
"Electrical",
"Chrome",
"Frame",
"Mechanical",
"Refinish",
"Structural",
"Existing",
"Glass",
"LKQ",
"OEM",
"OEM Partial",
"Re-cored",
"Remanufactured",
"Other",
"Sublet",
"Towing"
],
defaults: {
ATS: "ATS",
LAB: "Body",
LAD: "Diagnostic",
LAE: "Electrical",
LAF: "Frame",
LAG: "Glass",
LAM: "Mechanical",
LAR: "Refinish",
LAS: "Structural",
LAU: "Detail",
PAA: "Aftermarket",
PAC: "Chrome",
PAL: "LKQ",
PAM: "Remanufactured",
PAN: "OEM",
PAO: "Other",
PAP: "OEM Partial",
PAR: "16",
TOW: "Towing"
}
},
employees: [
{
id: "075b744c-8919-49ca-abb2-ccd51040326d",
first_name: "Patrick",
last_name: "BODY123",
employee_number: "101",
cost_center: "Body",
__typename: "employees"
},
{
id: "8cc787d3-1cfe-49d3-8a15-8469cd5c2e41",
first_name: "Patrick",
last_name: "Painter",
employee_number: "10211",
cost_center: "REFINISH",
__typename: "employees"
}
]
};

View File

@@ -0,0 +1,14 @@
// Button.test.jsx
import React from "react";
import { render, screen } from "@testing-library/react";
import { describe, it, expect } from "vitest";
import { Button } from "antd";
import "antd/dist/reset.css"; // Optional: include if needed for styling reset
describe("AntD Button", () => {
it("renders with correct text", () => {
render(<Button>Click me</Button>);
const button = screen.getByRole("button", { name: /click me/i });
expect(button).toBeInTheDocument();
});
});

View File

@@ -0,0 +1,6 @@
import { test, expect } from "@playwright/test";
test("homepage loads correctly", async ({ page }) => {
await page.goto("/");
await expect(page.locator("h1")).toContainText("ImEX Online");
});

View File

@@ -0,0 +1,28 @@
import { test, expect } from "@playwright/test";
import { login } from "./utils/login";
test.describe("SignInComponent", () => {
test("successfully logs in with valid credentials", async ({ page }) => {
const email = process.env.TEST_USERNAME;
const password = process.env.TEST_PASSWORD;
await login(page, { email, password });
// Additional assertions after login (optional)
await expect(page).toHaveURL(/\/manage\//);
});
test("displays error on invalid credentials", async ({ page }) => {
await page.goto("/"); // Adjust if login route differs
// Fill form with invalid credentials
await page.fill('input[placeholder="Username"]', "wronguser@example.com");
await page.fill('input[placeholder="Password"]', "wrongpassword");
await page.click("button.login-btn");
// Check for error alert
const alert = page.locator(".ant-alert-error");
await expect(alert).toBeVisible();
await expect(alert).toContainText("A user with this email does not exist.");
});
});

View File

@@ -0,0 +1,21 @@
import { expect } from "@playwright/test";
export async function login(page, { email, password }) {
// Navigate to the login page
await page.goto("/"); // Adjust if your login route differs (e.g., '/login')
// Fill email field
await page.fill('input[placeholder="Username"]', email); // Matches Ant Design Input placeholder
// Fill password field
await page.fill('input[placeholder="Password"]', password);
// Click login button
await page.click("button.login-btn");
// Wait for navigation or success indicator (e.g., redirect to /manage/)
await page.waitForURL(/\/manage\//, { timeout: 10000 }); // Adjust based on redirect
// Verify successful login (e.g., check for a dashboard element)
await expect(page.locator("text=Manage")).toBeVisible(); // Adjust to your apps post-login UI
}

5
client/tests/setup.js Normal file
View File

@@ -0,0 +1,5 @@
import { afterEach } from "vitest";
import { cleanup } from "@testing-library/react";
import "@testing-library/jest-dom";
afterEach(() => cleanup());

27
client/tests/setupI18n.js Normal file
View File

@@ -0,0 +1,27 @@
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import en_Translation from "../src/translations/en_us/common.json";
import es_Translation from "../src/translations/es/common.json";
import fr_Translation from "../src/translations/fr/common.json";
const resources = {
"en-US": en_Translation,
"fr-CA": fr_Translation,
"es-MX": es_Translation
};
i18n.use(initReactI18next).init({
resources,
lng: "en-US", // Default to en-US for tests (no LanguageDetector)
fallbackLng: "en-US",
debug: false, // Disable debug in tests
react: {
useSuspense: false // Disable Suspense for Vitest
},
interpolation: {
escapeValue: false, // React handles XSS
skipOnVariables: false
}
});
export default i18n;

View File

@@ -191,11 +191,13 @@ export default defineConfig({
"@sentry/react": ["@sentry/react"],
"@splitsoftware/splitio-react": ["@splitsoftware/splitio-react"],
logrocket: ["logrocket"],
"@firebase/analytics": ["@firebase/analytics"],
"@firebase/app": ["@firebase/app"],
"@firebase/firestore": ["@firebase/firestore"],
"@firebase/auth": ["@firebase/auth"],
"@firebase/messaging": ["@firebase/messaging"],
firebase: [
"@firebase/analytics",
"@firebase/app",
"@firebase/firestore",
"@firebase/auth",
"@firebase/messaging"
],
markerjs2: ["markerjs2"],
"@apollo/client": ["@apollo/client"],
"libphonenumber-js": ["libphonenumber-js"]
@@ -218,7 +220,13 @@ export default defineConfig({
"react-router-dom",
"dayjs",
"redux",
"react-redux"
"react-redux",
"@firebase/app",
"@firebase/analytics",
"@firebase/firestore",
"@firebase/auth",
"@firebase/messaging",
"@firebase/util"
],
esbuildOptions: {
// Update for Vite 6: Use proper file extensions

19
client/vitest.config.js Normal file
View File

@@ -0,0 +1,19 @@
import { defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react";
export default defineConfig({
plugins: [react()],
test: {
environment: "jsdom",
globals: true,
setupFiles: "./tests/setup.js",
testTimeout: 10000 // 10 seconds (in milliseconds)
},
css: {
preprocessorOptions: {
scss: {
silenceDeprecations: ["import"] // Suppress @import warnings
}
}
}
});

1609
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -10,7 +10,9 @@
"setup": "rm -rf node_modules && npm i && cd client && rm -rf node_modules && npm i",
"setup:win": "rimraf node_modules && npm i && cd client && rimraf node_modules && npm i",
"start": "node server.js",
"makeitpretty": "prettier --write \"**/*.{css,js,json,jsx,scss}\""
"makeitpretty": "prettier --write \"**/*.{css,js,json,jsx,scss}\"",
"test:unit": "vitest run",
"test:watch": "vitest"
},
"dependencies": {
"@aws-sdk/client-cloudwatch-logs": "^3.772.0",
@@ -19,8 +21,8 @@
"@aws-sdk/client-secrets-manager": "^3.772.0",
"@aws-sdk/client-ses": "^3.772.0",
"@aws-sdk/credential-provider-node": "^3.772.0",
"@aws-sdk/lib-storage": "^3.743.0",
"@aws-sdk/s3-request-presigner": "^3.731.1",
"@aws-sdk/lib-storage": "^3.774.0",
"@aws-sdk/s3-request-presigner": "^3.774.0",
"@opensearch-project/opensearch": "^2.13.0",
"@socket.io/admin-ui": "^0.5.1",
"@socket.io/redis-adapter": "^8.3.0",
@@ -82,6 +84,8 @@
"globals": "^15.15.0",
"p-limit": "^3.1.0",
"prettier": "^3.5.3",
"source-map-explorer": "^2.5.2"
"source-map-explorer": "^2.5.2",
"supertest": "^7.1.0",
"vitest": "^3.0.9"
}
}

View File

@@ -39,12 +39,14 @@ exports.createShop = async (req, res) => {
try {
const result = await client.request(
`mutation INSERT_BODYSHOPS($bs: bodyshops_insert_input!){
insert_bodyshops_one(object:$bs){
id
}
}`,
`mutation INSERT_BODYSHOPS($bs: bodyshops_insert_input!) {
insert_bodyshops_one(object: $bs) {
id
vendors {
id
}
}
}`,
{
bs: {
...bodyshop,
@@ -54,12 +56,39 @@ exports.createShop = async (req, res) => {
{ countertype: "ihbnum", count: 1 },
{ countertype: "paymentnum", count: 1 }
]
},
vendors: {
data: [{ name: "In-House" }]
}
}
}
);
res.json(result);
const bodyshopId = result.insert_bodyshops_one.id;
const vendorId = result.insert_bodyshops_one.vendors[0].id;
if (!bodyshopId || !vendorId) {
throw new Error("Failed to create bodyshop or vendor");
}
const updateBodyshop = await client.request(
`mutation UPDATE_BODYSHOP($id: uuid!, $inhousevendorid: uuid!) {
update_bodyshops_by_pk(pk_columns: { id: $id }, _set: { inhousevendorid: $inhousevendorid }) {
id
}
}`,
{
id: bodyshopId,
inhousevendorid: vendorId
}
);
res.status(200).json(updateBodyshop);
} catch (error) {
logger.log("admin-create-shop-error", "error", req.user.email, null, {
message: error.message,
stack: error.stack,
request: req.body,
ioadmin: true
});
res.status(500).json(error);
}
};

View File

@@ -2768,6 +2768,9 @@ exports.GET_BODYSHOP_BY_ID = `
id
md_order_statuses
shopname
imexshopid
intellipay_config
state
}
}
`;

View File

@@ -52,6 +52,7 @@ const getShopCredentials = async (bodyshop) => {
const decodeComment = (comment) => {
try {
return comment ? JSON.parse(Buffer.from(comment, "base64").toString()) : null;
// eslint-disable-next-line no-unused-vars
} catch (error) {
return null; // Handle malformed base64 string gracefully
}
@@ -361,24 +362,18 @@ exports.checkfee = async (req, res) => {
exports.postback = async (req, res) => {
const { body: values } = req;
const decodedComment = decodeComment(values?.comment);
const logResponseMeta = {
bodyshop: {
id: req.body?.bodyshop?.id,
imexshopid: req.body?.bodyshop?.imexshopid,
name: req.body?.bodyshop?.shopname,
state: req.body?.bodyshop?.state
},
iprequest: values,
decodedComment
};
const ipMapping = req.body?.bodyshop?.intellipay_config?.payment_map;
logger.log("intellipay-postback-received", "DEBUG", req.user?.email, null, logResponseMeta);
logger.log("intellipay-postback-received", "DEBUG", "api", null, logResponseMeta);
try {
if ((!values.invoice || values.invoice === "") && !decodedComment) {
//invoice is specified through the pay link. Comment by IO.
logger.log("intellipay-postback-ignored", "DEBUG", req.user?.email, null, {
logger.log("intellipay-postback-ignored", "DEBUG", "api", null, {
message: "No invoice or comment provided",
...logResponseMeta
});
@@ -391,7 +386,7 @@ exports.postback = async (req, res) => {
//This has been triggered by IO and may have multiple jobs.
const parsedComment = decodedComment;
logger.log("intellipay-postback-parsed-comment", "DEBUG", req.user?.email, null, {
logger.log("intellipay-postback-parsed-comment", "DEBUG", "api", null, {
parsedComment,
...logResponseMeta
});
@@ -405,8 +400,12 @@ exports.postback = async (req, res) => {
const jobs = await gqlClient.request(queries.GET_JOBS_BY_PKS, {
ids: partialPayments.map((p) => p.jobid)
});
const bodyshop = await gqlClient.request(queries.GET_BODYSHOP_BY_ID, {
id: jobs.jobs[0].shopid
});
const ipMapping = bodyshop.bodyshops_by_pk.intellipay_config?.payment_map;
logger.log("intellipay-postback-jobs-fetched", "DEBUG", req.user?.email, null, {
logger.log("intellipay-postback-jobs-fetched", "DEBUG", "api", null, {
jobs,
parsedComment,
...logResponseMeta
@@ -424,7 +423,7 @@ exports.postback = async (req, res) => {
payment_responses: {
data: {
amount: values.total,
bodyshopid: jobs.jobs[0].shopid,
bodyshopid: bodyshop.bodyshops_by_pk.id,
jobid: p.jobid,
declinereason: "Approved",
ext_paymentid: values.paymentid,
@@ -435,7 +434,7 @@ exports.postback = async (req, res) => {
}))
});
logger.log("intellipay-postback-payment-success", "DEBUG", req.user?.email, null, {
logger.log("intellipay-postback-payment-success", "DEBUG", "api", null, {
paymentResult,
jobs,
parsedComment,
@@ -458,7 +457,7 @@ exports.postback = async (req, res) => {
.join("<br/>")
})
}).catch((error) => {
logger.log("intellipay-postback-email-error", "ERROR", req.user?.email, null, {
logger.log("intellipay-postback-email-error", "ERROR", "api", null, {
message: error.message,
jobs,
paymentResult,
@@ -472,8 +471,14 @@ exports.postback = async (req, res) => {
id: values.invoice
});
logger.log("intellipay-postback-invoice-job-fetched", "DEBUG", req.user?.email, null, {
const bodyshop = await gqlClient.request(queries.GET_BODYSHOP_BY_ID, {
id: job.jobs_by_pk.shopid
});
const ipMapping = bodyshop.bodyshops_by_pk.intellipay_config?.payment_map;
logger.log("intellipay-postback-invoice-job-fetched", "DEBUG", "api", null, {
job,
bodyshop,
...logResponseMeta
});
@@ -488,7 +493,7 @@ exports.postback = async (req, res) => {
}
});
logger.log("intellipay-postback-invoice-payment-success", "DEBUG", req.user?.email, null, {
logger.log("intellipay-postback-invoice-payment-success", "DEBUG", "api", null, {
paymentResult,
...logResponseMeta
});
@@ -496,7 +501,7 @@ exports.postback = async (req, res) => {
const responseResults = await gqlClient.request(queries.INSERT_PAYMENT_RESPONSE, {
paymentResponse: {
amount: values.total,
bodyshopid: job.jobs_by_pk.shopid,
bodyshopid: bodyshop.bodyshops_by_pk.id,
paymentid: paymentResult.id,
jobid: values.invoice,
declinereason: "Approved",
@@ -506,14 +511,14 @@ exports.postback = async (req, res) => {
}
});
logger.log("intellipay-postback-invoice-response-success", "DEBUG", req.user?.email, null, {
logger.log("intellipay-postback-invoice-response-success", "DEBUG", "api", null, {
responseResults,
...logResponseMeta
});
res.sendStatus(200);
}
} catch (error) {
logger.log("intellipay-postback-error", "ERROR", req.user?.email, null, {
logger.log("intellipay-postback-error", "ERROR", "api", null, {
message: error?.message,
...logResponseMeta
});

14
server/tests/api.test.js Normal file
View File

@@ -0,0 +1,14 @@
import { describe, it, expect } from "vitest";
import request from "supertest";
import express from "express";
const app = express();
app.get("/api/health", (req, res) => res.json({ status: "ok" }));
describe("API", () => {
it("returns health status", async () => {
const response = await request(app).get("/api/health");
expect(response.status).toBe(200);
expect(response.body).toEqual({ status: "ok" });
});
});

11
server/tests/math.test.js Normal file
View File

@@ -0,0 +1,11 @@
import { describe, it, expect } from "vitest";
function add(a, b) {
return a + b;
}
describe("Math", () => {
it("adds two numbers correctly", () => {
expect(add(2, 3)).toBe(5);
});
});

10
vitest.config.js Normal file
View File

@@ -0,0 +1,10 @@
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
environment: "node",
globals: true,
include: ["./server/tests/**/*.{test,spec}.[jt]s"], // Only search /tests in root
exclude: ["**/client/**", "**/node_modules/**", "**/dist/**"] // Explicitly exclude /client
}
});