From 93926d3c0141adacf1e0708f687b0b6659c8e7c4 Mon Sep 17 00:00:00 2001 From: John Wu <76966357+jwu-fisker@users.noreply.github.com> Date: Thu, 4 Aug 2022 11:59:02 -0700 Subject: [PATCH] CEC-1230 Datascope opens iframe dashboard (#174) * CEC-1230 Datascope opens iframe dashboard * Clean up --- .env.dev | 2 +- .env.local | 2 +- .env.stg | 2 +- src/components/App/App.test.js | 29 +- .../App/__snapshots__/App.test.js.snap | 726 +++++++++--------- .../Add/__snapshots__/index.test.jsx.snap | 18 +- src/components/CANFilter/Add/index.test.jsx | 12 +- .../Table/__snapshots__/index.test.jsx.snap | 12 +- src/components/CANFilter/Table/index.test.jsx | 13 +- .../Update/__snapshots__/index.test.jsx.snap | 18 +- .../CANFilter/Update/index.test.jsx | 9 +- .../Add/__snapshots__/index.test.jsx.snap | 86 +-- src/components/Cars/Add/index.test.jsx | 11 +- .../List/__snapshots__/index.test.jsx.snap | 16 +- src/components/Cars/List/index.test.jsx | 15 +- .../Cars/Status/CANFiltersTab.test.jsx | 15 +- .../Cars/Status/CarUpdatesTab.test.jsx | 15 +- .../Details/__snapshots__/index.test.jsx.snap | 10 +- .../Cars/Status/Details/index.test.jsx | 11 +- .../Cars/Status/DetailsTab.test.jsx | 19 +- .../Cars/Status/DigitalTwinTab.test.jsx | 5 + .../__snapshots__/CANFiltersTab.test.jsx.snap | 14 +- .../__snapshots__/CarUpdatesTab.test.jsx.snap | 10 +- .../__snapshots__/DetailsTab.test.jsx.snap | 12 +- .../DigitalTwinTab.test.jsx.snap | 10 +- .../Status/__snapshots__/index.test.jsx.snap | 18 +- src/components/Cars/Status/index.test.jsx | 15 +- .../Update/__snapshots__/index.test.jsx.snap | 86 +-- src/components/Cars/Update/index.test.jsx | 11 +- .../Certificates/Add/DownloadCerts.test.jsx | 2 + .../__snapshots__/DownloadCerts.test.jsx.snap | 2 +- .../CarUpdateStatusProgress.test.jsx | 5 + .../CarUpdateStatusProgress.test.jsx.snap | 308 ++++---- .../CarUpdateStatusTable.test.jsx | 13 +- .../CarUpdateStatusTable.test.jsx.snap | 4 +- .../Controls/DownloadFileLink/index.test.jsx | 2 + .../Controls/ResponsiveIFrame/index.jsx | 17 +- .../Controls/TabPanel/index.test.jsx | 10 +- src/components/Dashboard/index.jsx | 26 + .../Add/__snapshots__/index.test.jsx.snap | 74 +- src/components/Fleets/Add/index.test.jsx | 11 +- .../Add/__snapshots__/index.test.jsx.snap | 18 +- .../Status/CANFilters/Add/index.test.jsx | 9 +- .../Table/__snapshots__/index.test.jsx.snap | 12 +- .../Status/CANFilters/Table/index.test.jsx | 13 +- .../Update/__snapshots__/index.test.jsx.snap | 18 +- .../Status/CANFilters/Update/index.test.jsx | 9 +- .../Fleets/Status/CANFiltersTab.test.jsx | 15 +- .../Details/__snapshots__/index.test.jsx.snap | 10 +- .../Fleets/Status/Details/index.test.jsx | 11 +- .../Fleets/Status/DetailsTab.test.jsx | 19 +- .../Add/__snapshots__/index.test.jsx.snap | 10 +- .../Fleets/Status/Vehicles/Add/index.test.jsx | 11 +- .../Table/__snapshots__/index.test.jsx.snap | 12 +- .../Status/Vehicles/Table/index.test.jsx | 15 +- .../Fleets/Status/VehiclesTab.test.jsx | 15 +- .../__snapshots__/CANFiltersTab.test.jsx.snap | 14 +- .../__snapshots__/DetailsTab.test.jsx.snap | 12 +- .../__snapshots__/VehiclesTab.test.jsx.snap | 14 +- .../Status/__snapshots__/index.test.jsx.snap | 20 +- src/components/Fleets/Status/index.test.jsx | 15 +- .../Table/__snapshots__/index.test.jsx.snap | 14 +- src/components/Fleets/Table/index.test.jsx | 15 +- .../Update/__snapshots__/index.test.jsx.snap | 74 +- src/components/Fleets/Update/index.test.jsx | 11 +- src/components/Home/index.jsx | 1 - src/components/Layouts/SideMenu.jsx | 6 +- src/components/Layouts/SideMenu.test.jsx | 5 + .../__snapshots__/SideMenu.test.jsx.snap | 6 +- .../Details/__snapshots__/index.test.jsx.snap | 8 +- .../Manifest/Details/index.test.jsx | 2 + src/components/Routes/SiteRoutes.jsx | 10 +- src/components/SMS/Send/ViewResult.test.jsx | 2 + .../__snapshots__/ViewResult.test.jsx.snap | 2 +- src/components/SSOForm/SSOForm.test.js | 7 +- .../__snapshots__/SSOForm.test.js.snap | 4 +- .../Details/__snapshots__/index.test.js.snap | 32 +- .../Suppliers/Details/index.test.js | 5 + .../List/__snapshots__/index.test.jsx.snap | 6 +- src/components/Suppliers/List/index.test.jsx | 5 + src/components/useStyles.jsx | 9 + src/utils/snapshot.js | 35 + 82 files changed, 1219 insertions(+), 1008 deletions(-) create mode 100644 src/components/Dashboard/index.jsx create mode 100644 src/utils/snapshot.js diff --git a/.env.dev b/.env.dev index add2ed2..ce1b79c 100644 --- a/.env.dev +++ b/.env.dev @@ -2,4 +2,4 @@ REACT_APP_CERT_SERVICE_URL=https://dev-gw.cloud.fiskerinc.com/certificate REACT_APP_AUTH_SERVICE_URL=https://dev-gw.cloud.fiskerinc.com/compute_auth REACT_APP_UPLOAD_SERVICE_URL=https://dev-gw.cloud.fiskerinc.com/ota_update REACT_APP_AUTH_CALLBACK_URL=https://dev-ota-admin.cloud.fiskerinc.com -REACT_APP_SUPERSET_URL=https://dev-superset.cloud.fiskerinc.com +REACT_APP_SUPERSET_URL=http://superset-dev.fiskercloud.internal/superset/dashboard/8/?native_filters_key=KPnPthpLQ8rT--6PUdsPzQAcwnleRGHk_3dg0PVYfrXc3SE6zZ2x0p7JuerAZ0Pg diff --git a/.env.local b/.env.local index e8d2226..7a58b1b 100644 --- a/.env.local +++ b/.env.local @@ -2,4 +2,4 @@ REACT_APP_AUTH_SERVICE_URL=http://localhost/compute_auth REACT_APP_CERT_SERVICE_URL=http://localhost/certificate REACT_APP_UPLOAD_SERVICE_URL=http://localhost/ota_update REACT_APP_AUTH_CALLBACK_URL=http://localhost:3000 -REACT_APP_SUPERSET_URL=https://dev-superset.cloud.fiskerinc.com +REACT_APP_SUPERSET_URL=http://superset-dev.fiskercloud.internal/superset/dashboard/8/?native_filters_key=KPnPthpLQ8rT--6PUdsPzQAcwnleRGHk_3dg0PVYfrXc3SE6zZ2x0p7JuerAZ0Pg diff --git a/.env.stg b/.env.stg index 70fac71..ae036f3 100644 --- a/.env.stg +++ b/.env.stg @@ -2,4 +2,4 @@ REACT_APP_AUTH_SERVICE_URL=https://stg-gw.cloud.fiskerinc.com/compute_auth REACT_APP_CERT_SERVICE_URL=https://stg-gw.cloud.fiskerinc.com/certificate REACT_APP_UPLOAD_SERVICE_URL=https://stg-gw.cloud.fiskerinc.com/ota_update REACT_APP_AUTH_CALLBACK_URL=https://stg-ota-admin.cloud.fiskerinc.com -REACT_APP_SUPERSET_URL=https://stg-superset.cloud.fiskerinc.com +REACT_APP_SUPERSET_URL=http://superset-dev.fiskercloud.internal/superset/dashboard/8/?native_filters_key=KPnPthpLQ8rT--6PUdsPzQAcwnleRGHk_3dg0PVYfrXc3SE6zZ2x0p7JuerAZ0Pg diff --git a/src/components/App/App.test.js b/src/components/App/App.test.js index e92f442..1c40617 100644 --- a/src/components/App/App.test.js +++ b/src/components/App/App.test.js @@ -17,6 +17,7 @@ import { import { setToken } from "../Contexts/UserContext"; import { TEST_AUTH_OBJECT } from "../../utils/testing"; import App from "."; +import addSnapshotSerializer from "../../utils/snapshot"; const LOADING_STATUS = "Loading..."; @@ -43,32 +44,8 @@ const sleepAndCheck = async (path, selector, compare) => { }; describe("App", () => { - const rxMakeStyles = /makeStyles-(\w+)-(\d+)/gi; - beforeAll(() => { - // Stablize Table Pagination control ids - expect.addSnapshotSerializer({ - test: function (val) { - return val && typeof val === "string" && val.indexOf("mui-") > -1; - }, - print: function (val) { - let str = val; - str = str.replace(/mui-\d*/g, "mui-00000"); - - return `"${str}"`; - }, - }); - expect.addSnapshotSerializer({ - test: (val) => { - return val && typeof val === "string" && val.search(rxMakeStyles) > -1; - }, - print: function (val) { - let str = val; - str = str.replace(rxMakeStyles, "makeStyles-$1-0000"); - - return `"${str}"`; - }, - }); + addSnapshotSerializer(expect); }, 60000); afterEach(() => { @@ -134,7 +111,7 @@ describe("App", () => { it("Route /tools/sms/send unauthenticated", async () => { await check("/tools/sms/send", "span.MuiButton-label", "Sign In"); - }) + }); it("Route /page-not-found unauthenticated", async () => { await check("/page-not-found", "h1", "Page Not Found"); diff --git a/src/components/App/__snapshots__/App.test.js.snap b/src/components/App/__snapshots__/App.test.js.snap index ebc871d..57bb2d5 100644 --- a/src/components/App/__snapshots__/App.test.js.snap +++ b/src/components/App/__snapshots__/App.test.js.snap @@ -6,10 +6,10 @@ exports[`App Route / authenticated 1`] = ` data-testid="mocked-userprovider" >