Skip to content

Commit 4430b47

Browse files
authored
Merge pull request #4575 from mahmoudmagdy1-1/flaky-poddetails-test
Fix flaky PodDetailsView Storybook test
2 parents eeeb5c7 + 28ab7f9 commit 4430b47

8 files changed

+190
-7614
lines changed

frontend/src/components/pod/PodDetails.stories.tsx

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
import { createTheme, ThemeProvider } from '@mui/material/styles';
1718
import { Meta, StoryFn } from '@storybook/react';
1819
import { http, HttpResponse } from 'msw';
1920
import { useEffect } from 'react';
@@ -33,6 +34,16 @@ const AUTH_URL = `http://localhost:4466/clusters/${CLUSTER_NAME}/apis/authorizat
3334
// Store the initial path at module scope, so we can always restore to it
3435
const INITIAL_PATH = window.location.pathname;
3536

37+
const theme = createTheme({
38+
components: {
39+
MuiButtonBase: {
40+
defaultProps: {
41+
disableRipple: true,
42+
},
43+
},
44+
},
45+
});
46+
3647
export default {
3748
title: 'Pod/PodDetailsView',
3849
component: PodDetails,
@@ -63,7 +74,11 @@ export default {
6374
};
6475
}, []);
6576

66-
return <Story />;
77+
return (
78+
<ThemeProvider theme={theme}>
79+
<Story />
80+
</ThemeProvider>
81+
);
6782
};
6883

6984
return <ClusterMockWrapper />;
@@ -90,9 +105,7 @@ export default {
90105
],
91106
})
92107
),
93-
http.get(`http://localhost:4466/clusters/${CLUSTER_NAME}/api/v1/pods`, () =>
94-
HttpResponse.json({})
95-
),
108+
http.get(PODS_URL, () => HttpResponse.json({ items: [] })),
96109
http.post(AUTH_URL, () =>
97110
HttpResponse.json({ status: { allowed: true, reason: '', code: 200 } })
98111
),
@@ -187,7 +200,11 @@ DebugDisabled.decorators = [
187200
};
188201
}, []);
189202

190-
return <Story />;
203+
return (
204+
<ThemeProvider theme={theme}>
205+
<Story />
206+
</ThemeProvider>
207+
);
191208
};
192209

193210
return <ClusterMockWrapper />;

0 commit comments

Comments
 (0)