test: fix test

This commit is contained in:
Javier Segarra 2025-03-06 01:15:31 +01:00
parent 0237a2364d
commit 44f11fddf1
5 changed files with 57 additions and 10 deletions

View File

@ -158,11 +158,11 @@ onMounted(async () => {
if (route.query?.createForm) {
const query = JSON.parse(route.query?.createForm);
formInitialData.value = query;
await onClientSelected({ ...formInitialData.value, clientId: query?.clientFk });
await onClientSelected({ ...formInitialData.value, clientFk: query?.clientFk });
} else if (route.query?.table) {
const query = JSON.parse(route.query?.table);
const clientId = query?.clientFk;
if (clientId) await onClientSelected({ clientId });
const clientFk = query?.clientFk;
if (clientFk) await onClientSelected({ clientFk });
}
if (tableRef.value) tableRef.value.create.formInitialData = formInitialData.value;
});

View File

@ -58,13 +58,22 @@ describe('Client list', () => {
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.searchByLabel('Name', search);
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);
});
});

View File

@ -8,7 +8,6 @@ describe('OrderList', () => {
});
it('create order', () => {
/* ==== Generated with Cypress Studio ==== */
cy.get('[data-cy="vnTableCreateBtn"]').click();
cy.get('[data-cy="Client_select"]').type('1101');
cy.get('.q-menu').contains('Bruce Wayne').click();
@ -29,4 +28,45 @@ describe('OrderList', () => {
});
cy.url().should('include', `/order`);
});
it('filter list and create order', () => {
cy.dataCy('Customer ID_input').type('1101{enter}');
cy.dataCy('vnTableCreateBtn').click();
cy.dataCy('landedDate').find('input').type('06/01/2001');
cy.get('.q-card [data-cy="Agency_select"]').click();
cy.get('.q-menu > div> .q-item:nth-child(1)').click();
cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale');
cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click();
cy.wait('@orderSale');
cy.get('.q-item > .q-item__label.subtitle').then((text) => {
const id = text.text().trim().split('#')[1];
cy.get('.q-item > .q-item__label').should('have.text', ` #${id}`);
});
cy.url().should('include', `/order`);
});
it('create order from customer summary', function () {
const clientId = 1101;
cy.dataCy('Customer ID_input').type(`${clientId}{enter}`);
cy.get(
':nth-child(1) > [data-col-field="clientFk"] > .no-padding > .link',
).click();
cy.get(
`[href="#/order/list?createForm={%22clientFk%22:${clientId},%22addressId%22:1}"] > .q-btn__content > .q-icon`,
).click();
cy.dataCy('vnTableCreateBtn').click();
cy.get('[data-cy="Client_select"]').should('have.value', 'Bruce Wayne');
cy.get('[data-cy="Address_select"]').should('have.value', 'Bruce Wayne');
cy.dataCy('landedDate').find('input').type('06/01/2001');
cy.get('.q-card [data-cy="Agency_select"]').click();
cy.get('.q-menu > div> .q-item:nth-child(1)').click();
cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale');
cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click();
cy.wait('@orderSale');
cy.get('.q-item > .q-item__label.subtitle').then((text) => {
const id = text.text().trim().split('#')[1];
cy.get('.q-item > .q-item__label').should('have.text', ` #${id}`);
});
cy.url().should('include', `/order`);
});
});

View File

@ -139,7 +139,7 @@ describe('Ticket Lack detail', () => {
cy.wait('@getItemGetSimilar');
});
describe('Replace item if', () => {
it.only('Quantity is less than available', () => {
it('Quantity is less than available', () => {
cy.get(':nth-child(1) > .text-right > .q-btn').click();
});
});

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" />
describe.only('TicketList', () => {
describe('TicketList', () => {
const firstRow = 'tbody.q-virtual-scroll__content tr:nth-child(1)';
beforeEach(() => {
@ -12,12 +12,10 @@ describe.only('TicketList', () => {
const searchResults = (search) => {
if (search) cy.typeSearchbar().type(search);
cy.dataCy('vn-searchbar').find('input').type('{enter}');
// cy.dataCy('ticketListTable').should('exist');
cy.get(firstRow).should('exist');
};
it('should search results', () => {
// cy.dataCy('ticketListTable').should('not.exist');
cy.get('.q-field__control').should('exist');
searchResults();
});
@ -53,7 +51,7 @@ describe.only('TicketList', () => {
cy.getOption().click();
cy.dataCy('Address_select').should('have.value', 'Bruce Wayne');
});
it('Client list create new client', () => {
it('Client list create new ticket', () => {
cy.dataCy('vnTableCreateBtn').should('exist');
cy.dataCy('vnTableCreateBtn').click();
const data = {