Skip to content

Commit c678235

Browse files
authored
remove cypress declarations (#73)
1 parent 2a4ecef commit c678235

5 files changed

Lines changed: 22 additions & 89 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Removed
11+
12+
- remove cypress declarations
13+
1014
## [5.2.0] - 2025-06-23
1115

1216
### Added

cypress/cypress/component/Paging/Paging.cy.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Paging } from "react-pattern-ui";
22
import { faker } from "@faker-js/faker";
3+
import { mount } from "cypress/react18";
34

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

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

77-
cy.mount(
78+
mount(
7879
<Paging
7980
currentItemsPerPage={itemsPerPage}
8081
currentPage={currentPage}

cypress/cypress/component/PanelSidebar/PanelSidebar.cy.tsx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
PanelItemOnSideBarCollapseOptions,
1010
} from "react-pattern-ui";
1111
import { faBars, faCogs, faInfo, faHome, faPerson } from "@fortawesome/free-solid-svg-icons";
12+
import { mount } from "cypress/react18";
1213

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

137138
describe("PanelSidebar.cy.tsx", () => {
138139
it("icon and titles rendered correctly", () => {
139-
cy.mount(<PanelSideBarWithTiles />);
140+
mount(<PanelSideBarWithTiles />);
140141

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

151152
it("flat menu entry", () => {
152-
cy.mount(<PanelSideBarWithTiles />);
153+
mount(<PanelSideBarWithTiles />);
153154

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

162163
it("nested menu entries", () => {
163-
cy.mount(<PanelSideBarWithTiles />);
164+
mount(<PanelSideBarWithTiles />);
164165

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

175176
it("disabled entries", () => {
176-
cy.mount(<PanelSideBarWithTiles disabled />);
177+
mount(<PanelSideBarWithTiles disabled />);
177178

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

187188
it("toggle sidebar", () => {
188-
cy.mount(<PanelSideBarWithTiles />);
189+
mount(<PanelSideBarWithTiles />);
189190

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

198199
it("selected flat entry", () => {
199-
cy.mount(<PanelSideBarWithTiles active />);
200+
mount(<PanelSideBarWithTiles active />);
200201

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

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

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

217218
it("check dropdown correctly pre-expanded", () => {
218-
cy.mount(<PanelSideBarWithTiles expanded />);
219+
mount(<PanelSideBarWithTiles expanded />);
219220
cy.get("button[title=Settings]").click();
220221
cy.get("#dropdown-test1").should("be.visible");
221222
cy.get("#dropdown-test2").should("be.visible");
@@ -231,7 +232,7 @@ describe("PanelSidebar.cy.tsx", () => {
231232
);
232233
};
233234

234-
cy.mount(
235+
mount(
235236
<PanelSideBarWithTiles expanded>
236237
<Button />
237238
</PanelSideBarWithTiles>,
@@ -254,7 +255,7 @@ describe("PanelSidebar.cy.tsx", () => {
254255
);
255256
};
256257

257-
cy.mount(
258+
mount(
258259
<PanelSideBarWithTiles expanded>
259260
<Button />
260261
</PanelSideBarWithTiles>,
@@ -282,7 +283,7 @@ describe("PanelSidebar.cy.tsx", () => {
282283
);
283284
};
284285

285-
cy.mount(
286+
mount(
286287
<PanelSideBarWithTiles>
287288
<Button />
288289
</PanelSideBarWithTiles>,
@@ -296,15 +297,15 @@ describe("PanelSidebar.cy.tsx", () => {
296297
});
297298

298299
it("check hidden panel", () => {
299-
cy.mount(<PanelSideBarWithTiles />);
300+
mount(<PanelSideBarWithTiles />);
300301

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

306307
it("toggle sidebar with visible icons", () => {
307-
cy.mount(<PanelSideBarWithTiles onSidebarCollapseOptions={{ showIcon: true }} />);
308+
mount(<PanelSideBarWithTiles onSidebarCollapseOptions={{ showIcon: true }} />);
308309
cy.get('[data-icon="angle-left"]').should("be.visible");
309310
cy.get("#side-nav-toggle").click();
310311
cy.get('[data-icon="angle-right"]').should("be.visible");

cypress/cypress/support/commands.ts

Lines changed: 0 additions & 47 deletions
This file was deleted.

cypress/cypress/support/component.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,3 @@
1616
import "bootstrap/dist/css/bootstrap.min.css";
1717

1818
import "react-pattern-ui/styles.css";
19-
20-
// Import commands.js using ES2015 syntax:
21-
import "./commands";
22-
23-
// Alternatively you can use CommonJS syntax:
24-
// require('./commands')
25-
26-
import { mount } from "cypress/react18";
27-
28-
// Augment the Cypress namespace to include type definitions for
29-
// your custom command.
30-
// Alternatively, can be defined in cypress/support/component.d.ts
31-
// with a <reference path="./component" /> at the top of your spec.
32-
declare global {
33-
// eslint-disable-next-line @typescript-eslint/no-namespace
34-
namespace Cypress {
35-
interface Chainable {
36-
mount: typeof mount;
37-
}
38-
}
39-
}
40-
41-
Cypress.Commands.add("mount", mount);
42-
43-
// Example use:
44-
// cy.mount(<MyComponent />)

0 commit comments

Comments
 (0)