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

75 lines
2.3 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("File Operations", () => {
beforeEach(() => {
loginWithFixtures();
cy.visit("/files");
cy.wait("@getFiles");
});
it("file list table has sortable columns", () => {
// Check that table headers exist with expected columns
cy.get("table").within(() => {
cy.contains("th", "Name").should("exist");
cy.contains("th", "Dependency").should("exist");
cy.contains("th", "File Type").should("exist");
cy.contains("th", "Owner").should("exist");
cy.contains("th", "Last Update").should("exist");
});
});
it("clicking column header sorts the table", () => {
// Click "Name" header to sort
cy.contains("th", "Name").click();
// After sorting, table should still have data
cy.get("table tbody tr").should("have.length.greaterThan", 0);
});
it("table rows show file data from fixture", () => {
cy.get("table tbody").within(() => {
cy.contains("sample-process.xes").should("exist");
cy.contains("filtered-sample").should("exist");
cy.contains("production-log.csv").should("exist");
});
});
it("table shows owner names", () => {
cy.get("table tbody").within(() => {
cy.contains("Test Admin").should("exist");
cy.contains("Alice Wang").should("exist");
});
});
it("table shows file types", () => {
cy.get("table tbody").within(() => {
cy.contains("log").should("exist");
});
});
it("right-click on file row shows context menu", () => {
// PrimeVue DataTable with contextmenu
cy.get("table tbody tr").first().rightclick();
// Context menu behavior depends on implementation
// Just verify the right-click doesn't break anything
cy.get("table tbody tr").should("have.length.greaterThan", 0);
});
it("grid view shows file cards", () => {
// Switch to grid view
cy.get("svg").parent("li.cursor-pointer").last().click();
// Grid cards should be visible
cy.get("li[title]").should("have.length.greaterThan", 0);
});
it("Import button opens upload modal", () => {
cy.get("#import_btn").click();
// Upload modal should appear
cy.get("#import_btn").should("exist");
});
});