From d1978d8e62e01e23aba3aec8eb21bd0b130399d2 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Tue, 19 Apr 2022 16:49:08 +0530 Subject: [PATCH] fix: check dates in frappe realm new Date in Cypress context and new Date in frappe context differs sometimes in CI --- cypress/integration/control_date.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cypress/integration/control_date.js b/cypress/integration/control_date.js index 5093c675cf..6d9f0b9bcc 100644 --- a/cypress/integration/control_date.js +++ b/cypress/integration/control_date.js @@ -68,16 +68,15 @@ context('Date Control', () => { cy.clear_dialogs(); cy.clear_datepickers(); - get_dialog({ default: '2020-01-15' }).as('dialog'); + get_dialog().as('dialog'); cy.get_field('date', 'Date').click(); //Clicking on "Today" button cy.get('.datepicker--button').click(); - //Picking up the todays date - const todays_date = new Date().toJSON().split('T')[0]; - //Verifying if clicking on "Today" button matches today's date - cy.window().its('cur_dialog.fields_dict.date.value').should('be.equal', todays_date); + cy.window().then(win => { + expect(win.cur_dialog.fields_dict.date.value).to.be.equal(win.frappe.datetime.get_today()); + }); }); }); \ No newline at end of file