test: #8162 fix clientList spec
gitea/salix-front/pipeline/pr-test This commit looks good Details

This commit is contained in:
Javier Segarra 2024-11-19 15:56:27 +01:00
parent e6f8b87890
commit b4ee19bcde
2 changed files with 20 additions and 33 deletions

View File

@ -15,7 +15,7 @@ describe('Client list', () => {
}); });
}); });
it('Client list create new client', () => { it.only('Client list create new client', () => {
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click(); cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
const data = { const data = {
Name: { val: 'Name 1' }, Name: { val: 'Name 1' },
@ -24,9 +24,9 @@ describe('Client list', () => {
'Web user': { val: 'user_test_1' }, 'Web user': { val: 'user_test_1' },
Street: { val: 'C/ STREET 1' }, Street: { val: 'C/ STREET 1' },
Email: { val: 'user.test@1.com' }, Email: { val: 'user.test@1.com' },
'Business type': { val: 'Otros', type: 'select' }, 'Sales person': { val: 'employee', type: 'select' },
'Sales person': { val: 'salesboss', type: 'select' },
Location: { val: '46000, Valencia(Province one), España', type: 'select' }, Location: { val: '46000, Valencia(Province one), España', type: 'select' },
'Business type': { val: 'Otros', type: 'select' },
}; };
cy.fillInForm(data); cy.fillInForm(data);
@ -48,13 +48,13 @@ describe('Client list', () => {
}); });
}); });
it.only('Client founded create ticket', () => { it('Client founded create ticket', () => {
const search = 'Jessica Jones'; const search = 'Jessica Jones';
cy.searchByLabel('Name', search); cy.searchByLabel('Name', search);
cy.openActionDescriptor('Create ticket'); cy.openActionDescriptor('Create ticket');
cy.waitForElement('#formModel'); cy.waitForElement('#formModel');
cy.waitForElement('.q-form', { timeout: 5000 }); cy.waitForElement('.q-form');
cy.checkValueSelectForm(1, 1110); cy.checkValueSelectForm(1, search);
cy.checkValueSelectForm(2, search); cy.checkValueSelectForm(2, search);
// cy.get('@Open').should('have.been.calledOnceWithExactly', [ // cy.get('@Open').should('have.been.calledOnceWithExactly', [
// '/#/ticket/list?table={"clientFk":1110}&createForm={"addressId":10,"clientId":1110}', // '/#/ticket/list?table={"clientFk":1110}&createForm={"addressId":10,"clientId":1110}',
@ -62,13 +62,13 @@ describe('Client list', () => {
// 'noopener,noreferrer', // 'noopener,noreferrer',
// ]); // ]);
}); });
it.only('Client founded create order', () => { it('Client founded create order', () => {
const search = 'Jessica Jones'; const search = 'Jessica Jones';
cy.searchByLabel('Name', search); cy.searchByLabel('Name', search);
cy.openActionDescriptor('New order'); cy.openActionDescriptor('New order');
cy.waitForElement('#formModel'); cy.waitForElement('#formModel');
cy.waitForElement('.q-form', { timeout: 5000 }); cy.waitForElement('.q-form');
cy.checkValueForm(1, 1110); cy.checkValueForm(1, search);
cy.checkValueForm(2, search); cy.checkValueForm(2, search);
// cy.get('@Open').should( // cy.get('@Open').should(
// 'have.been.calledOnceWithExactly', // 'have.been.calledOnceWithExactly',

View File

@ -7,6 +7,9 @@ describe('VnLocation', () => {
prefix: '.q-dialog__inner > .column > #formModel > .q-card', prefix: '.q-dialog__inner > .column > #formModel > .q-card',
sufix: ' .q-field__inner > .q-field__control', sufix: ' .q-field__inner > .q-field__control',
}; };
const countrySelector = `${createForm.prefix} > :nth-child(5) > :nth-child(3) > ${createForm.sufix}`;
const provinceSelector = `${createForm.prefix} > :nth-child(5) > :nth-child(2) > ${createForm.sufix}`;
const citySelector = `${createForm.prefix} > :nth-child(4) > :nth-child(2) > ${createForm.sufix}`;
describe('CreateFormDialog ', () => { describe('CreateFormDialog ', () => {
beforeEach(() => { beforeEach(() => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
@ -17,45 +20,29 @@ describe('VnLocation', () => {
}); });
it('should filter provinces based on selected country', () => { it('should filter provinces based on selected country', () => {
// Select a country // Select a country
cy.selectOption( cy.selectOption(countrySelector, 'Ecuador');
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(3)> ${createForm.sufix}`,
'Ecuador'
);
// Verify that provinces are filtered // Verify that provinces are filtered
cy.get( cy.get(countrySelector).should('have.length', 1);
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(3)> ${createForm.sufix}`
).should('have.length', 1);
// Verify that towns are filtered // Verify that towns are filtered
cy.get( cy.get(citySelector).should('have.length', 1);
`${createForm.prefix} > :nth-child(4) > .q-field:nth-child(3)> ${createForm.sufix}`
).should('have.length', 1);
}); });
it('should filter towns based on selected province', () => { it('should filter towns based on selected province', () => {
// Select a country // Select a country
cy.selectOption( cy.selectOption(countrySelector, 'Ecuador');
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(3)> ${createForm.sufix}`,
'Ecuador'
);
// Verify that provinces are filtered // Verify that provinces are filtered
cy.get( cy.get(provinceSelector).should('have.length', 1);
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(3)> ${createForm.sufix}`
).should('have.length', 1);
// Verify that towns are filtered // Verify that towns are filtered
cy.get( cy.get(citySelector).should('have.length', 1);
`${createForm.prefix} > :nth-child(4) > .q-field:nth-child(3)> ${createForm.sufix}`
).should('have.length', 1);
}); });
it('should pass selected country', () => { it('should pass selected country', () => {
// Select a country // Select a country
const country = 'Ecuador'; const country = 'Ecuador';
const province = 'Province five'; const province = 'Province five';
cy.selectOption(
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(5)> ${createForm.sufix}`, cy.selectOption(countrySelector, country);
country
);
cy.selectOption( cy.selectOption(
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix}`, `${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix}`,
province province