0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00
verdaccio/e2e/ui/cypress/support/commands.ts
Juan Picado b4cc80017e
fix: improve abort request search (#3436)
* fix: improve abort request search

* chore: add changeset

* chore: ui flacky tests
2022-10-15 14:03:51 +02:00

40 lines
1.3 KiB
TypeScript

/* eslint-disable no-undef */
// / <reference types="cypress" />;
Cypress.Commands.add('getByTestId', (selector, ...args) => {
return cy.get(`[data-testid=${selector}]`, ...args);
});
// -- This is a parent command --
Cypress.Commands.add('login', (user, password) => {
cy.getByTestId('header--button-login').click();
cy.wait(300);
cy.get('#login--dialog-username').type(user);
cy.wait(200);
cy.get('#login--dialog-password').type(password);
cy.wait(500);
cy.get('#login--dialog-button-submit').click();
});
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
//
// declare global {
// namespace Cypress {
// interface Chainable {
// login(email: string, password: string): Chainable<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }