diff --git a/cypress/e2e/item/thumbnails/uploadThumbnail.cy.ts b/cypress/e2e/item/thumbnails/uploadThumbnail.cy.ts index 658f841b0..77fe38174 100644 --- a/cypress/e2e/item/thumbnails/uploadThumbnail.cy.ts +++ b/cypress/e2e/item/thumbnails/uploadThumbnail.cy.ts @@ -1,7 +1,7 @@ import { buildItemPath } from '../../../../src/config/paths'; import { CROP_MODAL_CONFIRM_BUTTON_CLASSNAME, - ITEM_SETTINGS_BUTTON_CLASS, + ITEM_INFORMATION_BUTTON_ID, THUMBNAIL_SETTING_UPLOAD_BUTTON_CLASSNAME, } from '../../../../src/config/selectors'; import { @@ -18,7 +18,7 @@ describe('Upload Thumbnails', () => { it(`upload item thumbnail`, () => { const { items } = SAMPLE_ITEMS_WITH_THUMBNAILS; cy.visit(buildItemPath(items[0].id)); - cy.get(`.${ITEM_SETTINGS_BUTTON_CLASS}`).click(); + cy.get(`#${ITEM_INFORMATION_BUTTON_ID}`).click(); // change item thumbnail // selectFile ??? diff --git a/cypress/e2e/item/view/viewFolder.cy.ts b/cypress/e2e/item/view/viewFolder.cy.ts index 4cab78149..2ef4604ae 100644 --- a/cypress/e2e/item/view/viewFolder.cy.ts +++ b/cypress/e2e/item/view/viewFolder.cy.ts @@ -36,8 +36,6 @@ describe('View Folder', () => { // should get current item cy.wait('@getItem'); - expectFolderViewScreenLayout({ item: SAMPLE_ITEMS.items[0] }); - // should get children cy.wait('@getChildren').then(({ response: { body } }) => { // check all children are created and displayed @@ -45,6 +43,7 @@ describe('View Folder', () => { cy.get(`#${buildItemCard(item.id)}`).should('exist'); } }); + expectFolderViewScreenLayout({ item: SAMPLE_ITEMS.items[0] }); // visit home cy.get(`#${NAVIGATION_ROOT_ID} [href="${HOME_PATH}"]`).click(); @@ -81,9 +80,6 @@ describe('View Folder', () => { // should get current item cy.wait('@getItem'); - - expectFolderViewScreenLayout({ item: SAMPLE_ITEMS.items[0] }); - // should get children cy.wait('@getChildren').then(({ response: { body } }) => { // check all children are created and displayed @@ -92,6 +88,7 @@ describe('View Folder', () => { } }); + expectFolderViewScreenLayout({ item: SAMPLE_ITEMS.items[0] }); // visit home cy.get(`#${NAVIGATION_ROOT_ID} [href="${HOME_PATH}"]`).click(); diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 1a9b1c710..1a1566470 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -6,8 +6,6 @@ import 'cypress-localstorage-commands'; import { DEFAULT_ITEM_LAYOUT_MODE } from '../../src/config/constants'; import { ITEM_INFORMATION_BUTTON_ID, - ITEM_INFORMATION_ICON_IS_OPEN_CLASS, - ITEM_PANEL_ID, MODE_GRID_BUTTON_ID, MODE_LIST_BUTTON_ID, } from '../../src/config/selectors'; @@ -398,11 +396,7 @@ Cypress.Commands.add( ); Cypress.Commands.add('openMetadataPanel', () => { - cy.get(`#${ITEM_PANEL_ID}`).then(($itemPanel) => { - if (!$itemPanel.hasClass(ITEM_INFORMATION_ICON_IS_OPEN_CLASS)) { - cy.get(`#${ITEM_INFORMATION_BUTTON_ID}`).click(); - } - }); + cy.get(`#${ITEM_INFORMATION_BUTTON_ID}`).click(); }); Cypress.Commands.add('attachFile', (selector, file, options = {}) => { diff --git a/cypress/support/viewUtils.ts b/cypress/support/viewUtils.ts index a0bc9d20a..32ec08fbc 100644 --- a/cypress/support/viewUtils.ts +++ b/cypress/support/viewUtils.ts @@ -17,7 +17,6 @@ import { import { DOCUMENT_ITEM_TEXT_EDITOR_SELECTOR, ITEM_HEADER_ID, - ITEM_PANEL_ID, ITEM_PANEL_NAME_ID, ITEM_PANEL_TABLE_ID, TEXT_EDITOR_CLASS, @@ -36,21 +35,20 @@ const expectPanelLayout = ({ item }: { item: ItemForTest }) => { const { name, creator } = item; - const panel = cy.get(`#${ITEM_PANEL_ID}`); - panel.get(`#${ITEM_PANEL_NAME_ID}`).contains(name); + cy.get(`#${ITEM_PANEL_NAME_ID}`).contains(name); const creatorName = getMemberById(Object.values(MEMBERS), creator?.id).name; - panel.get(`#${ITEM_PANEL_TABLE_ID}`).should('exist').contains(creatorName); + cy.get(`#${ITEM_PANEL_TABLE_ID}`).should('exist').contains(creatorName); if (item.type === ItemType.LOCAL_FILE || item.type === ItemType.S3_FILE) { const { mimetype = 'invalid-mimetype', size = 'invalid-size' } = item.type === ItemType.LOCAL_FILE ? getFileExtra(item.extra) || {} : getS3FileExtra(item.extra) || {}; - panel.get(`#${ITEM_PANEL_TABLE_ID}`).contains(mimetype); + cy.get(`#${ITEM_PANEL_TABLE_ID}`).contains(mimetype); - panel.get(`#${ITEM_PANEL_TABLE_ID}`).contains(size); + cy.get(`#${ITEM_PANEL_TABLE_ID}`).contains(size); } }; @@ -89,11 +87,10 @@ export const expectDocumentViewScreenLayout = ({ expect(editor.html()).to.contain(getDocumentExtra(item.extra)?.content); }); + expectItemHeaderLayout({ item, currentMember }); expectPanelLayout({ item, }); - - expectItemHeaderLayout({ item, currentMember }); }; export const expectFileViewScreenLayout = ({ @@ -108,10 +105,9 @@ export const expectFileViewScreenLayout = ({ cy.get(`.${TEXT_EDITOR_CLASS}`).should('contain', item.description); + expectItemHeaderLayout({ item, currentMember }); // table expectPanelLayout({ item }); - - expectItemHeaderLayout({ item, currentMember }); }; export const expectLinkViewScreenLayout = ({ @@ -143,10 +139,9 @@ export const expectLinkViewScreenLayout = ({ cy.get(`.${TEXT_EDITOR_CLASS}`).should('contain', description); } + expectItemHeaderLayout({ item, currentMember }); // table expectPanelLayout({ item }); - - expectItemHeaderLayout({ item, currentMember }); }; export const expectFolderViewScreenLayout = ({ @@ -157,7 +152,6 @@ export const expectFolderViewScreenLayout = ({ currentMember?: MemberForTest | null; }): void => { // table - expectPanelLayout({ item }); - expectItemHeaderLayout({ item, currentMember }); + expectPanelLayout({ item }); };