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.
 
 
 
 
 
 

51 lines
2.5 KiB

  1. context('Grid Pagination', () => {
  2. beforeEach(() => {
  3. cy.login();
  4. cy.visit('/app/website');
  5. });
  6. before(() => {
  7. cy.login();
  8. cy.visit('/app/website');
  9. return cy.window().its('frappe').then(frappe => {
  10. return frappe.call("frappe.tests.ui_test_helpers.create_contact_phone_nos_records");
  11. });
  12. });
  13. it('creates pages for child table', () => {
  14. cy.visit('/app/contact/Test Contact');
  15. cy.get('.frappe-control[data-fieldname="phone_nos"]').as('table');
  16. cy.get('@table').find('.current-page-number').should('contain', '1');
  17. cy.get('@table').find('.total-page-number').should('contain', '20');
  18. cy.get('@table').find('.grid-body .grid-row').should('have.length', 50);
  19. });
  20. it('goes to the next and previous page', () => {
  21. cy.visit('/app/contact/Test Contact');
  22. cy.get('.frappe-control[data-fieldname="phone_nos"]').as('table');
  23. cy.get('@table').find('.next-page').click();
  24. cy.get('@table').find('.current-page-number').should('contain', '2');
  25. cy.get('@table').find('.grid-body .grid-row').first().should('have.attr', 'data-idx', '51');
  26. cy.get('@table').find('.prev-page').click();
  27. cy.get('@table').find('.current-page-number').should('contain', '1');
  28. cy.get('@table').find('.grid-body .grid-row').first().should('have.attr', 'data-idx', '1');
  29. });
  30. it('adds and deletes rows and changes page', () => {
  31. cy.visit('/app/contact/Test Contact');
  32. cy.get('.frappe-control[data-fieldname="phone_nos"]').as('table');
  33. cy.get('@table').findByRole('button', {name: 'Add Row'}).click();
  34. cy.get('@table').find('.grid-body .row-index').should('contain', 1001);
  35. cy.get('@table').find('.current-page-number').should('contain', '21');
  36. cy.get('@table').find('.total-page-number').should('contain', '21');
  37. cy.get('@table').find('.grid-body .grid-row .grid-row-check').click({ force: true });
  38. cy.get('@table').findByRole('button', {name: 'Delete'}).click();
  39. cy.get('@table').find('.grid-body .row-index').last().should('contain', 1000);
  40. cy.get('@table').find('.current-page-number').should('contain', '20');
  41. cy.get('@table').find('.total-page-number').should('contain', '20');
  42. });
  43. // it('deletes all rows', ()=> {
  44. // cy.visit('/app/contact/Test Contact');
  45. // cy.get('.frappe-control[data-fieldname="phone_nos"]').as('table');
  46. // cy.get('@table').find('.grid-heading-row .grid-row-check').click({force: true});
  47. // cy.get('@table').find('button.grid-remove-all-rows').click();
  48. // cy.get('.modal-dialog .btn-primary').contains('Yes').click();
  49. // cy.get('@table').find('.grid-body .grid-row').should('have.length', 0);
  50. // });
  51. });