8713-testToMaster #1539
|
@ -432,7 +432,7 @@ watch(
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
if (newValue) {
|
if (newValue) {
|
||||||
const clientId = +JSON.parse(newValue)?.clientFk;
|
const clientId = +JSON.parse(newValue)?.clientFk;
|
||||||
if (!clientFk) return;
|
if (!clientId) return;
|
||||||
formInitialData.value = {
|
formInitialData.value = {
|
||||||
clientId,
|
clientId,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
describe('TicketList', () => {
|
describe('TicketList', () => {
|
||||||
const firstRow = 'tbody > :nth-child(1)';
|
const firstRow = 'tbody.q-virtual-scroll__content tr:nth-child(1)';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
cy.visit('/#/ticket/list');
|
cy.visit('/#/ticket/list');
|
||||||
|
cy.domContentLoad();
|
||||||
});
|
});
|
||||||
|
|
||||||
const searchResults = (search) => {
|
const searchResults = (search) => {
|
||||||
cy.dataCy('vn-searchbar').find('input').focus();
|
if (search) cy.typeSearchbar().type(search);
|
||||||
if (search) cy.dataCy('vn-searchbar').find('input').type(search);
|
|
||||||
cy.dataCy('vn-searchbar').find('input').type('{enter}');
|
cy.dataCy('vn-searchbar').find('input').type('{enter}');
|
||||||
cy.dataCy('ticketListTable').should('exist');
|
cy.dataCy('ticketListTable').should('exist');
|
||||||
cy.get(firstRow).should('exist');
|
cy.get(firstRow).should('exist');
|
||||||
|
@ -27,7 +27,7 @@ describe('TicketList', () => {
|
||||||
cy.window().then((win) => {
|
cy.window().then((win) => {
|
||||||
cy.stub(win, 'open').as('windowOpen');
|
cy.stub(win, 'open').as('windowOpen');
|
||||||
});
|
});
|
||||||
cy.get(firstRow).find('.q-btn:first').click();
|
cy.get(firstRow).should('be.visible').find('.q-btn:first').click();
|
||||||
cy.get('@windowOpen').should('be.calledWithMatch', /\/ticket\/\d+\/sale/);
|
cy.get('@windowOpen').should('be.calledWithMatch', /\/ticket\/\d+\/sale/);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -38,6 +38,36 @@ describe('TicketList', () => {
|
||||||
cy.get('.summaryBody').should('exist');
|
cy.get('.summaryBody').should('exist');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it.only('Filter client and create ticket', () => {
|
||||||
|
cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketSearchbar');
|
||||||
|
searchResults();
|
||||||
|
cy.wait('@ticketSearchbar').then((interception) => {
|
||||||
|
const { query } = interception.request;
|
||||||
|
cy.log('Request query:', query);
|
||||||
|
expect(query).to.have.property('from');
|
||||||
|
expect(query).to.have.property('to');
|
||||||
|
expect(query).to.not.have.property('clientFk');
|
||||||
|
});
|
||||||
|
cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketFilter');
|
||||||
|
cy.get('[data-cy="Customer ID_input"]').clear('1');
|
||||||
|
cy.get('[data-cy="Customer ID_input"]').type('1101{enter}');
|
||||||
|
cy.wait('@ticketFilter').then((interception) => {
|
||||||
|
const { query } = interception.request;
|
||||||
|
cy.log('Request query:', query);
|
||||||
|
expect(query).to.not.have.property('from');
|
||||||
|
expect(query).to.not.have.property('to');
|
||||||
|
expect(query).to.have.property('clientFk');
|
||||||
|
});
|
||||||
|
cy.get('[data-cy="vnTableCreateBtn"] > .q-btn__content > .q-icon').click();
|
||||||
|
cy.get('[data-cy="Customer_select"]').should('have.value', 'Bruce Wayne');
|
||||||
|
cy.get('[data-cy="Address_select"]').click();
|
||||||
|
|
||||||
|
cy.selectOptionBeta().click();
|
||||||
|
cy.get('[data-cy="Address_select"]').should('have.value', 'Bruce Wayne');
|
||||||
|
// cy.get('[role="listbox"] .q-item:nth-child(1)>.q-item__section--avatar > i')
|
||||||
|
// .should('have.text', 'star')
|
||||||
|
// .click();
|
||||||
|
});
|
||||||
it('Client list create new client', () => {
|
it('Client list create new client', () => {
|
||||||
cy.dataCy('vnTableCreateBtn').should('exist');
|
cy.dataCy('vnTableCreateBtn').should('exist');
|
||||||
cy.dataCy('vnTableCreateBtn').click();
|
cy.dataCy('vnTableCreateBtn').click();
|
||||||
|
|
|
@ -365,3 +365,6 @@ Cypress.Commands.add('clickButtonWithIcon', (iconClass) => {
|
||||||
Cypress.Commands.add('clickButtonWithText', (buttonText) => {
|
Cypress.Commands.add('clickButtonWithText', (buttonText) => {
|
||||||
cy.get('.q-btn').contains(buttonText).click();
|
cy.get('.q-btn').contains(buttonText).click();
|
||||||
});
|
});
|
||||||
|
Cypress.Commands.add('selectOptionBeta', (index = 1) => {
|
||||||
|
cy.get(`[role="listbox"] .q-item:nth-child(${index})`).click();
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue