diff --git a/src/Geopilot.Api/Program.cs b/src/Geopilot.Api/Program.cs index 825bf0d0..8f3720e8 100644 --- a/src/Geopilot.Api/Program.cs +++ b/src/Geopilot.Api/Program.cs @@ -212,6 +212,8 @@ app.UseDefaultFiles(); app.UseStaticFiles(); +app.UseRouting(); + if (app.Environment.IsDevelopment()) { app.UseCors("All"); @@ -264,4 +266,6 @@ app.MapReverseProxy(); +app.MapFallbackToFile("index.html"); + app.Run(); diff --git a/src/Geopilot.Frontend/cypress/e2e/app.cy.js b/src/Geopilot.Frontend/cypress/e2e/app.cy.js index c8ff4362..280f0fe3 100644 --- a/src/Geopilot.Frontend/cypress/e2e/app.cy.js +++ b/src/Geopilot.Frontend/cypress/e2e/app.cy.js @@ -14,6 +14,7 @@ describe("General app tests", () => { it("shows no login button if auth settings could not be loaded", () => { loadWithoutAuth(); cy.get('[data-cy="login-button"]').should("not.exist"); + cy.get('[data-cy="delivery"]').should("exist"); }); it.skip("registers new users and logs them in", () => { @@ -52,23 +53,30 @@ describe("General app tests", () => { selectAdminNavItem("mandates"); selectAdminNavItem("organisations"); selectAdminNavItem("delivery-overview"); + cy.reload(); + isSelectedNavItem("admin-delivery-overview-nav", "admin-navigation"); + cy.location().should(location => { + expect(location.pathname).to.eq("/admin/delivery-overview"); + }); }); it("updates the language when the user selects a different language", () => { - cy.visit("/"); + loginAsAdmin(); + openTool("admin"); + cy.contains("EN"); - cy.contains("Log In"); + cy.contains("Rows per page"); selectLanguage("de"); cy.contains("DE"); - cy.contains("Anmelden"); + cy.contains("Zeilen pro Seite"); selectLanguage("fr"); cy.contains("FR"); - cy.contains("Se connecter"); + cy.contains("Lignes par page"); selectLanguage("it"); cy.contains("IT"); - cy.contains("Accedi"); + cy.contains("Righe per pagina"); }); }); diff --git a/src/Geopilot.Frontend/cypress/e2e/helpers/appHelpers.js b/src/Geopilot.Frontend/cypress/e2e/helpers/appHelpers.js index 7d0ab576..b85f7ce4 100644 --- a/src/Geopilot.Frontend/cypress/e2e/helpers/appHelpers.js +++ b/src/Geopilot.Frontend/cypress/e2e/helpers/appHelpers.js @@ -119,9 +119,12 @@ export const createBaseSelector = parent => { * Opens the tool navigation. Requires the user to be logged in. */ export const openToolMenu = () => { - if (!cy.get('[data-cy="tool-navigation"]').should("be.visible")) { - cy.get('[data-cy="loggedInUser-button"]').click(); - } + cy.get("body").then($body => { + const elementExists = $body.find('[data-cy="tool-navigation"]').length > 0; + if (!elementExists) { + cy.get('[data-cy="loggedInUser-button"]').click(); + } + }); }; /** diff --git a/src/Geopilot.Frontend/src/app.tsx b/src/Geopilot.Frontend/src/app.tsx index 02b64fe3..09bb9517 100644 --- a/src/Geopilot.Frontend/src/app.tsx +++ b/src/Geopilot.Frontend/src/app.tsx @@ -15,10 +15,11 @@ import { PrivacyPolicy } from "./pages/footer/privacyPolicy.tsx"; import { About } from "./pages/footer/about.tsx"; import { Imprint } from "./pages/footer/imprint.tsx"; import { DeliveryProvider } from "./pages/delivery/deliveryContext.tsx"; +import { CircularProgress } from "@mui/material"; export const App: FC = () => { const [isSubMenuOpen, setIsSubMenuOpen] = useState(false); - const { isAdmin } = useGeopilotAuth(); + const { isLoading, isAdmin } = useGeopilotAuth(); return ( @@ -30,34 +31,38 @@ export const App: FC = () => { /> - - - - - } - /> - {isAdmin ? ( - <> - } /> - }> - } /> - } /> - } /> - } /> - - - ) : ( - } /> - )} - } /> - } /> - } /> - + {isLoading ? ( + + ) : ( + + + + + } + /> + {isAdmin ? ( + <> + } /> + }> + } /> + } /> + } /> + } /> + + + ) : ( + } /> + )} + } /> + } /> + } /> + + )}