Skip to content

Commit

Permalink
chore: pull develop, fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Psami-wondah committed Oct 3, 2024
2 parents eeaf6fb + 58a8ed9 commit fc956b8
Show file tree
Hide file tree
Showing 190 changed files with 7,113 additions and 3,177 deletions.
24 changes: 20 additions & 4 deletions cypress/e2e/1-dx/2-datasets.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,30 @@ describe("Testing connecting data on DX", () => {
cy.restoreLocalStorageCache();
// cy.setGoogleAccessToken();

cy.intercept("GET", `${apiUrl}/users/plan-data`).as("planData");

cy.visit("/");

cy.wait("@planData");

cy.get('[data-cy="cookie-btn"]').click();
cy.intercept(`${apiUrl}/external-sources/search?q=*`).as("getDefaultData");
cy.get('[data-cy="home-connect-dataset-button"]').click();
cy.wait("@planData");
});

it("Can filter results by source in the federated search", () => {
cy.wait("@getDefaultData").then((interception) => {
cy.wait(2000);
cy.contains('[data-cy="source-category-button"]', "Kaggle").click();
cy.wait("@getDefaultData");
cy.get('[data-cy="external-search-card-Kaggle"]').should(
"have.length.greaterThan",
1
);
});
cy.wait(2000);
cy.contains('[data-cy="source-category-button"]', "Kaggle").click();

cy.contains('[data-cy="source-category-button"]', "WHO").click();
cy.wait("@getDefaultData");
Expand All @@ -49,18 +58,21 @@ describe("Testing connecting data on DX", () => {

it("Can import data from External Search", () => {
cy.wait("@getDefaultData").then((interception) => {
cy.wait(2000);
cy.contains('[data-cy="source-category-button"]', "Kaggle").click();
cy.wait("@getDefaultData");
cy.get('[data-cy="external-search-card-Kaggle"]').should(
"have.length.greaterThan",
1
);
});

cy.get('[data-cy="open-search-button"]').click();
cy.intercept(`${apiUrl}/external-sources/search?q=world%20population*`).as(
"getDefaultData2"
);
cy.intercept(
`${apiUrl}/external-sources/search?q=Exclusive%20breastfeeding*`
).as("getDefaultData2");
cy.wait(2000);
cy.get('[data-cy="filter-search-input"]').type("world population");
cy.get('[data-cy="filter-search-input"]').type("Exclusive breastfeeding");

cy.wait("@getDefaultData2").then((interception) => {
cy.get('[data-cy="external-search-card-Kaggle"]').should(
Expand Down Expand Up @@ -205,7 +217,11 @@ describe("Edit, Delete and Duplicate Dataset", () => {

beforeEach(() => {
cy.restoreLocalStorageCache();
cy.intercept("GET", `${apiUrl}/users/plan-data`).as("planData");

cy.visit("/");

cy.wait("@planData");
cy.get('[data-cy="cookie-btn"]').click();

cy.intercept("GET", `${apiUrl}/datasets?filter=*`).as("fetchDatasets");
Expand Down
12 changes: 12 additions & 0 deletions cypress/e2e/1-dx/3-charts.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ describe("Testing create chart on DX", () => {

beforeEach(() => {
cy.restoreLocalStorageCache();
cy.intercept("GET", `${apiUrl}/users/plan-data`).as("planData");

cy.visit("/");

cy.wait("@planData");

cy.get('[data-cy="cookie-btn"]').click();

cy.intercept("GET", `${apiUrl}/datasets?**`).as("getDatasets");
Expand Down Expand Up @@ -186,8 +190,12 @@ describe("Testing Ai chart creation", () => {

beforeEach(() => {
cy.restoreLocalStorageCache();
cy.intercept("GET", `${apiUrl}/users/plan-data`).as("planData");

cy.visit("/");

cy.wait("@planData");

cy.get('[data-cy="cookie-btn"]').click();
cy.intercept("GET", `${apiUrl}/datasets?**`).as("getDatasets");
cy.get('[data-cy="home-create-chart-button"]').click();
Expand Down Expand Up @@ -271,8 +279,12 @@ describe("Edit, duplicate and delete chart", () => {
const apiUrl = Cypress.env("api_url");
beforeEach(() => {
cy.restoreLocalStorageCache();
cy.intercept("GET", `${apiUrl}/users/plan-data`).as("planData");

cy.visit("/");

cy.wait("@planData");

cy.get('[data-cy="cookie-btn"]').click();

cy.intercept("GET", `${apiUrl}/charts*`).as("fetchCharts");
Expand Down
24 changes: 15 additions & 9 deletions cypress/e2e/1-dx/4-reports.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ describe("Testing reports on DX", () => {
cy.restoreLocalStorageCache();

// Navigating to dx home page
cy.intercept("GET", `${apiUrl}/users/plan-data`).as("planData");

cy.visit("/");

cy.wait("@planData");

cy.get('[data-cy="cookie-btn"]').click();
});

Expand All @@ -43,11 +47,9 @@ describe("Testing reports on DX", () => {
cy.get('[data-cy="report-sub-header-title-input"]').type(reportTestName);

cy.get('[data-cy="report-header-block"]').within(() => {
cy.get('[data-cy="report-header-block-title-input"]').type(
reportTestName
);
cy.get('[data-cy="rich-text-editor-container"]').click();
cy.get('[data-testid="rich-text-editor"]').type(
cy.get('[data-testid="heading-rich-text-editor"]').type(reportTestName);
cy.get('[data-cy="description-rich-text-editor-container"]').click();
cy.get('[data-testid="description-rich-text-editor"]').type(
"This is a report on football players"
);
});
Expand Down Expand Up @@ -75,7 +77,7 @@ describe("Testing reports on DX", () => {
cy.get('[data-cy="row-frame-item-drop-zone-0-0"]').drop();

cy.get("[data-cy=row-frame-0]").within(() => {
cy.get('[data-testid="rich-text-editor"]')
cy.get('[data-testid="report-rich-text-editor"]')
.first()
.type(
"This is a report on football players who played in a match last year"
Expand Down Expand Up @@ -176,8 +178,12 @@ describe("Edit, duplicate and delete report", () => {

beforeEach(() => {
cy.restoreLocalStorageCache();
cy.intercept("GET", `${apiUrl}/users/plan-data`).as("planData");

cy.visit("/");

cy.wait("@planData");

cy.get('[data-cy="cookie-btn"]').click();

cy.intercept(`${apiUrl}/reports?filter=*`).as("fetchReports");
Expand Down Expand Up @@ -213,9 +219,9 @@ describe("Edit, duplicate and delete report", () => {
cy.get('[data-cy="report-sub-header-title-input"]').type(" - Edited");

cy.get('[data-cy="report-header-block"]').within(() => {
cy.get('[data-cy="report-header-block-title-input"]').type(" - Edited");
cy.get('[data-cy="rich-text-editor-container"]').click();
cy.get('[data-testid="rich-text-editor"]').type(" - Edited");
cy.get('[data-testid="heading-rich-text-editor"]').type(" - Edited");
cy.get('[data-cy="description-rich-text-editor-container"]').click();
cy.get('[data-testid="description-rich-text-editor"]').type(" - Edited");
});

cy.get('[data-cy="save-report-button"]').click();
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@draft-js-plugins/text-alignment": "^2.0.1",
"@draft-js-plugins/undo": "^4.1.3",
"@hookform/resolvers": "^3.3.0",
"@livesession/sdk": "^1.1.4",
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.57",
Expand All @@ -34,6 +35,7 @@
"@types/react-router-hash-link": "^2.4.0",
"auth0-js": "^9.23.3",
"axios": "0.24.0",
"css-mediaquery": "^0.1.2",
"d3-hierarchy": "^3.1.2",
"detect-it": "^4.0.1",
"dom-to-image": "^2.6.0",
Expand Down Expand Up @@ -67,6 +69,7 @@
"react-hook-form": "^7.43.9",
"react-indexed-db": "^1.0.12",
"react-range": "1.4.7",
"react-responsive-carousel": "^3.2.23",
"react-router-dom": "^5.2.0",
"react-router-hash-link": "^2.4.3",
"react-scripts": "^5.0.0",
Expand All @@ -89,6 +92,7 @@
},
"devDependencies": {
"@testing-library/user-event": "14.5.2",
"@types/css-mediaquery": "^0.1.4",
"@types/d3-hierarchy": "^3.1.6",
"@types/jest": "^29.5.12",
"@types/node": "^14.14.41",
Expand Down Expand Up @@ -119,6 +123,7 @@
"depcheck": "depcheck",
"start": "craco --max_old_space_size=4096 start",
"build": "craco --max_old_space_size=4096 build",
"test-no-coverage": "react-scripts test --watchAll=true",
"test": "react-scripts test --watchAll=false --coverage",
"eject": "craco eject",
"upgrade-all": "yarn-upgrade-all",
Expand Down
6 changes: 3 additions & 3 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
</script>
<!-- end of linkedIn track tag -->
<!-- LiveSession.io code -->
<script type="text/javascript">
<!-- <script type="text/javascript">
if (
window.location.hostname === "dataxplorer.org" ||
window.location.hostname === "www.dataxplorer.org"
Expand Down Expand Up @@ -192,10 +192,10 @@
window["__ls_script_url"],
window["__ls_namespace"]
);
__ls("init", "2db6e1f8.44426a15", { keystrokes: false });
__ls("init", "2db6e1f8.99b8c0c5", { keystrokes: false });
__ls("newPageView");
}
</script>
</script> -->
<!-- END LiveSession.io code -->
</head>
<body>
Expand Down
24 changes: 19 additions & 5 deletions src/app/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import React, { Suspense, lazy } from "react";
import { socialAuth } from "app/utils/socialAuth";
import { useScrollToTop } from "app/hooks/useScrollToTop";
import { useRouteListener } from "app/hooks/useRouteListener";
import { PageLoader } from "app/modules/common/page-loader";
import { RouteWithAppBar } from "app/utils/RouteWithAppBar";
import { Route, Switch, useHistory, useLocation } from "react-router-dom";
Expand All @@ -24,6 +25,8 @@ import {
PaymentSuccessCallbackModule,
PaymentCanceledCallbackModule,
} from "app/modules/callback-module/payment";
import { useRecoilValue } from "recoil";
import { fetchPlanLoadingAtom } from "./state/recoil/atoms";

const LandingModule = lazy(
() => import("app/modules/home-module/sub-modules/landing")
Expand Down Expand Up @@ -103,6 +106,15 @@ const Auth0ProviderWithRedirectCallback = (props: {
);
};

const PlanLoader = () => {
const planLoading = useRecoilValue(fetchPlanLoadingAtom);

if (planLoading) {
return <PageLoader />;
}
return null;
};

const AuthLoader = () => {
const { isLoading } = useAuth0();

Expand Down Expand Up @@ -160,8 +172,6 @@ const IntercomBootupComponent = () => {
const { isAuthenticated, user, getAccessTokenSilently } = useAuth0();
const location = useLocation();

const APP_ID = "tfvurn19";

React.useEffect(() => {
if (window?.Intercom) {
window.Intercom("update");
Expand Down Expand Up @@ -193,7 +203,7 @@ const IntercomBootupComponent = () => {
// @ts-ignore
window.Intercom("boot", {
api_base: "https://api-iam.intercom.io",
app_id: APP_ID,
app_id: process.env.REACT_APP_INTERCOM_APP_ID,
name: user?.name, // Full name
email: user?.email, // the email for your user
user_id: user?.sub, // user_id as a string
Expand All @@ -209,7 +219,7 @@ const IntercomBootupComponent = () => {
// @ts-ignore
window.Intercom("boot", {
api_base: "https://api-iam.intercom.io",
app_id: APP_ID,
app_id: process.env.REACT_APP_INTERCOM_APP_ID,
});
}
}, [isAuthenticated]);
Expand All @@ -219,6 +229,7 @@ const IntercomBootupComponent = () => {

export function MainRoutes() {
useScrollToTop();
useRouteListener();

return (
<Auth0ProviderWithRedirectCallback
Expand All @@ -230,8 +241,11 @@ export function MainRoutes() {
}}
>
<AuthLoader />
<PlanLoader />
<OneTapLoginComponent />
{process.env.ENV_TYPE === "prod" ? <IntercomBootupComponent /> : null}
{process.env.REACT_APP_ENV_TYPE === "prod" ? (
<IntercomBootupComponent />
) : null}
<Suspense fallback={<PageLoader />}>
<Switch>
<Route exact path="/callback">
Expand Down
Loading

0 comments on commit fc956b8

Please sign in to comment.