From dc77974ef6b259572fe79966e62c91910e99fdfd Mon Sep 17 00:00:00 2001 From: RachelElysia <71795832+RachelElysia@users.noreply.github.com> Date: Fri, 13 Aug 2021 10:41:53 -0400 Subject: [PATCH] Fleet UI: Reroute homepage (#1640) * Reroute homepage * Update e2e tests brittle URLs --- changes/1640-reroute-homepage | 1 + cypress/integration/all/app/hosts.spec.ts | 4 ++-- cypress/integration/all/sessions/sessions.spec.ts | 4 ++-- cypress/integration/all/sessions/sso.spec.ts | 4 ++-- cypress/integration/basic/admin.spec.ts | 2 +- cypress/integration/basic/maintainer.spec.ts | 2 +- cypress/integration/basic/observer.spec.ts | 4 +++- cypress/integration/basic/team_maintainer_observer.spec.ts | 4 ++-- cypress/integration/core/admin.spec.ts | 2 +- cypress/integration/core/maintainer.spec.ts | 2 +- cypress/integration/core/observer.spec.ts | 2 +- frontend/components/side_panels/SiteNavSidePanel/navItems.js | 2 +- frontend/router/index.jsx | 4 ++-- frontend/router/paths.ts | 2 +- 14 files changed, 21 insertions(+), 18 deletions(-) create mode 100644 changes/1640-reroute-homepage diff --git a/changes/1640-reroute-homepage b/changes/1640-reroute-homepage new file mode 100644 index 0000000000..03e97a4fd1 --- /dev/null +++ b/changes/1640-reroute-homepage @@ -0,0 +1 @@ +* Homepage is now routed to /home instead of hosts/manage \ No newline at end of file diff --git a/cypress/integration/all/app/hosts.spec.ts b/cypress/integration/all/app/hosts.spec.ts index ead1cbedef..4ca625f9a9 100644 --- a/cypress/integration/all/app/hosts.spec.ts +++ b/cypress/integration/all/app/hosts.spec.ts @@ -19,7 +19,7 @@ describe("Hosts page", () => { }, }, () => { - cy.visit("/"); + cy.visit("/hosts/manage"); cy.contains("button", /add new host/i).click(); @@ -40,7 +40,7 @@ describe("Hosts page", () => { // testing, but may vary by environment). cy.waitUntil( () => { - cy.visit("/"); + cy.visit("/hosts/manage"); return Cypress.$('button[title="Online"]').length > 0; }, { timeout: 30000, interval: 1000 } diff --git a/cypress/integration/all/sessions/sessions.spec.ts b/cypress/integration/all/sessions/sessions.spec.ts index 31caad1eef..9ae5820cc8 100644 --- a/cypress/integration/all/sessions/sessions.spec.ts +++ b/cypress/integration/all/sessions/sessions.spec.ts @@ -15,8 +15,8 @@ describe("Sessions", () => { cy.get("button").click(); // Verify dashboard - cy.url().should("include", "/hosts/manage"); - cy.contains("All Hosts"); + cy.url().should("include", "/home"); + cy.contains("Hosts"); // Log out cy.findByAltText(/user avatar/i).click(); diff --git a/cypress/integration/all/sessions/sso.spec.ts b/cypress/integration/all/sessions/sso.spec.ts index f92590bc8e..f33473f1e1 100644 --- a/cypress/integration/all/sessions/sso.spec.ts +++ b/cypress/integration/all/sessions/sso.spec.ts @@ -17,8 +17,8 @@ describe("SSO Sessions", () => { cy.contains("button", "Login").click(); // Verify dashboard - cy.url().should("include", "/hosts/manage"); - cy.contains("All Hosts"); + cy.url().should("include", "/home"); + cy.contains("Hosts"); // Log out cy.findByAltText(/user avatar/i).click(); diff --git a/cypress/integration/basic/admin.spec.ts b/cypress/integration/basic/admin.spec.ts index f9d055d1c6..6fe5a4bbda 100644 --- a/cypress/integration/basic/admin.spec.ts +++ b/cypress/integration/basic/admin.spec.ts @@ -14,7 +14,7 @@ describe("Basic tier - Admin user", () => { it("Can perform the appropriate basic-tier admin actions", () => { cy.login("anna@organization.com", "user123#"); - cy.visit("/"); + cy.visit("/hosts/manage"); // Ensure the hosts page is loaded cy.contains("All hosts"); diff --git a/cypress/integration/basic/maintainer.spec.ts b/cypress/integration/basic/maintainer.spec.ts index be5aa17250..2bf8476f34 100644 --- a/cypress/integration/basic/maintainer.spec.ts +++ b/cypress/integration/basic/maintainer.spec.ts @@ -14,7 +14,7 @@ describe("Basic tier - Maintainer user", () => { it("Can perform the appropriate basic global maintainer actions", () => { cy.login("mary@organization.com", "user123#"); - cy.visit("/"); + cy.visit("/hosts/manage"); // Ensure page is loaded cy.contains("All hosts"); diff --git a/cypress/integration/basic/observer.spec.ts b/cypress/integration/basic/observer.spec.ts index 2002dd20d7..4f8968b405 100644 --- a/cypress/integration/basic/observer.spec.ts +++ b/cypress/integration/basic/observer.spec.ts @@ -14,7 +14,7 @@ describe("Basic tier - Observer user", () => { it("Can perform the appropriate basic global observer actions", () => { cy.login("oliver@organization.com", "user123#"); - cy.visit("/"); + cy.visit("/hosts/manage"); // Ensure page is loaded cy.contains("All hosts"); @@ -67,6 +67,8 @@ describe("Basic tier - Observer user", () => { cy.visit("/schedule/manage"); cy.findByText(/you do not have permissions/i).should("exist"); + cy.visit("/hosts/manage"); + cy.contains(".table-container .data-table__table th", "Team").should( "be.visible" ); diff --git a/cypress/integration/basic/team_maintainer_observer.spec.ts b/cypress/integration/basic/team_maintainer_observer.spec.ts index c734a13055..6d25e39d00 100644 --- a/cypress/integration/basic/team_maintainer_observer.spec.ts +++ b/cypress/integration/basic/team_maintainer_observer.spec.ts @@ -13,7 +13,7 @@ describe("Basic tier - Team observer/maintainer user", () => { it("Can perform the appropriate team observer actions", () => { cy.login("marco@organization.com", "user123#"); - cy.visit("/"); + cy.visit("/hosts/manage"); // Ensure page is loaded cy.contains("Hosts"); @@ -107,7 +107,7 @@ describe("Basic tier - Team observer/maintainer user", () => { it("Can perform the appropriate maintainer actions", () => { cy.login("marco@organization.com", "user123#"); - cy.visit("/"); + cy.visit("/hosts/manage"); // Ensure page is loaded and appropriate nav links are displayed cy.contains("Hosts"); diff --git a/cypress/integration/core/admin.spec.ts b/cypress/integration/core/admin.spec.ts index 92599c502c..a0fd62d062 100644 --- a/cypress/integration/core/admin.spec.ts +++ b/cypress/integration/core/admin.spec.ts @@ -14,7 +14,7 @@ describe("Core tier - Admin user", () => { it("Can perform the appropriate core-tier admin actions", () => { cy.login("anna@organization.com", "user123#"); - cy.visit("/"); + cy.visit("/hosts/manage"); // Ensure page is loaded cy.contains("All hosts"); diff --git a/cypress/integration/core/maintainer.spec.ts b/cypress/integration/core/maintainer.spec.ts index 3d3741410f..e4613237a6 100644 --- a/cypress/integration/core/maintainer.spec.ts +++ b/cypress/integration/core/maintainer.spec.ts @@ -14,7 +14,7 @@ describe("Core tier - Maintainer user", () => { it("Can perform the appropriate core global maintainer actions", () => { cy.login("mary@organization.com", "user123#"); - cy.visit("/"); + cy.visit("/hosts/manage"); // Ensure page is loaded cy.contains("All hosts"); diff --git a/cypress/integration/core/observer.spec.ts b/cypress/integration/core/observer.spec.ts index 9a7b3832f9..bce7f913c5 100644 --- a/cypress/integration/core/observer.spec.ts +++ b/cypress/integration/core/observer.spec.ts @@ -14,7 +14,7 @@ describe("Core tier - Observer user", () => { it("Can perform the appropriate core global observer actions", () => { cy.login("oliver@organization.com", "user123#"); - cy.visit("/"); + cy.visit("/hosts/manage"); // Ensure page is loaded cy.contains("All hosts"); diff --git a/frontend/components/side_panels/SiteNavSidePanel/navItems.js b/frontend/components/side_panels/SiteNavSidePanel/navItems.js index b5bbc1c40e..38190de39c 100644 --- a/frontend/components/side_panels/SiteNavSidePanel/navItems.js +++ b/frontend/components/side_panels/SiteNavSidePanel/navItems.js @@ -21,7 +21,7 @@ export default (currentUser) => { name: "Home", iconName: "logo", location: { - regex: new RegExp(`^${URL_PREFIX}/home/dashboard`), + regex: new RegExp(`^${URL_PREFIX}/home`), pathname: PATHS.HOMEPAGE, }, }, diff --git a/frontend/router/index.jsx b/frontend/router/index.jsx index 2a7b6f7dc0..d904b15e1f 100644 --- a/frontend/router/index.jsx +++ b/frontend/router/index.jsx @@ -69,8 +69,8 @@ const routes = ( - - + + diff --git a/frontend/router/paths.ts b/frontend/router/paths.ts index 536edae829..eb08ea9752 100644 --- a/frontend/router/paths.ts +++ b/frontend/router/paths.ts @@ -23,7 +23,7 @@ export default { FLEET_403: `${URL_PREFIX}/403`, FLEET_500: `${URL_PREFIX}/500`, LOGIN: `${URL_PREFIX}/login`, - HOMEPAGE: `${URL_PREFIX}/home/dashboard`, + HOMEPAGE: `${URL_PREFIX}/home`, LOGOUT: `${URL_PREFIX}/logout`, MANAGE_HOSTS: `${URL_PREFIX}/hosts/manage`, HOST_DETAILS: (host: IHost): string => {