From 7cf5dee09703fca69dca2629bf72128598dfdf9f Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Sat, 14 Dec 2019 18:27:58 +0530 Subject: [PATCH] test: Add assert statement for value --- cypress/fixtures/custom_submittable_doctype.js | 6 ++++-- cypress/integration/report_view.js | 13 ++++++++++++- cypress/support/commands.js | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/cypress/fixtures/custom_submittable_doctype.js b/cypress/fixtures/custom_submittable_doctype.js index 22b14db890..c88d37b373 100644 --- a/cypress/fixtures/custom_submittable_doctype.js +++ b/cypress/fixtures/custom_submittable_doctype.js @@ -1,5 +1,5 @@ export default { - name: 'Custom Submittable Doctype', + name: 'Custom Submittable DocType', custom: 1, actions: [], is_submittable: 1, @@ -41,7 +41,9 @@ export default { read: 1, role: 'System Manager', share: 1, - write: 1 + write: 1, + submit: 1, + cancel: 1 } ], quick_entry: 1, diff --git a/cypress/integration/report_view.js b/cypress/integration/report_view.js index fe33d5c128..47e6cd6150 100644 --- a/cypress/integration/report_view.js +++ b/cypress/integration/report_view.js @@ -12,7 +12,7 @@ context('Report View', () => { 'enabled': 0, // submit document 'docstatus': 1 - }, true); + }, true).as('doc'); }); it('Field with enabled allow_on_submit should be editable.', () => { @@ -25,5 +25,16 @@ context('Report View', () => { cell.find('input[data-fieldname="enabled"]').check({force: true}); cy.get('.dt-row-0 > .dt-cell--col-4').click(); 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); + }); + }); }); }); \ No newline at end of file diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 00c7d7f8f4..41d9c16d7b 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -207,7 +207,7 @@ Cypress.Commands.add('insert_doc', (doctype, args, ignore_duplicate) => { status_codes.push(409); } expect(res.status).to.be.oneOf(status_codes); - return res.body; + return res.body.data; }); }); }); \ No newline at end of file