@@ -14,15 +14,15 @@ context('Grid Pagination', () => {
cy.visit('/desk#Form/Contact/Test Contact');
cy.get('.frappe-control[data-fieldname="phone_nos"]').as('table');
cy.get('@table').find('.current-page-number').should('contain', '1');
cy.get('@table').find('.total-page-number').should('contain', '5 0');
cy.get('@table').find('.grid-body .grid-row').should('have.length', 2 0);
cy.get('@table').find('.total-page-number').should('contain', '2 0');
cy.get('@table').find('.grid-body .grid-row').should('have.length', 5 0);
});
it('goes to the next and previous page', () => {
cy.visit('/desk#Form/Contact/Test Contact');
cy.get('.frappe-control[data-fieldname="phone_nos"]').as('table');
cy.get('@table').find('.next-page').click();
cy.get('@table').find('.current-page-number').should('contain', '2');
cy.get('@table').find('.grid-body .grid-row').first().should('have.attr', 'data-idx', '2 1');
cy.get('@table').find('.grid-body .grid-row').first().should('have.attr', 'data-idx', '5 1');
cy.get('@table').find('.prev-page').click();
cy.get('@table').find('.current-page-number').should('contain', '1');
cy.get('@table').find('.grid-body .grid-row').first().should('have.attr', 'data-idx', '1');
@@ -32,19 +32,20 @@ context('Grid Pagination', () => {
cy.get('.frappe-control[data-fieldname="phone_nos"]').as('table');
cy.get('@table').find('button.grid-add-row').click();
cy.get('@table').find('.grid-body .row-index').should('contain', 1001);
cy.get('@table').find('.current-page-number').should('contain', '5 1');
cy.get('@table').find('.total-page-number').should('contain', '5 1');
cy.get('@table').find('.current-page-number').should('contain', '2 1');
cy.get('@table').find('.total-page-number').should('contain', '2 1');
cy.get('@table').find('.grid-body .grid-row .grid-row-check').click({force: true});
cy.get('@table').find('button.grid-remove-rows').click();
cy.get('@table').find('.grid-body .row-index').last().should('contain', 1000);
cy.get('@table').find('.current-page-number').should('contain', '5 0');
cy.get('@table').find('.total-page-number').should('contain', '5 0');
cy.get('@table').find('.current-page-number').should('contain', '2 0');
cy.get('@table').find('.total-page-number').should('contain', '2 0');
});
it('deletes all rows', ()=> {
cy.visit('/desk#Form/Contact/Test Contact');
cy.get('.frappe-control[data-fieldname="phone_nos"]').as('table');
cy.get('@table').find('.grid-heading-row .grid-row-check').click({force: true});
cy.get('@table').find('button.grid-remove-all-rows').click();
cy.get('.modal-dialog .btn-primary').contains('Yes').click();
cy.get('@table').find('.grid-body .grid-row').should('have.length', 0);
});
});