feat: refs #6242 added e2e to verify the icons shown

This commit is contained in:
Jon Elias 2025-01-29 14:37:41 +01:00
parent 264881274d
commit b55ddf4cec
2 changed files with 27 additions and 2 deletions

View File

@ -119,7 +119,7 @@ const setData = (entity) => {
<FetchData
:url="`Tickets/${entityId}/getTicketProblems`"
auto-load
@on-fetch="(data) => (problems = data)"
@on-fetch="(data) => ([problems] = data)"
/>
<CardDescriptor
module="Ticket"
@ -177,7 +177,7 @@ const setData = (entity) => {
</template>
<template #icons>
<QCardActions class="q-gutter-x-xs">
<TicketProblems :row="problems[0]" />
<TicketProblems :row="problems" />
</QCardActions>
</template>
<template #actions="{ entity }">

View File

@ -53,4 +53,29 @@ describe('TicketList', () => {
cy.checkNotification('Data created');
cy.url().should('match', /\/ticket\/\d+\/summary/);
});
it('should show the corerct problems', () => {
cy.intercept('GET', '**/api/Tickets/filter*', (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('ticket');
cy.get('[data-cy="Warehouse_select"]').type('Warehouse Five');
cy.get('.q-menu .q-item').contains('Warehouse Five').click();
cy.wait('@ticket').then((interception) => {
const data = interception.response.body[1];
expect(data.hasComponentLack).to.equal(1);
expect(data.isTooLittle).to.equal(1);
expect(data.hasItemShortage).to.equal(1);
});
cy.get('.icon-components').should('exist');
cy.get('.icon-unavailable').should('exist');
cy.get('.icon-isTooLittle').should('exist');
});
});