seitime-frappe/cypress/integration/control_rating.js
Faris Ansari 8fb2a538ec test: Add UI test for Link control (#7809)
* test: Add UI test for Link control

- Add API cy.call
- Add API cy.create_records
- Add ui_test_helpers.py

* style: Missing semicolon

* style: Missing semicolon

* style: Missing semicolon

* style: Remove unused imports

* test: Robust test for setting invalid value

* style: Remove unused import
2019-07-03 07:55:36 +05:30

43 lines
No EOL
898 B
JavaScript

context('Control Rating', () => {
before(() => {
cy.login('Administrator', 'qwe');
cy.visit('/desk');
});
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');
});
});