Skip to content

Commit

Permalink
Merge pull request #539 from psarando/chromatic-fixes
Browse files Browse the repository at this point in the history
Improve some stories for better Chromatic snapshots
  • Loading branch information
psarando authored Jun 17, 2023
2 parents 16585f6 + 68e5764 commit 7b26d7e
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 11 deletions.
4 changes: 3 additions & 1 deletion stories/AppBar.stories.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { UserProfileProvider } from "../src/contexts/userProfile";
import DEAppBar from "../src/components/layout/AppBar";
import { mockAxios } from "./axiosMock";
import { AXIOS_DELAY, mockAxios } from "./axiosMock";
import { NotificationsProvider } from "../src/contexts/pushNotifications";
import notificationsData from "./notifications/notificationsData";
import testConfig from "./configMock";
Expand Down Expand Up @@ -174,6 +174,7 @@ NormalView.args = {
mockInstantLaunches: instantLaunchNavDrawerMock,
mockUsageSummary: usageSummaryResponse,
};
NormalView.parameters = { chromatic: { delay: AXIOS_DELAY * 2 } };

export const ComputeLimitExceeded = appBarTestTemplate.bind({});
ComputeLimitExceeded.args = {
Expand All @@ -185,6 +186,7 @@ ComputeLimitExceeded.args = {
mockInstantLaunches: instantLaunchNavDrawerMock,
mockUsageSummary: usageSummaryComputeLimitExceededResponse,
};
ComputeLimitExceeded.parameters = { chromatic: { delay: AXIOS_DELAY * 2 } };

export default {
title: "AppBar",
Expand Down
4 changes: 3 additions & 1 deletion stories/UserPortalProfile.stories.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { mockAxios } from "./axiosMock";
import { AXIOS_DELAY, mockAxios } from "./axiosMock";
import { portalUserStatus, STATUS } from "./UserPortalMocks";
import DEAppBar from "../src/components/layout/AppBar";
import { UserProfileProvider } from "../src/contexts/userProfile";
Expand Down Expand Up @@ -30,6 +30,7 @@ export function GracePeriod() {
</UserProfileProvider>
);
}
GracePeriod.parameters = { chromatic: { delay: AXIOS_DELAY * 2 } };

export function Expired() {
mockAxios.onGet("/api/profile").reply(200, mockUser);
Expand All @@ -42,3 +43,4 @@ export function Expired() {
</UserProfileProvider>
);
}
Expired.parameters = { chromatic: { delay: AXIOS_DELAY * 2 } };
5 changes: 4 additions & 1 deletion stories/analyses/AnalysisSubmissionLanding.stories.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { mockAxios } from "../axiosMock";
import { AXIOS_DELAY, mockAxios } from "../axiosMock";
import { deWordCountAnalysis, params, info } from "./AnalysesMocks";

import AnalysisSubmissionLanding from "components/analyses/landing/AnalysisSubmissionLanding";
Expand Down Expand Up @@ -28,3 +28,6 @@ export const AnalysisSubmissionLandingTest = () => {
/>
);
};
AnalysisSubmissionLandingTest.parameters = {
chromatic: { delay: AXIOS_DELAY * 2 },
};
3 changes: 2 additions & 1 deletion stories/base/FormFields.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ export const Timestamp = ({ label, helperText, readOnly }) => {
return (
<TestForm
initialValue={formatDateObject(
new Date(),
// Using a static date for chromatic tests.
new Date(2021, 6, 22, 12, 24, 55),
dateConstants.LONG_DATE_FORMAT
)}
>
Expand Down
3 changes: 2 additions & 1 deletion stories/data/viewers/CsvViewer.stories.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";

import FileViewer from "components/data/viewers/FileViewer";
import { mockAxios } from "../../axiosMock";
import { AXIOS_DELAY, mockAxios } from "../../axiosMock";
import { fileTypesResp, csvMainfestResp, csvChunkResp } from "../DataMocks";
export default {
title: "Data / Viewers / CSV",
Expand Down Expand Up @@ -33,3 +33,4 @@ export const CSVFileViewerTest = () => {

return <CSVViewerTest />;
};
CSVFileViewerTest.parameters = { chromatic: { delay: AXIOS_DELAY * 2 } };
12 changes: 6 additions & 6 deletions stories/instantlaunches/admin/SavedLaunchListData.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const testInstantLaunches = {
id: "6ae67c2a-8153-4575-8425-2cc7526daac5",
quick_launch_id: "3f8cd42a-ee04-42de-872d-1bd637a77ddc",
added_by: "[email protected]",
added_on: Date(),
added_on: new Date(2021, 3, 27, 9, 22, 55),
},
],
};
Expand All @@ -144,7 +144,7 @@ export const testFullInstantLaunchList = {
quick_launch_description: "",
quick_launch_creator: "[email protected]",
added_by: "[email protected]",
added_on: Date(),
added_on: new Date(2021, 3, 27, 9, 22, 55),
app_id: "34f2c392-9a8a-11e8-9c8e-008cfa5ae621",
app_version_id: "34f2c392-9a8a-11e8-9c8e-008cfa5ae621",
app_version: "v0.0.3",
Expand Down Expand Up @@ -175,7 +175,7 @@ export const testFullInstantLaunchList = {
quick_launch_description: "",
quick_launch_creator: "[email protected]",
added_by: "[email protected]",
added_on: Date(),
added_on: new Date(2021, 3, 27, 9, 22, 55),
app_id: "e54bfc1a-f811-11e8-8a14-008cfa5ae621",
app_version_id: "e54bfc1a-f811-11e8-8a14-008cfa5ae621",
app_version: "latest",
Expand All @@ -202,7 +202,7 @@ export const testFullInstantLaunchList = {
quick_launch_description: "",
quick_launch_creator: "[email protected]",
added_by: "[email protected]",
added_on: Date(),
added_on: new Date(2021, 3, 27, 9, 22, 55),
app_id: "d61d9a26-e921-11e9-8fe0-008cfa5ae621",
app_version_id: "d61d9a26-e921-11e9-8fe0-008cfa5ae621",
app_version: "Unversioned",
Expand All @@ -229,7 +229,7 @@ export const testFullInstantLaunchList = {
quick_launch_description: "",
quick_launch_creator: "[email protected]",
added_by: "[email protected]",
added_on: Date(),
added_on: new Date(2021, 3, 27, 9, 22, 55),
app_id: "d61d9a26-e921-11e9-8fe0-008cfa5ae621",
app_version_id: "d61d9a26-e921-11e9-8fe0-008cfa5ae621",
app_version: "Unversioned",
Expand All @@ -256,7 +256,7 @@ export const testFullInstantLaunchList = {
quick_launch_description: "",
quick_launch_creator: "[email protected]",
added_by: "[email protected]",
added_on: Date(),
added_on: new Date(2021, 3, 27, 9, 22, 55),
app_id: "d61d9a26-e921-11e9-8fe0-008cfa5ae621",
app_version_id: "d61d9a26-e921-11e9-8fe0-008cfa5ae621",
app_version: "Unversioned",
Expand Down
2 changes: 2 additions & 0 deletions stories/vice/loading/ViceLoading.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ export const ViceLoadingTest = ({
return <ViceLoading accessUrl={accessUrl} />;
};

ViceLoadingTest.parameters = { chromatic: { disableSnapshot: true } };

ViceLoadingTest.argTypes = {
statusEndpointError: {
defaultValue: false,
Expand Down

0 comments on commit 7b26d7e

Please sign in to comment.