seitime-frappe/cypress/integration/control_rating.js
2020-11-11 16:35:02 +05:30

43 lines
No EOL
893 B
JavaScript

context('Control Rating', () => {
before(() => {
cy.login();
cy.visit('/app/workspace/Website');
});
function get_dialog_with_rating() {
return cy.dialog({
title: 'Rating',
fields: [{
'fieldname': 'rate',
'fieldtype': 'Rating',
}]
});
}
it('click on the star rating to record value', () => {
get_dialog_with_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');
expect(value).to.equal(1);
dialog.hide();
});
});
it('hover on the star', () => {
get_dialog_with_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');
});
});