fix: refs #7869 fixed locations e2e
gitea/salix-front/pipeline/pr-dev This commit is unstable Details

This commit is contained in:
Jon Elias 2025-03-13 11:51:48 +01:00
parent 12f59cbe04
commit 4730485324
3 changed files with 55 additions and 22 deletions

View File

@ -34,9 +34,10 @@ const onSelected = async (val, node) => {
node.selected
? '--checked'
: node.selected == false
? '--unchecked'
: '--indeterminate',
? '--unchecked'
: '--indeterminate',
]"
data-cy="ZoneLocationTreeCheckbox"
/>
</template>
</ZoneLocationsTree>

View File

@ -1,11 +1,10 @@
describe('ZoneCalendar', () => {
const addEventBtn = '.q-page-sticky > div > .q-btn';
const submitBtn = '.q-mt-lg > .q-btn--standard';
const deleteBtn = '[data-cy="ZoneEventsPanelDeleteBtn"]';
const deleteBtn = 'ZoneEventsPanelDeleteBtn';
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit(`/#/zone/13/events`);
});
@ -14,7 +13,7 @@ describe('ZoneCalendar', () => {
cy.dataCy('ZoneEventInclusionDayRadio').click();
cy.get('.q-card > :nth-child(5)').type('01/01/2001');
cy.get(submitBtn).click();
cy.get(deleteBtn).click();
cy.dataCy(deleteBtn).click();
cy.dataCy('VnConfirm_confirm').click();
});
@ -23,7 +22,7 @@ describe('ZoneCalendar', () => {
cy.get('.flex > .q-gutter-x-sm > :nth-child(1)').click();
cy.get('.flex > .q-gutter-x-sm > :nth-child(2)').click();
cy.get(submitBtn).click();
cy.get(deleteBtn).click();
cy.dataCy(deleteBtn).click();
cy.dataCy('VnConfirm_confirm').click();
});
@ -34,7 +33,7 @@ describe('ZoneCalendar', () => {
cy.dataCy('From_inputDate').type('01/01/2001');
cy.dataCy('To_inputDate').type('31/01/2001');
cy.get(submitBtn).click();
cy.get(deleteBtn).click();
cy.dataCy(deleteBtn).click();
cy.dataCy('VnConfirm_confirm').click();
});

View File

@ -1,26 +1,59 @@
describe('ZoneLocations', () => {
const data = {
Warehouse: { val: 'Warehouse One', type: 'select' },
};
const postalCode =
'[style=""] > :nth-child(1) > :nth-child(1) > :nth-child(2) > :nth-child(1) > :nth-child(1) > :nth-child(2) > :nth-child(1) > .q-tree__node--parent > .q-tree__node-collapsible > .q-tree__children';
const cp = 46680;
const searchIcon = '.router-link-active > .q-icon';
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit(`/#/zone/2/location`);
});
it('should show all locations on entry', () => {
it('should be able to search by postal code', () => {
cy.get('.q-tree > :nth-child(1) > :nth-child(2) > :nth-child(1)')
.children()
.should('have.length', 9);
.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 be able to search by postal code', () => {
cy.get('#searchbarForm').type('46680');
cy.get('.router-link-active > .q-icon').click();
cy.get(postalCode).should('include.text', '46680');
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');
});
});
});