Skip to content

Commit 6166fe3

Browse files
authored
Setup e2e api tests for primary images #1338 (#1411)
* 1st draft at adding obj-store-api to github actions #1088 * add OS api to CI #1088 * Updated cypress support functions to handle object storage api #1088 * updated cypress command to point to correct database #1088 * added CRUD functions and tests for attachments TODO: add download test #1338 * added tests for download functionality #1338 * fix linting * refactored attachment test functions to work with images #1338 * fix failing tests #1338 * move attachments test into items suite #1338 * change config for quick testing on CI: Revert later #1338 * diagnose * REVERT LATER: Delete other cypress tests #1338 * diagnose * attempted fix to minio * attempted fix * Revert "REVERT LATER: Delete other cypress tests #1338" This reverts commit eebb68b. * Revert "change config for quick testing on CI: Revert later #1338" This reverts commit ac2193c. * Moved attachments into catalogue items tests suite #1338 * finish moving to catalogue items #1338 * finish moving Attachments to catalogue items #1338 * update images button access #1338 * add set primary image e2e api tests #1338 * add view primary image (lightbox) test #1338 * REVERT LATER: remove extra api tests for quick debugging * fix set/view functions #1338 * add remove primary image test #1338 * Revert "REVERT LATER: remove extra api tests for quick debugging" This reverts commit fa93b40.
1 parent d5e80bd commit 6166fe3

File tree

3 files changed

+52
-1
lines changed

3 files changed

+52
-1
lines changed

.github/workflows/ci-build.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ jobs:
146146
mv -v inventory-management-system/* .
147147
cd object-storage-api/
148148
149-
150149
- name: Start MongoDB and MinIO (For object-storage-api)
151150
working-directory: ../object-storage-api
152151
run: |

cypress/e2e/with_api/catalogueItems/catalogueItems.cy.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ import {
1515
editFile,
1616
moveToCatalogueItems,
1717
obsoleteCatalogueItem,
18+
removePrimaryImage,
19+
setPrimaryImage,
20+
viewPrimaryImage,
1821
} from './functions';
1922

2023
describe('catalogue items', () => {
@@ -83,6 +86,9 @@ describe('catalogue items', () => {
8386
'image',
8487
true
8588
);
89+
setPrimaryImage(0, true);
90+
viewPrimaryImage();
91+
removePrimaryImage();
8692
editFile(
8793
{
8894
originalFileName: 'logo1.png',

cypress/e2e/with_api/catalogueItems/functions.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,3 +508,49 @@ export const deleteFile = (
508508
cy.findByRole('dialog').should('not.exist');
509509
});
510510
};
511+
512+
export const setPrimaryImage = (index: number, ignoreChecks: boolean) => {
513+
cy.findByRole('button', { name: 'primary images action menu' }).click();
514+
cy.findByText('Set Primary Image').click();
515+
cy.findByRole('dialog')
516+
.should('be.visible')
517+
.within(() => {
518+
cy.findAllByRole('radio').eq(index).click();
519+
cy.findByText('Save').click();
520+
});
521+
cy.findByRole('dialog').should('not.exist');
522+
if (!ignoreChecks) {
523+
cy.findByRole('img', { name: 'No Image' }).should('not.exist');
524+
}
525+
};
526+
527+
export const viewPrimaryImage = () => {
528+
cy.findAllByRole('img', { name: 'No photo description available.' }).should(
529+
'have.length',
530+
3
531+
);
532+
cy.findByText('No Image').should('not.exist');
533+
cy.findAllByRole('img', { name: 'No photo description available.' })
534+
.first()
535+
.click();
536+
cy.findByTestId('galleryLightBox').within(() => {
537+
cy.findByText('File name: logo2.png').should('exist');
538+
cy.findByText('No description available').should('exist');
539+
540+
cy.findByRole('img', { name: 'No Image' }).should('not.exist');
541+
cy.findAllByLabelText('Close').last().click();
542+
});
543+
cy.findByTestId('galleryLightBox').should('not.exist');
544+
};
545+
546+
export const removePrimaryImage = () => {
547+
cy.findByRole('button', { name: 'primary images action menu' }).click();
548+
cy.findByText('Remove Primary Image').click();
549+
cy.findByRole('dialog')
550+
.should('be.visible')
551+
.within(() => {
552+
cy.findByText('Continue').click();
553+
});
554+
cy.findByRole('dialog').should('not.exist');
555+
cy.findByRole('img', { name: 'No Image' }).should('exist');
556+
};

0 commit comments

Comments
 (0)