From 547a2128b76d88ed1425e0cfeb2a576f56365852 Mon Sep 17 00:00:00 2001 From: dexamundsen Date: Sun, 1 Dec 2024 13:32:35 -0800 Subject: [PATCH] format --- ui/cypress/support/e2e.js | 71 ++++++++++++++++++++------------------- ui/package-lock.json | 24 ++++++------- ui/src/app.test.tsx | 52 +++++++++++++++------------- 3 files changed, 78 insertions(+), 69 deletions(-) diff --git a/ui/cypress/support/e2e.js b/ui/cypress/support/e2e.js index 107558e56..9d5f33ef9 100644 --- a/ui/cypress/support/e2e.js +++ b/ui/cypress/support/e2e.js @@ -31,48 +31,51 @@ Cypress.Commands.add("createCohortFromSearch", (name, search, domain) => { cy.iframe().find("button[aria-label=back]").click(); }); -Cypress.Commands.add("createCohortFromSearchThenAddAnnotationData", (name, search, domain) => { - cy.get("button:Contains(New cohort)").click(); - cy.wait(2000); - - cy.iframe().find("[data-testid='EditIcon']").first().click(); - cy.iframe() - .find("input[name=text]") - .type("{selectall}" + name); - cy.iframe().find("button:Contains(Update)").click(); - cy.iframe().find("a:Contains(Add some criteria)").first().click(); - if (domain) { - cy.iframe().find(`[data-testid='${domain}']`).click(); - } - cy.iframe().find("input").type(search); +Cypress.Commands.add( + "createCohortFromSearchThenAddAnnotationData", + (name, search, domain) => { + cy.get("button:Contains(New cohort)").click(); + cy.wait(2000); + + cy.iframe().find("[data-testid='EditIcon']").first().click(); + cy.iframe() + .find("input[name=text]") + .type("{selectall}" + name); + cy.iframe().find("button:Contains(Update)").click(); + cy.iframe().find("a:Contains(Add some criteria)").first().click(); + if (domain) { + cy.iframe().find(`[data-testid='${domain}']`).click(); + } + cy.iframe().find("input").type(search); - cy.possiblyMultiSelect(search); + cy.possiblyMultiSelect(search); - cy.iframe().contains("Review").click(); + cy.iframe().contains("Review").click(); - cy.iframe().find("[data-testid='AddIcon']").first().click(); - cy.iframe().find("input[name=name]").type("Initial"); - cy.iframe().find("input[name=size]").type("2"); - cy.iframe().find("button:Contains(Create)").click(); + cy.iframe().find("[data-testid='AddIcon']").first().click(); + cy.iframe().find("input[name=name]").type("Initial"); + cy.iframe().find("input[name=size]").type("2"); + cy.iframe().find("button:Contains(Create)").click(); - cy.iframe().find("button:Contains(Annotations)").click(); + cy.iframe().find("button:Contains(Annotations)").click(); - cy.iframe().contains("Add annotation field").click(); - cy.iframe().find(".MuiSelect-select:Contains(Free text)").click(); - cy.iframe().find("li:Contains(Review status)").click(); - cy.iframe().find("input[name=displayName]").type("Test status"); - cy.iframe().find("button:Contains(Create)").click().should("not.exist"); + cy.iframe().contains("Add annotation field").click(); + cy.iframe().find(".MuiSelect-select:Contains(Free text)").click(); + cy.iframe().find("li:Contains(Review status)").click(); + cy.iframe().find("input[name=displayName]").type("Test status"); + cy.iframe().find("button:Contains(Create)").click().should("not.exist"); - cy.iframe().find("button:Contains(Reviews)").click(); - cy.iframe().find("button:Contains(Review individual participants)").click(); + cy.iframe().find("button:Contains(Reviews)").click(); + cy.iframe().find("button:Contains(Review individual participants)").click(); - cy.iframe().find(".MuiSelect-select").click(); - cy.iframe().find("li:Contains(Included)").click(); + cy.iframe().find(".MuiSelect-select").click(); + cy.iframe().find("li:Contains(Included)").click(); - cy.iframe().find("[data-testid='ArrowBackIcon']").first().click(); - cy.iframe().find("[data-testid='ArrowBackIcon']").first().click(); - cy.iframe().find("button[aria-label=back]", { timeout: 20000 }).click(); -}); + cy.iframe().find("[data-testid='ArrowBackIcon']").first().click(); + cy.iframe().find("[data-testid='ArrowBackIcon']").first().click(); + cy.iframe().find("button[aria-label=back]", { timeout: 20000 }).click(); + } +); Cypress.Commands.add("multiSelect", (search) => { cy.iframe() diff --git a/ui/package-lock.json b/ui/package-lock.json index 0ea1402a8..9ad6f9a47 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -4639,9 +4639,9 @@ "license": "BSD-3-Clause" }, "node_modules/@remix-run/router": { - "version": "1.21.0", - "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.21.0.tgz", - "integrity": "sha512-xfSkCAchbdG5PnbrKqFWwia4Bi61nH+wm8wLEqfHDyp7Y3dZzgqS2itV8i4gAq9pC2HsTpwyBC6Ds8VHZ96JlA==", + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.20.0.tgz", + "integrity": "sha512-mUnk8rPJBI9loFDZ+YzPGdeniYK+FTmRD1TMCz7ev2SNIozyKKpnGgsxO34u6Z4z/t0ITuu7voi/AshfsGsgFg==", "license": "MIT", "engines": { "node": ">=14.0.0" @@ -18153,12 +18153,12 @@ } }, "node_modules/react-router": { - "version": "6.28.0", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.28.0.tgz", - "integrity": "sha512-HrYdIFqdrnhDw0PqG/AKjAqEqM7AvxCz0DQ4h2W8k6nqmc5uRBYDag0SBxx9iYz5G8gnuNVLzUe13wl9eAsXXg==", + "version": "6.27.0", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.27.0.tgz", + "integrity": "sha512-YA+HGZXz4jaAkVoYBE98VQl+nVzI+cVI2Oj/06F5ZM+0u3TgedN9Y9kmMRo2mnkSK2nCpNQn0DVob4HCsY/WLw==", "license": "MIT", "dependencies": { - "@remix-run/router": "1.21.0" + "@remix-run/router": "1.20.0" }, "engines": { "node": ">=14.0.0" @@ -18168,13 +18168,13 @@ } }, "node_modules/react-router-dom": { - "version": "6.28.0", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.28.0.tgz", - "integrity": "sha512-kQ7Unsl5YdyOltsPGl31zOjLrDv+m2VcIEcIHqYYD3Lp0UppLjrzcfJqDJwXxFw3TH/yvapbnUvPlAj7Kx5nbg==", + "version": "6.27.0", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.27.0.tgz", + "integrity": "sha512-+bvtFWMC0DgAFrfKXKG9Fc+BcXWRUO1aJIihbB79xaeq0v5UzfvnM5houGUm1Y461WVRcgAQ+Clh5rdb1eCx4g==", "license": "MIT", "dependencies": { - "@remix-run/router": "1.21.0", - "react-router": "6.28.0" + "@remix-run/router": "1.20.0", + "react-router": "6.27.0" }, "engines": { "node": ">=14.0.0" diff --git a/ui/src/app.test.tsx b/ui/src/app.test.tsx index 0bdae6ef6..7274e3134 100644 --- a/ui/src/app.test.tsx +++ b/ui/src/app.test.tsx @@ -14,19 +14,17 @@ function renderApp(fakeAuthCtx?: FakeAuthContextType) { let appRouter: Router; if (fakeAuthCtx) { const env = getEnvironment(); - env.REACT_APP_AUTH0_DOMAIN = "fake-domain" - env.REACT_APP_AUTH0_CLIENT_ID = "fake-client" - env.REACT_APP_AUTH0_AUDIENCE = "fake-audience" - appRouter = createAppRouter({authCtx: fakeAuthCtx}); + env.REACT_APP_AUTH0_DOMAIN = "fake-domain"; + env.REACT_APP_AUTH0_CLIENT_ID = "fake-client"; + env.REACT_APP_AUTH0_AUDIENCE = "fake-audience"; + appRouter = createAppRouter({ authCtx: fakeAuthCtx }); render(); - } else { - appRouter = createAppRouter({} as AuthProviderProps); + appRouter = createAppRouter({} as AuthProviderProps); render(); - } - return appRouter + return appRouter; } test("render included datasets heading", async () => { @@ -41,37 +39,45 @@ test("render included datasets heading", async () => { }); test("with-auth: signed out redirects to login screen", () => { - renderApp( makeFakeAuth({ - expired: true - })); + renderApp( + makeFakeAuth({ + expired: true, + }) + ); expect(screen.getByText(logInText)).toBeInTheDocument(); - expect( - screen.getByRole("button", { name: logInText }) - ).toBeInTheDocument(); + expect(screen.getByRole("button", { name: logInText })).toBeInTheDocument(); }); test("with-auth: signed in renders the home page", async () => { - renderApp(makeFakeAuth({ - expired: false, profile: FakeProfile - })); + renderApp( + makeFakeAuth({ + expired: false, + profile: FakeProfile, + }) + ); await waitFor(() => { expect(screen.getByText(/underlay_name/i)).toBeInTheDocument(); }); }); test("with-auth: login page while signed in redirects to home page", () => { - const appRouter = renderApp(makeFakeAuth({ - expired: false, profile: FakeProfile - })); + const appRouter = renderApp( + makeFakeAuth({ + expired: false, + profile: FakeProfile, + }) + ); appRouter.navigate({ pathname: "/login" }); render(); expect(appRouter.state.location.pathname).toBe("/"); }); test("with-auth: signed out with bad url redirects to login screen", () => { - const appRouter = renderApp(makeFakeAuth({ - expired: true - })); + const appRouter = renderApp( + makeFakeAuth({ + expired: true, + }) + ); appRouter.navigate({ pathname: "/badurl" }); render(); expect(screen.getByText(logInText)).toBeInTheDocument();