0
0
Fork 0
salix-front-mindshore-fork2/test/cypress/integration/client/clientList.spec.js

71 lines
2.7 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();
const data = {
Name: { val: 'Name 1' },
'Social name': { val: 'TEST 1' },
'Tax number': { val: '20852113Z' },
'Web user': { val: 'user_test_1' },
Street: { val: 'C/ STREET 1' },
Email: { val: 'user.test@1.com' },
'Business type': { val: 'Otros', type: 'select' },
'Sales person': { val: 'salesboss', type: 'select' },
Location: { val: '46000, Valencia(Province one), España', type: 'select' },
};
cy.fillInForm(data);
cy.get('.q-mt-lg > .q-btn--standard').click();
cy.checkNotification('created');
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');
cy.waitForElement('.q-form', { timeout: 5000 });
cy.get('.grid-create >:nth-child(1)').find('input').should('have.value', search);
cy.get('.grid-create >:nth-child(2)').find('input').should('have.value', 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');
cy.get('.grid-create >:nth-child(2)').find('input').should('have.value', search);
cy.get('.grid-create >:nth-child(4)').find('input').should('have.value', search);
2024-10-11 13:46:30 +00:00
});
});