47 lines
1.6 KiB
JavaScript
47 lines
1.6 KiB
JavaScript
/// <reference types="cypress" />
|
|
describe('Client credits', () => {
|
|
const credit = 100;
|
|
const descriptorCreditValue = '[data-cy="vnLvCredit"] > .value > span';
|
|
|
|
beforeEach(() => {
|
|
cy.viewport(1280, 720);
|
|
cy.login('developer');
|
|
cy.visit('#/customer/1110/credits', {
|
|
timeout: 5000,
|
|
});
|
|
});
|
|
|
|
it('Should put a new credit', () => {
|
|
cy.get('.q-page').should('be.visible');
|
|
cy.dataCy('vnTableCreateBtn').click();
|
|
cy.dataCy('Credit_input').type(credit);
|
|
cy.dataCy('FormModelPopup_save').click();
|
|
cy.checkNotification('Data saved');
|
|
cy.get(descriptorCreditValue)
|
|
.invoke('text')
|
|
.then((text) => {
|
|
const creditValue = parseInt(
|
|
text.trim().replace('€', '').split('.')[0],
|
|
10,
|
|
);
|
|
cy.log(creditValue);
|
|
expect(creditValue).to.equal(credit);
|
|
});
|
|
});
|
|
|
|
it('Should put a new credit with value 0 to close the client card', () => {
|
|
cy.get('.q-page').should('be.visible');
|
|
cy.dataCy('vnTableCreateBtn').click();
|
|
cy.dataCy('Credit_input').type('0');
|
|
cy.dataCy('FormModelPopup_save').click();
|
|
cy.checkNotification('Data saved');
|
|
});
|
|
|
|
it('Should not create the credit if there is no value in the input', () => {
|
|
cy.get('.q-page').should('be.visible');
|
|
cy.dataCy('vnTableCreateBtn').click();
|
|
cy.dataCy('FormModelPopup_save').click();
|
|
cy.get('.q-notification__message').should('not.exist');
|
|
});
|
|
});
|