Skip to content

Commit

Permalink
Format and add 1 local retry to inconsistent e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
atomicgamedeveloper committed Oct 30, 2024
1 parent a52188b commit 8788139
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 15 deletions.
4 changes: 2 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
"@mui/material": "^6.1.4",
"@mui/x-tree-view": "^7.19.0",
"@reduxjs/toolkit": "2.3.0",
"@rollup/plugin-terser": "^0.4.4",
"@types/react-syntax-highlighter": "^15.5.13",
"@types/remarkable": "^2.0.8",
"@rollup/plugin-terser": "^0.4.4",
"@types/styled-components": "5.1.34",
"@typescript-eslint/eslint-plugin": "8.9.0",
"@typescript-eslint/parser": "8.9.0",
Expand All @@ -72,9 +72,9 @@
"eslint-plugin-jest": "28.8.3",
"eslint-plugin-jsx-a11y": "6.10.0",
"eslint-plugin-react": "7.37.1",
"glob": "11.0.0",
"katex": "^0.16.11",
"markdown-it-katex": "^2.0.3",
"glob": "11.0.0",
"oidc-client-ts": "3.1.0",
"prop-types": "^15.8.1",
"react": "18.3.1",
Expand Down
3 changes: 2 additions & 1 deletion client/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default defineConfig({
: {
command: 'yarn start',
},
retries: process.env.CI ? 0 : 1, // Disable retries on Github actions for now as setup always fails
timeout: 60 * 1000,
globalTimeout: 10 * 60 * 1000,
testDir: './test/e2e/tests',
Expand Down Expand Up @@ -48,7 +49,7 @@ export default defineConfig({
], // Codecov handled through Monocart-Reporter https://github.com/cenfun/monocart-reporter
use: {
baseURL: BASE_URI,
trace: 'retain-on-failure',
trace: 'on-first-retry', // Wil not record trace on Github actions because of no retries
},
projects: [
// Setup project
Expand Down
13 changes: 7 additions & 6 deletions client/test/preview/unit/components/asset/AssetCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ describe('AssetCardManage', () => {
});

it('renders AssetCardManage with digital twin description', () => {
(useSelector as jest.MockedFunction<typeof useSelector>).mockImplementation((selector) =>
selector({
digitalTwin: {
[asset.name]: { description: 'Digital Twin description' },
},
}),
(useSelector as jest.MockedFunction<typeof useSelector>).mockImplementation(
(selector) =>
selector({
digitalTwin: {
[asset.name]: { description: 'Digital Twin description' },
},
}),
);

render(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ describe('DetailsButton', () => {
it('handles button click and shows details', async () => {
const mockSetShowDetails = jest.fn();

(redux.useSelector as jest.MockedFunction<typeof redux.useSelector>).mockReturnValue({
(
redux.useSelector as jest.MockedFunction<typeof redux.useSelector>
).mockReturnValue({
getFullDescription: jest.fn().mockResolvedValue('Mocked description'),
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ describe('ReconfigureDialog', () => {

beforeEach(() => {
const dispatch = jest.fn();
(useDispatch as jest.MockedFunction<typeof useDispatch>).mockReturnValue(dispatch);
(useDispatch as jest.MockedFunction<typeof useDispatch>).mockReturnValue(
dispatch,
);

(useSelector as jest.MockedFunction<typeof useSelector>).mockImplementation(
(selector: (state: RootState) => unknown) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ describe('DetailsDialog', () => {
const setShowDialog = jest.fn();

beforeEach(() => {
(useSelector as jest.MockedFunction<typeof useSelector>
).mockImplementation(() => ({
fullDescription: 'fullDescription',
}));
(useSelector as jest.MockedFunction<typeof useSelector>).mockImplementation(
() => ({
fullDescription: 'fullDescription',
}),
);
});

it('renders DetailsDialog', () => {
Expand Down

0 comments on commit 8788139

Please sign in to comment.