/// describe('Client list', () => { beforeEach(() => { 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.addBtnClick(); const randomInt = Math.floor(Math.random() * 90) + 10; const data = { Name: { val: `Name ${randomInt}` }, 'Social name': { val: `TEST ${randomInt}` }, 'Tax number': { val: `20852${randomInt}3Z` }, 'Web user': { val: `user_test_${randomInt}` }, Street: { val: `C/ STREET ${randomInt}` }, Email: { val: `user.test${randomInt}@cypress.com` }, Team: { val: 'Informatica', type: 'select' }, Location: { val: '46000', type: 'select' }, 'Business type': { val: 'others', type: 'select' }, }; cy.fillInForm(data); cy.get('.q-mt-lg > .q-btn--standard').click(); cy.checkNotification('Data 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.selectDescriptorOption(); cy.waitForElement('#formModel'); cy.waitForElement('.q-form'); cy.checkValueForm(1, search); cy.checkValueForm(2, search); cy.dataCy('Customer_select').should('have.value', search); cy.dataCy('Address_select').should('have.value', search); }); it('Client founded create order', () => { const search = 'Jessica Jones'; cy.intercept('GET', /\/api\/Clients\/1110\/summary/).as('customer'); cy.dataCy('Name_input').type(`${search}{enter}`); cy.wait('@customer'); cy.get('.actions > .q-card__actions').should('exist'); cy.clickButtonWith('icon', 'icon-basketadd'); cy.url().should('include', `/customer/1110/summary`); cy.waitForElement('#formModel'); cy.waitForElement('.q-form'); cy.checkValueForm(1, search); cy.dataCy('Client_select').should('have.value', search); cy.dataCy('Address_select').should('have.value', search); }); });