refactor: refs #8600 modified upcomingDeliveries e2e and created deliveryDays
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jon Elias 2025-02-19 16:24:30 +01:00
parent 21d2438c5d
commit 7f8f527035
2 changed files with 52 additions and 3 deletions

View File

@ -1,15 +1,56 @@
describe('ZoneDeliveryDays', () => {
const postcode = '46680';
const agency = 'Gotham247Expensive';
const submitForm = '.q-form > .q-btn > .q-btn__content';
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit(`/#/zone/delivery-days`);
});
it('should query for the day', () => {
it('should return no data when querying without params', () => {
cy.get('.q-form > .q-btn > .q-btn__content').click();
cy.get('.q-notification__message').should(
'have.text',
'No service for the specified zone'
'No service for the specified zone',
);
});
it('should query for delivery', () => {
cy.intercept('GET', /\/api\/Zones\/getEvents/).as('events');
cy.selectOption('[data-cy="ZoneDeliveryDaysPostcodeSelect"]', postcode);
cy.dataCy('ZoneDeliveryDaysPostcodeSelect').type(postcode);
cy.get('.q-menu .q-item').contains(postcode).click();
cy.get('.q-menu').then(($menu) => {
if ($menu.is(':visible')) {
cy.get('[data-cy="ZoneDeliveryDaysPostcodeSelect"]')
.as('focusedElement')
.focus();
cy.get('@focusedElement').blur();
}
});
cy.get('.q-menu').should('not.exist');
cy.dataCy('ZoneDeliveryDaysAgencySelect').type(agency);
cy.get('.q-menu .q-item').contains(agency).click();
cy.get('.q-menu').then(($menu) => {
if ($menu.is(':visible')) {
cy.get('[data-cy="ZoneDeliveryDaysAgencySelect"]')
.as('focusedElement')
.focus();
cy.get('@focusedElement').blur();
}
});
cy.get('.q-menu').should('not.exist');
cy.get(submitForm).click();
cy.wait('@events').then((interception) => {
cy.log('interception: ', interception);
//TODO: interceptar llamada y comprobar que el objeto de los eventos no está vacío
// const data = interception.response.body;
// expect(data.hasComponentLack).to.equal(1);
});
});
});

View File

@ -1,9 +1,17 @@
describe('ZoneUpcomingDeliveries', () => {
const tableFields = (opt) =>
`:nth-child(1) > .q-table__container > .q-table__middle > .q-table > thead > tr > :nth-child(${opt})`;
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit(`/#/zone/upcoming-deliveries`);
});
it('should show the page', () => {});
it('should show the page', () => {
cy.get('.q-card').should('be.visible');
cy.get(tableFields(1)).should('be.visible').should('have.text', 'Province');
cy.get(tableFields(2)).should('be.visible').should('have.text', 'Closing');
cy.get(tableFields(3)).should('be.visible').should('have.text', 'Id');
});
});