You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 2 години
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // ***********************************************
  2. // This example commands.js shows you how to
  3. // create various custom commands and overwrite
  4. // existing commands.
  5. //
  6. // For more comprehensive examples of custom
  7. // commands please read more here:
  8. // https://on.cypress.io/custom-commands
  9. // ***********************************************
  10. //
  11. //
  12. // -- This is a parent command --
  13. // Cypress.Commands.add("login", (email, password) => { ... })
  14. //
  15. //
  16. // -- This is a child command --
  17. // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
  18. //
  19. //
  20. // -- This is a dual command --
  21. // Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
  22. //
  23. //
  24. // -- This is will overwrite an existing command --
  25. // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
  26. Cypress.Commands.add('getCell', (col, row) => {
  27. return cy.get(`.dt-cell--${col}-${row}`);
  28. });
  29. Cypress.Commands.add('clickCell', (col, row) => {
  30. return cy.getCell(col, row).click({ force: true });
  31. });
  32. Cypress.Commands.add('getColumnCell', (col) => {
  33. return cy.get(`.dt-cell--header-${col}`);
  34. });
  35. Cypress.Commands.add('clickDropdown', (col) => {
  36. return cy.getColumnCell(col)
  37. .find('.dt-dropdown__toggle')
  38. .click();
  39. });
  40. Cypress.Commands.add('clickDropdownItem', (col, item) => {
  41. return cy.get(`.dt-dropdown__list-item:contains("${item}")`)
  42. .click({ force: true });
  43. });
  44. Cypress.Commands.add('typeTab', (shiftKey, ctrlKey) => {
  45. cy.focused().trigger('keydown', {
  46. keyCode: 9,
  47. which: 9,
  48. shiftKey: shiftKey,
  49. ctrlKey: ctrlKey
  50. });
  51. });