From 1df67c20ee232434f05ab051944883ad973ff456 Mon Sep 17 00:00:00 2001 From: Benjamin Kane Date: Tue, 11 Jun 2024 12:49:53 -0400 Subject: [PATCH] fix return to index page, add index-page e2e spec (#4478) --- app/packages/app/src/Renderer.tsx | 2 +- .../app/src/components/DatasetSelector.tsx | 1 + app/packages/app/src/pages/IndexPage.tsx | 7 +- .../app/src/pages/datasets/DatasetPage.tsx | 24 ++++--- app/packages/app/src/routing/RouterContext.ts | 9 +-- .../app/src/useEvents/useStateUpdate.ts | 1 + e2e-pw/src/oss/poms/page.ts | 65 +++++++++++++++++++ .../specs/regression-tests/index-page.spec.ts | 36 ++++++++++ 8 files changed, 126 insertions(+), 19 deletions(-) create mode 100644 e2e-pw/src/oss/poms/page.ts create mode 100644 e2e-pw/src/oss/specs/regression-tests/index-page.spec.ts diff --git a/app/packages/app/src/Renderer.tsx b/app/packages/app/src/Renderer.tsx index d18d77ce88..c78eb4e3f3 100644 --- a/app/packages/app/src/Renderer.tsx +++ b/app/packages/app/src/Renderer.tsx @@ -45,7 +45,7 @@ const Renderer = () => { useEffect(() => { router.load().then(setRouteEntry); subscribe((_, { set }) => { - set(entry, router.get()); + set(entry, router.get(true)); set(pendingEntry, false); }); }, [router, setRouteEntry]); diff --git a/app/packages/app/src/components/DatasetSelector.tsx b/app/packages/app/src/components/DatasetSelector.tsx index 57eb85b95c..14b5f84431 100644 --- a/app/packages/app/src/components/DatasetSelector.tsx +++ b/app/packages/app/src/components/DatasetSelector.tsx @@ -22,6 +22,7 @@ const DatasetSelector: React.FC<{ return ( + cy={"dataset"} component={DatasetLink} placeholder={"Select dataset"} inputStyle={{ height: 40, maxWidth: 300 }} diff --git a/app/packages/app/src/pages/IndexPage.tsx b/app/packages/app/src/pages/IndexPage.tsx index b5a596080d..1bf331dc13 100644 --- a/app/packages/app/src/pages/IndexPage.tsx +++ b/app/packages/app/src/pages/IndexPage.tsx @@ -5,6 +5,7 @@ import { graphql } from "relay-runtime"; import Nav from "../components/Nav"; import { Route } from "../routing"; import { IndexPageQuery } from "./__generated__/IndexPageQuery.graphql"; +import style from "./index.module.css"; const IndexPageQueryNode = graphql` query IndexPageQuery($search: String = "", $count: Int, $cursor: String) { @@ -28,7 +29,11 @@ const IndexPage: Route = ({ prepared }) => { return ( <>