From 6cc59aabd8c3dd482f5000716a1c34651d4e24e8 Mon Sep 17 00:00:00 2001 From: Mangesh-Khairnar Date: Mon, 25 Mar 2019 15:44:47 +0530 Subject: [PATCH] test: check effects on trigger of hover and click events --- cypress/integration/control_rating.js | 36 +++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 cypress/integration/control_rating.js diff --git a/cypress/integration/control_rating.js b/cypress/integration/control_rating.js new file mode 100644 index 0000000000..2df10d0351 --- /dev/null +++ b/cypress/integration/control_rating.js @@ -0,0 +1,36 @@ +context('Rating Control', () => { + beforeEach(() => { + cy.login('Administrator', 'qwe'); + }); + + it('click on the star rating to record value', () => { + cy.visit('/desk') + cy.dialog('Rating', { + 'fieldname': 'rate', 'fieldtype': 'Rating', + }).as('dialog'); + + cy.get('div.rating') + .children('i.fa') + .first() + .click() + .should('have.class', 'star-click'); + cy.get('@dialog').then(dialog => { + var value = dialog.get_value('rate'); + }) + }); + + it('hover on the star', () => { + cy.visit('/desk') + cy.dialog('Rating', { + 'fieldname': 'rate', 'fieldtype': 'Rating', + }) + cy.get('div.rating') + .children('i.fa') + .first() + .invoke('trigger', 'mouseenter') + .should('have.class', 'star-hover') + .invoke('trigger', 'mouseleave') + .should('not.have.class', 'star-hover'); + }); + +}); \ No newline at end of file