40 lines
1.4 KiB
JavaScript
40 lines
1.4 KiB
JavaScript
describe('ZoneDeliveryDays', () => {
|
|
const postcode = '46680';
|
|
const agency = 'Gotham247Expensive';
|
|
const submitForm = '.q-form > .q-btn > .q-btn__content';
|
|
beforeEach(() => {
|
|
cy.login('developer');
|
|
cy.visit(`/#/zone/delivery-days`);
|
|
});
|
|
|
|
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',
|
|
);
|
|
});
|
|
|
|
it('should query for delivery', () => {
|
|
cy.intercept('GET', /\/api\/Zones\/getEvents/, (req) => {
|
|
req.headers['cache-control'] = 'no-cache';
|
|
req.headers['pragma'] = 'no-cache';
|
|
req.headers['expires'] = '0';
|
|
req.on('response', (res) => {
|
|
delete res.headers['if-none-match'];
|
|
delete res.headers['if-modified-since'];
|
|
});
|
|
}).as('events');
|
|
|
|
cy.selectOption('[data-cy="ZoneDeliveryDaysPostcodeSelect"]', postcode);
|
|
cy.selectOption('[data-cy="ZoneDeliveryDaysAgencySelect"]', agency);
|
|
|
|
cy.get(submitForm).click();
|
|
cy.wait('@events').then((interception) => {
|
|
cy.log('interception: ', interception);
|
|
const data = interception.response.body.events;
|
|
expect(data.length).to.be.greaterThan(0);
|
|
});
|
|
});
|
|
});
|