diff --git a/cypress/e2e/with_mock_data/catalogueItems.cy.ts b/cypress/e2e/with_mock_data/catalogueItems.cy.ts index 1c31bd91c..2ad44d17c 100644 --- a/cypress/e2e/with_mock_data/catalogueItems.cy.ts +++ b/cypress/e2e/with_mock_data/catalogueItems.cy.ts @@ -509,6 +509,26 @@ describe('Catalogue Items', () => { .should('include', '_blank'); // Check target attribute value }); + it('checks the href property of the number of spares (Table)', () => { + cy.findByRole('button', { name: 'Show/Hide columns' }).click(); + cy.findByText('Hide all').click(); + + cy.findByText('Number of spares').click(); + + cy.findAllByText('2') + .first() + .should('have.attr', 'href') + .should( + 'include', + '/catalogue/item/1/items?state=N4IgxgYiBcDaoEsAmMQIC4FMC2A6ArgM4CGA5pgPqHrHpEgA0IAbsQDb6YzwjoCeABy7QQ1AE4IAdqUYt2nVADlMAdxABfBqH5DU4qTKasOwkAFVCmFOoC6t9UA' + ); + + cy.findAllByText('2').first().click({ force: true }); + + cy.findByText('vYs9Vxx6yWbn').should('exist'); + cy.findByText('Zf7P8Qu8TD8c').should('not.exist'); + }); + it('displays the expired landing page message and navigates back to the catalogue home', () => { cy.visit('/catalogue/item/1fds'); @@ -910,6 +930,22 @@ describe('Catalogue Items', () => { cy.url().should('contain', 'catalogue/item/89/items'); }); + it('can navigate to an items page (with applied spares definition) from the landing page', () => { + cy.visit('/catalogue/5'); + cy.findByText('Energy Meters 26').click(); + cy.findByText('1') + .should('have.attr', 'href') + .should( + 'include', + '/catalogue/item/89/items?state=N4IgxgYiBcDaoEsAmMQIC4FMC2A6ArgM4CGA5pgPqHrHpEgA0IAbsQDb6YzwjoCeABy7QQ1AE4IAdqUYt2nVADlMAdxABfBqH5DU4qTKasOwkAFVCmFOoC6t9UA' + ); + + cy.findByText('1').click(); + + cy.findByText('qKcw2send4S8').should('exist'); + cy.findByText('0QcKayBCxRm4').should('not.exist'); + }); + it('opens add dialog for categories in directory and has functionality of duplicate', () => { cy.visit('/catalogue/5'); cy.findAllByLabelText('Toggle select row').first().click(); @@ -1059,6 +1095,7 @@ describe('Catalogue Items', () => { notes: 'Need to find new manufacturer. 26', created_time: '2024-01-01T12:00:00.000+00:00', modified_time: '2024-01-02T13:10:10.000+00:00', + number_of_spares: 1, }) ); expect(JSON.stringify(await patchRequests[1].json())).equal( @@ -1086,6 +1123,7 @@ describe('Catalogue Items', () => { notes: 'Need to find new manufacturer. 27', created_time: '2024-01-01T12:00:00.000+00:00', modified_time: '2024-01-02T13:10:10.000+00:00', + number_of_spares: 2, }) ); }); diff --git a/cypress/e2e/with_mock_data/items.cy.ts b/cypress/e2e/with_mock_data/items.cy.ts index 0e46a41fd..01c6f5b62 100644 --- a/cypress/e2e/with_mock_data/items.cy.ts +++ b/cypress/e2e/with_mock_data/items.cy.ts @@ -20,6 +20,29 @@ describe('Items', () => { cy.findByText('Beam Characterization').should('be.visible'); }); + it('should be able to set and unset spares filter', () => { + cy.visit('/catalogue/item/1/items'); + + cy.findByText('5YUQDDjKpz2z').should('exist'); + cy.findByText('vYs9Vxx6yWbn').should('exist'); + cy.findByText('PcfCM1jp0SUV').should('exist'); + cy.findByText('Zf7P8Qu8TD8c').should('exist'); + + cy.findByText('Apply spares filter').click(); + + cy.findByText('5YUQDDjKpz2z').should('not.exist'); + cy.findByText('vYs9Vxx6yWbn').should('exist'); + cy.findByText('PcfCM1jp0SUV').should('exist'); + cy.findByText('Zf7P8Qu8TD8c').should('not.exist'); + + cy.findByRole('button', { name: 'Clear Filters' }).click(); + + cy.findByText('5YUQDDjKpz2z').should('exist'); + cy.findByText('vYs9Vxx6yWbn').should('exist'); + cy.findByText('PcfCM1jp0SUV').should('exist'); + cy.findByText('Zf7P8Qu8TD8c').should('exist'); + }); + it('should be able to navigate back to the catalogue home step by step', () => { cy.visit('/catalogue/item/1/items/KvT2Ox7n'); diff --git a/src/admin/__snapshots__/adminCard.component.test.tsx.snap b/src/admin/__snapshots__/adminCard.component.test.tsx.snap index fc9d9d6cd..d44f961eb 100644 --- a/src/admin/__snapshots__/adminCard.component.test.tsx.snap +++ b/src/admin/__snapshots__/adminCard.component.test.tsx.snap @@ -69,351 +69,6 @@ exports[`AdminCard Component > dialog > renders correctly with "dialog" type 1`]
- - - - - - -