describe('ZoneLocations', () => { const cp = 46680; const searchIcon = '.router-link-active > .q-icon'; beforeEach(() => { cy.login('developer'); cy.visit(`/#/zone/2/location`); }); it('should be able to search by postal code', () => { cy.get('.q-tree > :nth-child(1) > :nth-child(2) > :nth-child(1)') .should('exist') .should('be.visible'); cy.intercept('GET', '**/api/Zones/2/getLeaves*', (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('location'); cy.get('#searchbarForm').type(cp); cy.get(searchIcon).click(); cy.wait('@location').then((interception) => { const data = interception.response.body; expect(data).to.include(cp); }); }); it('should check, uncheck, and set a location to mixed state', () => { cy.get('#searchbarForm').type(cp); cy.get(searchIcon).click(); cy.get('.q-tree > :nth-child(1) > :nth-child(2) > :nth-child(1)') .as('tree') .within(() => { cy.get('[data-cy="ZoneLocationTreeCheckbox"] > .q-checkbox__inner') .last() .as('lastCheckbox'); const verifyCheckboxState = (state) => { cy.get('@lastCheckbox') .parents('.q-checkbox') .should('have.attr', 'aria-checked', state); }; cy.get('@lastCheckbox').click(); verifyCheckboxState('true'); cy.get('@lastCheckbox').click(); verifyCheckboxState('false'); cy.get('@lastCheckbox').click(); verifyCheckboxState('mixed'); }); }); });