68 lines
1.8 KiB
JavaScript
68 lines
1.8 KiB
JavaScript
// The Lucia project.
|
|
// Copyright 2026-2026 DSP, inc. All rights reserved.
|
|
// Authors:
|
|
// imacat.yang@dsp.im (imacat), 2026/03/05
|
|
|
|
import { loginWithFixtures } from "../support/intercept";
|
|
|
|
describe("Logout Flow", () => {
|
|
beforeEach(() => {
|
|
loginWithFixtures();
|
|
});
|
|
|
|
it("shows account menu when head icon is clicked", () => {
|
|
cy.visit("/files");
|
|
cy.wait("@getFiles");
|
|
|
|
// Click the head icon to open account menu
|
|
cy.get("#acct_mgmt_button").click();
|
|
cy.get("#account_menu").should("be.visible");
|
|
cy.get("#greeting").should("contain", "Test Admin");
|
|
});
|
|
|
|
it("account menu shows admin management link for admin user", () => {
|
|
cy.visit("/files");
|
|
cy.wait("@getFiles");
|
|
|
|
cy.get("#acct_mgmt_button").click();
|
|
cy.get("#account_menu").should("be.visible");
|
|
// Admin user should see account management option
|
|
cy.get("#btn_acct_mgmt").should("exist");
|
|
});
|
|
|
|
it("account menu has logout button", () => {
|
|
cy.visit("/files");
|
|
cy.wait("@getFiles");
|
|
|
|
cy.get("#acct_mgmt_button").click();
|
|
cy.get("#btn_logout_in_menu").should("exist");
|
|
});
|
|
|
|
it("clicking My Account navigates to /my-account", () => {
|
|
cy.visit("/files");
|
|
cy.wait("@getFiles");
|
|
|
|
cy.get("#acct_mgmt_button").click();
|
|
cy.get("#btn_mang_ur_acct").click();
|
|
cy.url().should("include", "/my-account");
|
|
});
|
|
|
|
it("clicking Account Management navigates to /account-admin", () => {
|
|
cy.visit("/files");
|
|
cy.wait("@getFiles");
|
|
|
|
cy.get("#acct_mgmt_button").click();
|
|
cy.get("#btn_acct_mgmt").click();
|
|
cy.url().should("include", "/account-admin");
|
|
});
|
|
|
|
it("logout redirects to login page", () => {
|
|
cy.visit("/files");
|
|
cy.wait("@getFiles");
|
|
|
|
cy.get("#acct_mgmt_button").click();
|
|
cy.get("#btn_logout_in_menu").click();
|
|
cy.url().should("include", "/login");
|
|
});
|
|
});
|