/**
 * Route-level smoke over the customer portal.
 * Routes from apps/edr-freight-web/portal/src/App.tsx.
 */
const portal = () => Cypress.env("portalUrl") as string;

const ROUTES = ["/portal", "/bookings", "/contracts", "/billing", "/tracking"];

describe("portal: route smoke (demo customer)", () => {
  beforeEach(() => {
    cy.loginPortal("user@gmail.com");
  });

  ROUTES.forEach((route) => {
    it(`renders ${route}`, () => {
      cy.visit(`${portal()}${route}`);
      cy.location("pathname").should("not.eq", "/login");
      cy.get("#root").should("not.be.empty");
    });
  });

  it("new booking wizard opens", () => {
    cy.visit(`${portal()}/bookings/new`);
    cy.location("pathname").should("eq", "/bookings/new");
    cy.get("#root").should("not.be.empty");
  });
});

export {};
