Files
lucia-frontend/cypress/e2e/filesCompare.cy.js
2026-03-08 12:11:57 +08:00

50 lines
1.5 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("Files Page - COMPARE Tab", () => {
beforeEach(() => {
loginWithFixtures();
cy.visit("/files");
cy.wait("@getFiles");
// Switch to COMPARE tab
cy.contains("li", "COMPARE").click();
});
it("shows Performance Comparison heading", () => {
cy.contains("h2", "Performance Comparison").should("be.visible");
});
it("shows two drag-and-drop slots", () => {
cy.get("#primaryDragCard").should("exist");
cy.get("#secondaryDragCard").should("exist");
});
it("drag slots show placeholder text", () => {
cy.get("#primaryDragCard").should("contain", "Drag and drop a file here");
cy.get("#secondaryDragCard").should("contain", "Drag and drop a file here");
});
it("Compare button is disabled when no files are dragged", () => {
cy.contains("button", "Compare").should("be.disabled");
});
it("shows sorting dropdown", () => {
cy.get(".p-select").should("exist");
});
it("grid cards display file names", () => {
cy.get("#compareGridCards").should("exist");
cy.get("#compareGridCards li").should("have.length.greaterThan", 0);
});
it("clicking sorting dropdown shows sort options", () => {
cy.get(".p-select").click();
cy.get(".p-select-list").should("be.visible");
cy.contains(".p-select-option", "By File Name").should("exist");
});
});