admin/cypress/e2e/dashboard.cy.ts

52 lines
1.6 KiB
TypeScript

describe("Dashboard", () => {
beforeEach(() => {
cy.login();
cy.visit("/");
cy.waitForLoading();
});
it("should display dashboard page with title", () => {
cy.contains("داشبورد").should("be.visible");
});
it("should display statistics cards", () => {
// Check for main metrics based on actual statsData
cy.contains("کل کاربران").should("be.visible");
cy.contains("فروش ماهانه").should("be.visible");
cy.contains("کل سفارشات").should("be.visible");
cy.contains("رشد فروش").should("be.visible");
});
it("should display charts", () => {
// Check if chart section exists
cy.get("body").should("be.visible");
});
it("should show recent users table", () => {
// Check if content area exists
cy.get("main, [role='main'], .content").should("exist");
});
it("should show chart titles", () => {
cy.contains("فروش ماهانه").should("be.visible");
cy.contains("روند رشد").should("be.visible");
cy.contains("دستگاه‌های کاربری").should("be.visible");
});
it("should be responsive on mobile", () => {
cy.viewport("iphone-6");
cy.contains("داشبورد").should("be.visible");
});
it("should display user status badges correctly", () => {
// Check status badges in recent users table
cy.get(".bg-green-100").should("contain", "فعال");
cy.get(".bg-red-100").should("contain", "غیرفعال");
});
it("should show action buttons in table", () => {
// Check if dashboard content loads
cy.get("body").should("contain", "داشبورد");
});
});