diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts index bee59cd4c7..2349bf350a 100644 --- a/cypress/support/e2e.ts +++ b/cypress/support/e2e.ts @@ -38,4 +38,3 @@ import "./network"; import "./composer"; import "./proxy"; import "./axe"; -import "./find"; diff --git a/cypress/support/find.ts b/cypress/support/find.ts deleted file mode 100644 index 98b3da6945..0000000000 --- a/cypress/support/find.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* -Copyright 2023 The Matrix.org Foundation C.I.C. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -/// - -import Chainable = Cypress.Chainable; - -declare global { - // eslint-disable-next-line @typescript-eslint/no-namespace - namespace Cypress { - interface Chainable { - /** - * Finds an element with the role "button". - * - * @param name - accessible name of the element to find - */ - findButton(name: string): Chainable; - /** - * Finds an element with the role "textbox". - * - * @param name - accessible name of the element to find - */ - findTextbox(name: string): Chainable; - /** - * Finds an element with the role "option". - * - * @param name - accessible name of the element to find - */ - findOption(name: string): Chainable; - /** - * Finds an element with the role "menuitem". - * - * @param name - accessible name of the element to find - */ - findMenuitem(name: string): Chainable; - } - } -} - -Cypress.Commands.add("findButton", (name: string): Chainable => { - return cy.findByRole("button", { name }); -}); - -Cypress.Commands.add("findTextbox", (name: string): Chainable => { - return cy.findByRole("textbox", { name }); -}); - -Cypress.Commands.add("findOption", (name: string): Chainable => { - return cy.findByRole("option", { name }); -}); - -Cypress.Commands.add("findMenuitem", (name: string): Chainable => { - return cy.findByRole("menuitem", { name }); -}); - -// Needed to make this file a module -export {}; diff --git a/docs/cypress.md b/docs/cypress.md index b9e260ee20..d140a34d4f 100644 --- a/docs/cypress.md +++ b/docs/cypress.md @@ -158,9 +158,7 @@ creation that can be called to set up tests. Like for instance a user will not look for a button by querying a CSS selector. Instead you should work with roles / labels etc.. You can make use of `cy.findBy…` queries provided by -[Cypress Testing Library](https://github.com/testing-library/cypress-testing-library) and some convencience -commands, such as `findButton(name)` or `findTextbox(name)`. -See [`/cypress/support/find.ts`](../cypress/support/find.ts) for a complete list. +[Cypress Testing Library](https://github.com/testing-library/cypress-testing-library). ### Using matrix-js-sdk