Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Removed

- remove cypress declarations

## [5.2.0] - 2025-06-23

### Added
Expand Down
5 changes: 3 additions & 2 deletions cypress/cypress/component/Paging/Paging.cy.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Paging } from "react-pattern-ui";
import { faker } from "@faker-js/faker";
import { mount } from "cypress/react18";

describe("Paging.cy.tsx", () => {
it("basic paging works", () => {
Expand All @@ -8,7 +9,7 @@ describe("Paging.cy.tsx", () => {
const currentPage = faker.datatype.number({ min: 2, max: pages - 1 });
const translations = { showedItemsText: "Item {from} to {to} from {total}", itemsPerPageDropdown: "Items per page" };

cy.mount(
mount(
<Paging
currentItemsPerPage={itemsPerPage}
currentPage={currentPage}
Expand Down Expand Up @@ -74,7 +75,7 @@ describe("Paging.cy.tsx", () => {
const currentPage = faker.datatype.number({ min: 2, max: pages - 1 });
const translations = { showedItemsText: "Item {from} to {to} from {total}", itemsPerPageDropdown: "Items per page" };

cy.mount(
mount(
<Paging
currentItemsPerPage={itemsPerPage}
currentPage={currentPage}
Expand Down
29 changes: 15 additions & 14 deletions cypress/cypress/component/PanelSidebar/PanelSidebar.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
PanelItemOnSideBarCollapseOptions,
} from "react-pattern-ui";
import { faBars, faCogs, faInfo, faHome, faPerson } from "@fortawesome/free-solid-svg-icons";
import { mount } from "cypress/react18";

type AppRoutes = "home" | "settings" | "dropdownTest" | "dropdown-test1" | "dropdown-test2" | "info";
type TSideBarMenuItem = PanelItem<AppRoutes>;
Expand Down Expand Up @@ -136,7 +137,7 @@ const PanelSideBarNoTiles = (props: PanelSideBarProps) => {

describe("PanelSidebar.cy.tsx", () => {
it("icon and titles rendered correctly", () => {
cy.mount(<PanelSideBarWithTiles />);
mount(<PanelSideBarWithTiles />);

// Check if icon are rendered
cy.get('[data-icon="bars"]').should("be.visible");
Expand All @@ -149,7 +150,7 @@ describe("PanelSidebar.cy.tsx", () => {
});

it("flat menu entry", () => {
cy.mount(<PanelSideBarWithTiles />);
mount(<PanelSideBarWithTiles />);

// Check page content changes
cy.get("#home").click();
Expand All @@ -160,7 +161,7 @@ describe("PanelSidebar.cy.tsx", () => {
});

it("nested menu entries", () => {
cy.mount(<PanelSideBarWithTiles />);
mount(<PanelSideBarWithTiles />);

// Check page content changes
cy.get("button[title=Settings]").click();
Expand All @@ -173,7 +174,7 @@ describe("PanelSidebar.cy.tsx", () => {
});

it("disabled entries", () => {
cy.mount(<PanelSideBarWithTiles disabled />);
mount(<PanelSideBarWithTiles disabled />);

// Check are disabled and page content not doesn't change
cy.get("button[title=Home]").should("have.attr", "disabled");
Expand All @@ -185,7 +186,7 @@ describe("PanelSidebar.cy.tsx", () => {
});

it("toggle sidebar", () => {
cy.mount(<PanelSideBarWithTiles />);
mount(<PanelSideBarWithTiles />);

// Check toggle sidebar
cy.get('[data-icon="angle-left"]').should("be.visible");
Expand All @@ -196,26 +197,26 @@ describe("PanelSidebar.cy.tsx", () => {
});

it("selected flat entry", () => {
cy.mount(<PanelSideBarWithTiles active />);
mount(<PanelSideBarWithTiles active />);

// Check active entries
cy.get("#home").parent("div").parent("li").should("have.class", "active");
});

it("render correctly menu without tiles", () => {
cy.mount(<PanelSideBarNoTiles />);
mount(<PanelSideBarNoTiles />);
cy.get("#main-section").should("have.class", "section-no-tiles");
cy.get(".side.nav__tiles").should("not.exist");
});

it("render correctly toggle button", () => {
cy.mount(<PanelSideBarNoTiles />);
mount(<PanelSideBarNoTiles />);
cy.get("#sidebar-toggle").click();
cy.get("#side-nav").should("have.css", "width", "0px");
});

it("check dropdown correctly pre-expanded", () => {
cy.mount(<PanelSideBarWithTiles expanded />);
mount(<PanelSideBarWithTiles expanded />);
cy.get("button[title=Settings]").click();
cy.get("#dropdown-test1").should("be.visible");
cy.get("#dropdown-test2").should("be.visible");
Expand All @@ -231,7 +232,7 @@ describe("PanelSidebar.cy.tsx", () => {
);
};

cy.mount(
mount(
<PanelSideBarWithTiles expanded>
<Button />
</PanelSideBarWithTiles>,
Expand All @@ -254,7 +255,7 @@ describe("PanelSidebar.cy.tsx", () => {
);
};

cy.mount(
mount(
<PanelSideBarWithTiles expanded>
<Button />
</PanelSideBarWithTiles>,
Expand Down Expand Up @@ -282,7 +283,7 @@ describe("PanelSidebar.cy.tsx", () => {
);
};

cy.mount(
mount(
<PanelSideBarWithTiles>
<Button />
</PanelSideBarWithTiles>,
Expand All @@ -296,15 +297,15 @@ describe("PanelSidebar.cy.tsx", () => {
});

it("check hidden panel", () => {
cy.mount(<PanelSideBarWithTiles />);
mount(<PanelSideBarWithTiles />);

cy.get("button[title=Settings]").should("be.visible");
cy.get("button[title=Home]").should("be.visible");
cy.get("button[title=Info]").should("not.exist");
});

it("toggle sidebar with visible icons", () => {
cy.mount(<PanelSideBarWithTiles onSidebarCollapseOptions={{ showIcon: true }} />);
mount(<PanelSideBarWithTiles onSidebarCollapseOptions={{ showIcon: true }} />);
cy.get('[data-icon="angle-left"]').should("be.visible");
cy.get("#side-nav-toggle").click();
cy.get('[data-icon="angle-right"]').should("be.visible");
Expand Down
47 changes: 0 additions & 47 deletions cypress/cypress/support/commands.ts

This file was deleted.

26 changes: 0 additions & 26 deletions cypress/cypress/support/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,3 @@
import "bootstrap/dist/css/bootstrap.min.css";

import "react-pattern-ui/styles.css";

// Import commands.js using ES2015 syntax:
import "./commands";

// Alternatively you can use CommonJS syntax:
// require('./commands')

import { mount } from "cypress/react18";

// Augment the Cypress namespace to include type definitions for
// your custom command.
// Alternatively, can be defined in cypress/support/component.d.ts
// with a <reference path="./component" /> at the top of your spec.
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Cypress {
interface Chainable {
mount: typeof mount;
}
}
}

Cypress.Commands.add("mount", mount);

// Example use:
// cy.mount(<MyComponent />)