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

79 lines
3.0 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) {
2024-11-19 11:51:05 +00:00
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`);
});
});
2024-11-19 11:51:05 +00:00
it.only('Client founded create ticket', () => {
2024-10-11 13:46:30 +00:00
const search = 'Jessica Jones';
cy.searchByLabel('Name', search);
2024-11-19 11:51:05 +00:00
cy.openActionDescriptor('Create ticket');
2024-10-11 13:46:30 +00:00
cy.waitForElement('#formModel');
2024-11-19 11:51:05 +00:00
cy.waitForElement('.q-form', { timeout: 5000 });
cy.checkValueSelectForm(1, 1110);
cy.checkValueSelectForm(2, search);
// cy.get('@Open').should('have.been.calledOnceWithExactly', [
// '/#/ticket/list?table={"clientFk":1110}&createForm={"addressId":10,"clientId":1110}',
// '_blank',
// 'noopener,noreferrer',
// ]);
2024-10-11 13:46:30 +00:00
});
2024-11-19 11:51:05 +00:00
it.only('Client founded create order', () => {
2024-10-11 13:46:30 +00:00
const search = 'Jessica Jones';
cy.searchByLabel('Name', search);
2024-11-19 11:51:05 +00:00
cy.openActionDescriptor('New order');
2024-10-11 13:46:30 +00:00
cy.waitForElement('#formModel');
2024-11-19 11:51:05 +00:00
cy.waitForElement('.q-form', { timeout: 5000 });
cy.checkValueForm(1, 1110);
2024-10-11 13:46:30 +00:00
cy.checkValueForm(2, search);
2024-11-19 11:51:05 +00:00
// cy.get('@Open').should(
// 'have.been.calledOnceWithExactly',
// '"/#/order/list?table={"clientFk":1110}&createForm={"addressId":10,"clientFk":1110}", "_blank", "noopener,noreferrer"'
// );
2024-10-11 13:46:30 +00:00
});
});