From 3613b58f0edf778d7935aee72c36776a5b3c2208 Mon Sep 17 00:00:00 2001 From: dinesh Date: Thu, 25 Jul 2024 21:40:26 -0700 Subject: [PATCH 1/3] cypress config added --- compliance-web/cypress.config.cjs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 compliance-web/cypress.config.cjs diff --git a/compliance-web/cypress.config.cjs b/compliance-web/cypress.config.cjs new file mode 100644 index 00000000..f27cf728 --- /dev/null +++ b/compliance-web/cypress.config.cjs @@ -0,0 +1,21 @@ +/* eslint-disable no-undef */ + +// eslint-disable-next-line @typescript-eslint/no-var-requires +const { defineConfig } = require('cypress'); + +module.exports = defineConfig({ + component: { + devServer: { + framework: "react", + bundler: "vite", + }, + setupNodeEvents(on, config) { + require('@cypress/code-coverage/task')(on, config) + // include any other plugin code... + + // It's IMPORTANT to return the config object + // with any changed environment variables + return config + }, + }, +}); \ No newline at end of file From e6dba78f0e16a47a0c889d8fb50902e6190be03f Mon Sep 17 00:00:00 2001 From: dinesh Date: Thu, 25 Jul 2024 21:47:21 -0700 Subject: [PATCH 2/3] adding unit test for app.cy.tsx --- compliance-web/src/App.cy.tsx | 47 +++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 compliance-web/src/App.cy.tsx diff --git a/compliance-web/src/App.cy.tsx b/compliance-web/src/App.cy.tsx new file mode 100644 index 00000000..17f15f24 --- /dev/null +++ b/compliance-web/src/App.cy.tsx @@ -0,0 +1,47 @@ +import { mount } from "cypress/react18"; // or `cypress/react18` if using React 18 +import { ThemeProvider } from "@mui/material"; +import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import { ReactQueryDevtools } from "@tanstack/react-query-devtools"; +import { AuthProvider } from "react-oidc-context"; +import { OidcConfig } from "@/utils/config"; +import { theme } from "@/styles/theme"; +import { createRouter, RouterProvider } from "@tanstack/react-router"; +import { routeTree } from "@/routeTree.gen"; +import React from "react"; + +const queryClient = new QueryClient(); + +const router = createRouter({ + routeTree, + context: { + authentication: undefined!, + }, +}); + +function TestApp({ authentication }) { + return ( + + + + + + + + + ); +} + +describe("", () => { + it("renders", () => { + const mockAuth = { + // mock the necessary properties and methods for useAuth context + isAuthenticated: true, + user: { profile: { name: "Test User" } }, + signoutRedirect: cy.stub(), + signinRedirect: cy.stub(), + // add other necessary mocks here + }; + mount(); + cy.contains("Users"); + }); +}); \ No newline at end of file From c46be5245cbae4d7a850073f662ddd3d113bae5d Mon Sep 17 00:00:00 2001 From: dinesh Date: Thu, 25 Jul 2024 22:18:34 -0700 Subject: [PATCH 3/3] changed code owner --- .github/CODEOWNERS | 2 +- compliance-web/src/App.cy.tsx | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f982954c..d3f5e31f 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,4 +1,4 @@ # These owners will be the default owners for everything in # the repo. Unless a later match takes precedence, # they will be requested for review when someone opens a pull request. -* @dinesh-aot @salabh-aot @jadmsaadaot @saravanpa-aot \ No newline at end of file +* @dinesh-aot @jadmsaadaot @saravanpa-aot \ No newline at end of file diff --git a/compliance-web/src/App.cy.tsx b/compliance-web/src/App.cy.tsx index 17f15f24..b8428adc 100644 --- a/compliance-web/src/App.cy.tsx +++ b/compliance-web/src/App.cy.tsx @@ -7,7 +7,6 @@ import { OidcConfig } from "@/utils/config"; import { theme } from "@/styles/theme"; import { createRouter, RouterProvider } from "@tanstack/react-router"; import { routeTree } from "@/routeTree.gen"; -import React from "react"; const queryClient = new QueryClient();