91 lines
3.0 KiB
JavaScript
91 lines
3.0 KiB
JavaScript
// The Lucia project.
|
|
// Copyright 2024-2026 DSP, inc. All rights reserved.
|
|
// Authors:
|
|
// chiayin.kuo@dsp.im (chiayin), 2024/02/22
|
|
// cindy.chang@dsp.im (Cindy Chang), 2024/05/30
|
|
// imacat.yang@dsp.im (imacat), 2026/03/05
|
|
|
|
import { loginWithFixtures } from "../support/intercept";
|
|
|
|
describe("Compare", () => {
|
|
beforeEach(() => {
|
|
loginWithFixtures();
|
|
cy.visit("/files");
|
|
cy.wait("@getFiles");
|
|
cy.contains("li", "COMPARE").click();
|
|
});
|
|
|
|
it("Compare dropdown sorting options", () => {
|
|
const expectedOptions = [
|
|
"By File Name (A to Z)",
|
|
"By File Name (Z to A)",
|
|
"By Dependency (A to Z)",
|
|
"By Dependency (Z to A)",
|
|
"By File Type (A to Z)",
|
|
"By File Type (Z to A)",
|
|
"By Last Update (A to Z)",
|
|
"By Last Update (Z to A)",
|
|
];
|
|
|
|
cy.get(".p-select").click();
|
|
cy.get(".p-select-list")
|
|
.find(".p-select-option")
|
|
.then(($options) => {
|
|
const actualOptions = $options
|
|
.map((index, elem) =>
|
|
Cypress.$(elem).find(".p-select-option-label").text(),
|
|
)
|
|
.get();
|
|
expect(actualOptions).to.deep.equal(expectedOptions);
|
|
});
|
|
});
|
|
|
|
it("Grid cards are rendered for compare file selection", () => {
|
|
cy.get("#compareGridCards").find("li").should("have.length.greaterThan", 0);
|
|
});
|
|
|
|
it("Compare button is disabled until two files are dragged", () => {
|
|
cy.contains("button", "Compare").should("be.disabled");
|
|
cy.get("#compareFile0").drag("#primaryDragCard");
|
|
cy.get("#compareFile1").drag("#secondaryDragCard");
|
|
cy.contains("button", "Compare").should("be.enabled");
|
|
});
|
|
|
|
it("Enter Compare dashboard and see charts", () => {
|
|
cy.get("#compareFile0").drag("#primaryDragCard");
|
|
cy.get("#compareFile1").drag("#secondaryDragCard");
|
|
cy.contains("button", "Compare").click();
|
|
cy.wait("@getCompare");
|
|
cy.url().should("include", "compare");
|
|
|
|
// Assert chart title spans are visible
|
|
cy.contains("span", "Average Cycle Time").should("exist");
|
|
cy.contains("span", "Cycle Efficiency").should("exist");
|
|
cy.contains("span", "Average Processing Time").should("exist");
|
|
cy.contains("span", "Average Processing Time by Activity").should("exist");
|
|
cy.contains("span", "Average Waiting Time").should("exist");
|
|
cy.contains("span", "Average Waiting Time between Activity").should(
|
|
"exist",
|
|
);
|
|
});
|
|
|
|
it("Compare State button exists on dashboard", () => {
|
|
cy.get("#compareFile0").drag("#primaryDragCard");
|
|
cy.get("#compareFile1").drag("#secondaryDragCard");
|
|
cy.contains("button", "Compare").click();
|
|
cy.wait("@getCompare");
|
|
|
|
cy.get("#compareState").should("exist").and("be.visible");
|
|
});
|
|
|
|
it("Sidebar shows time usage and frequency sections", () => {
|
|
cy.get("#compareFile0").drag("#primaryDragCard");
|
|
cy.get("#compareFile1").drag("#secondaryDragCard");
|
|
cy.contains("button", "Compare").click();
|
|
cy.wait("@getCompare");
|
|
|
|
cy.get("aside").should("exist");
|
|
cy.get("aside li").should("have.length.greaterThan", 0);
|
|
});
|
|
});
|