salix-front/test/cypress/integration/client/clientList.spec.js

72 lines
2.6 KiB
JavaScript
Raw Normal View History

2024-10-11 13:46:30 +00:00
/// <reference types="cypress" />
2024-10-16 07:21:57 +00:00
describe('Client list', () => {
2024-10-11 13:46:30 +00:00
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('/#/customer/list', {
timeout: 5000,
onBeforeLoad(win) {
cy.stub(win, 'open')
.callsFake((url) => {
return win.open.wrappedMethod.call(win, url, '_self');
})
.as('Open');
2024-10-11 13:46:30 +00:00
},
});
});
it('Client list create new client', () => {
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
2024-11-26 22:34:57 +00:00
const randomInt = Math.floor(Math.random() * 90) + 10;
2024-10-11 13:46:30 +00:00
const data = {
2024-11-26 22:34:57 +00:00
Name: { val: `Name ${randomInt}` },
'Social name': { val: `TEST ${randomInt}` },
'Tax number': { val: `20852${randomInt.length}3Z` },
'Web user': { val: `user_test_${randomInt}` },
Street: { val: `C/ STREET ${randomInt}` },
2024-10-11 13:46:30 +00:00
Email: { val: 'user.test@1.com' },
2024-11-19 14:56:27 +00:00
'Sales person': { val: 'employee', type: 'select' },
2024-10-11 13:46:30 +00:00
Location: { val: '46000, Valencia(Province one), España', type: 'select' },
2024-11-19 14:56:27 +00:00
'Business type': { val: 'Otros', type: 'select' },
2024-10-11 13:46:30 +00:00
};
cy.fillInForm(data);
cy.get('.q-mt-lg > .q-btn--standard').click();
cy.checkNotification('Data saved');
2024-10-11 13:46:30 +00:00
cy.url().should('include', '/summary');
});
it('Client list search client', () => {
const search = 'Jessica Jones';
cy.searchByLabel('Name', search);
cy.get('.title > span').should('have.text', search);
let id = null;
cy.get('.q-item > .q-item__label').then((text) => {
id = text.text().trim().split('#')[1];
cy.get('.q-item > .q-item__label').should('have.text', ` #${id}`);
cy.url().should('include', `/customer/${id}/summary`);
});
});
it('Client founded create ticket', () => {
const search = 'Jessica Jones';
cy.searchByLabel('Name', search);
cy.openActionDescriptor('Create ticket');
2024-10-11 13:46:30 +00:00
cy.waitForElement('#formModel');
2024-11-19 14:56:27 +00:00
cy.waitForElement('.q-form');
cy.checkValueForm(1, search);
cy.checkValueForm(2, search);
2024-10-11 13:46:30 +00:00
});
it('Client founded create order', () => {
const search = 'Jessica Jones';
cy.searchByLabel('Name', search);
cy.openActionDescriptor('New order');
2024-10-11 13:46:30 +00:00
cy.waitForElement('#formModel');
cy.waitForElement('.q-form');
2024-11-19 14:56:27 +00:00
cy.checkValueForm(1, search);
2024-10-11 13:46:30 +00:00
cy.checkValueForm(2, search);
});
});