0
0
Fork 0

test: #8162 fix clientList spec

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();
const data = {
Name: { val: 'Name 1' },
@ -24,9 +24,9 @@ describe('Client list', () => {
'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' },
'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);
@ -48,13 +48,13 @@ describe('Client list', () => {
});
});
it.only('Client founded create ticket', () => {
it('Client founded create ticket', () => {
const search = 'Jessica Jones';
cy.searchByLabel('Name', search);
cy.openActionDescriptor('Create ticket');
cy.waitForElement('#formModel');
cy.waitForElement('.q-form', { timeout: 5000 });
cy.checkValueSelectForm(1, 1110);
cy.waitForElement('.q-form');
cy.checkValueSelectForm(1, search);
cy.checkValueSelectForm(2, search);
// cy.get('@Open').should('have.been.calledOnceWithExactly', [
// '/#/ticket/list?table={"clientFk":1110}&createForm={"addressId":10,"clientId":1110}',
@ -62,13 +62,13 @@ describe('Client list', () => {
// 'noopener,noreferrer',
// ]);
});
it.only('Client founded create order', () => {
it('Client founded create order', () => {
const search = 'Jessica Jones';
cy.searchByLabel('Name', search);
cy.openActionDescriptor('New order');
cy.waitForElement('#formModel');
cy.waitForElement('.q-form', { timeout: 5000 });
cy.checkValueForm(1, 1110);
cy.waitForElement('.q-form');
cy.checkValueForm(1, search);
cy.checkValueForm(2, search);
// cy.get('@Open').should(
// 'have.been.calledOnceWithExactly',

View File

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