75 lines
2.8 KiB
JavaScript
75 lines
2.8 KiB
JavaScript
/// <reference types="cypress" />
|
|
describe('Client list', () => {
|
|
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');
|
|
},
|
|
});
|
|
});
|
|
|
|
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' },
|
|
'Sales person': { val: 'employee', type: 'select' },
|
|
Location: { val: '46000, Valencia(Province one), España', type: 'select' },
|
|
'Business type': { val: 'Otros', type: 'select' },
|
|
};
|
|
cy.fillInForm(data);
|
|
|
|
cy.get('.q-mt-lg > .q-btn--standard').click();
|
|
|
|
cy.checkNotification('Data saved');
|
|
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');
|
|
cy.waitForElement('#formModel');
|
|
cy.waitForElement('.q-form');
|
|
|
|
cy.checkValueForm(1, search);
|
|
cy.checkValueForm(2, search);
|
|
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);
|
|
});
|
|
it('Client founded create order', () => {
|
|
const search = 'Jessica Jones';
|
|
cy.searchByLabel('Name', search);
|
|
cy.openActionDescriptor('New order');
|
|
cy.waitForElement('#formModel');
|
|
cy.waitForElement('.q-form');
|
|
cy.checkValueForm(1, search);
|
|
cy.checkValueForm(2, search);
|
|
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);
|
|
});
|
|
});
|