diff --git a/cypress/integration/report_view.js b/cypress/integration/report_view.js index 0253e8fd43..5a0b13a3a0 100644 --- a/cypress/integration/report_view.js +++ b/cypress/integration/report_view.js @@ -11,30 +11,60 @@ context('Report View', () => { 'title': 'Doc 1', 'description': 'Random Text', 'enabled': 0, - // submit document - 'docstatus': 1 - }, true).as('doc'); + 'docstatus': 1 // submit document + }, true); + return cy.window().its('frappe').then(frappe => { + return frappe.call("frappe.tests.ui_test_helpers.create_multiple_contact_records"); + }); }); + it('Field with enabled allow_on_submit should be editable.', () => { cy.intercept('POST', 'api/method/frappe.client.set_value').as('value-update'); cy.visit(`/app/List/${doctype_name}/Report`); + // check status column added from docstatus cy.get('.dt-row-0 > .dt-cell--col-3').should('contain', 'Submitted'); let cell = cy.get('.dt-row-0 > .dt-cell--col-4'); + // select the cell cell.dblclick(); cell.get('.dt-cell__edit--col-4').findByRole('checkbox').check({ force: true }); + cy.wait('@value-update'); - cy.get('@doc').then(doc => { - cy.call('frappe.client.get_value', { - doctype: doc.doctype, - filters: { - name: doc.name, - }, - fieldname: 'enabled' - }).then(r => { - expect(r.message.enabled).to.equals(1); - }); + + cy.call('frappe.client.get_value', { + doctype: doctype_name, + filters: { + title: 'Doc 1', + }, + fieldname: 'enabled' + }).then(r => { + expect(r.message.enabled).to.equals(1); }); }); + + it('test load more with count selection buttons', () => { + cy.visit('/app/contact/view/report'); + + cy.clear_filters(); + cy.get('.list-paging-area .list-count').should('contain.text', '20 of'); + cy.get('.list-paging-area .btn-more').click(); + cy.get('.list-paging-area .list-count').should('contain.text', '40 of'); + cy.get('.list-paging-area .btn-more').click(); + cy.get('.list-paging-area .list-count').should('contain.text', '60 of'); + + cy.get('.list-paging-area .btn-group .btn-paging[data-value="100"]').click(); + + cy.get('.list-paging-area .list-count').should('contain.text', '100 of'); + cy.get('.list-paging-area .btn-more').click(); + cy.get('.list-paging-area .list-count').should('contain.text', '200 of'); + cy.get('.list-paging-area .btn-more').click(); + cy.get('.list-paging-area .list-count').should('contain.text', '300 of'); + + cy.get('.list-paging-area .btn-group .btn-paging[data-value="500"]').click(); + + cy.get('.list-paging-area .list-count').should('contain.text', '500 of'); + cy.get('.list-paging-area .btn-more').click(); + cy.get('.list-paging-area .list-count').should('contain.text', '1000 of'); + }); }); \ No newline at end of file diff --git a/frappe/tests/ui_test_helpers.py b/frappe/tests/ui_test_helpers.py index b299df522c..079dcc64ef 100644 --- a/frappe/tests/ui_test_helpers.py +++ b/frappe/tests/ui_test_helpers.py @@ -134,6 +134,12 @@ def create_contact_records(): insert_contact('Test Form Contact 2', '54321') insert_contact('Test Form Contact 3', '12345') +@frappe.whitelist() +def create_multiple_contact_records(): + if frappe.db.get_all('Contact', {'first_name': 'Multiple Contact 1'}): + return + for index in range(1001): + insert_contact('Multiple Contact {}'.format(index+1), '12345{}'.format(index+1)) def insert_contact(first_name, phone_number): doc = frappe.get_doc({