generated from bcgov/EPIC.scaffold
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from dinesh-aot/EPICSYSTEM-155
cypress config added
- Loading branch information
Showing
3 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
Validating CODEOWNERS rules …
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 |
---|---|---|
@@ -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 | ||
* @dinesh-aot @jadmsaadaot @saravanpa-aot |
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,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 | ||
}, | ||
}, | ||
}); |
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,46 @@ | ||
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"; | ||
|
||
const queryClient = new QueryClient(); | ||
|
||
const router = createRouter({ | ||
routeTree, | ||
context: { | ||
authentication: undefined!, | ||
}, | ||
}); | ||
|
||
function TestApp({ authentication }) { | ||
return ( | ||
<QueryClientProvider client={queryClient}> | ||
<ThemeProvider theme={theme}> | ||
<AuthProvider {...OidcConfig}> | ||
<RouterProvider router={router} context={{ authentication }} /> | ||
</AuthProvider> | ||
</ThemeProvider> | ||
<ReactQueryDevtools initialIsOpen={false} /> | ||
</QueryClientProvider> | ||
); | ||
} | ||
|
||
describe("<App />", () => { | ||
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(<TestApp authentication={mockAuth} />); | ||
cy.contains("Users"); | ||
}); | ||
}); |