diff --git a/cypress/integration/item/hide/hideItem.spec.js b/cypress/integration/item/hide/hideItem.spec.js index 205a4875e..55fcad8fb 100644 --- a/cypress/integration/item/hide/hideItem.spec.js +++ b/cypress/integration/item/hide/hideItem.spec.js @@ -8,14 +8,16 @@ import { import { TABLE_ITEM_RENDER_TIME } from '../../../support/constants'; import { ITEM_LAYOUT_MODES } from '../../../../src/enums'; -const togglePinButton = (itemId) => { +const HiddenTagId = 'hiddenTagId'; + +const toggleHideButton = (itemId) => { cy.wait(TABLE_ITEM_RENDER_TIME); cy.get( `${buildItemsTableRowIdAttribute(itemId)} .${HIDDEN_ITEM_BUTTON_CLASS}`, ).click(); }; -const togglePinButtonCard = (itemId) => { +const toggleHideButtonCard = (itemId) => { cy.wait(TABLE_ITEM_RENDER_TIME); cy.get(`#${buildItemCard(itemId)} .${HIDDEN_ITEM_BUTTON_CLASS}`).click(); }; @@ -30,7 +32,7 @@ describe('Hiding Item', () => { it('Hide an item', () => { const item = ITEMS_SETTINGS.items[1]; - togglePinButton(item.id); + toggleHideButton(item.id); cy.wait(`@postItemTag`).then( ({ @@ -38,7 +40,7 @@ describe('Hiding Item', () => { body: { tagId }, }, }) => { - expect(tagId).to.equals('b5373e38-e89b-4dc7-b4b9-fd3601504467'); + expect(tagId).to.equals(HiddenTagId); }, ); }); @@ -47,7 +49,7 @@ describe('Hiding Item', () => { const item = HIDDEN_ITEM; cy.wait(5000); - togglePinButton(item.id); + toggleHideButton(item.id); cy.wait('@deleteItemTag').then(({ request: { url } }) => { expect(url).to.contain(item.tags[1].id); @@ -62,10 +64,10 @@ describe('Hiding Item', () => { cy.switchMode(ITEM_LAYOUT_MODES.GRID); }); - it('Pin an item', () => { + it('Hide an item', () => { const item = ITEMS_SETTINGS.items[1]; - togglePinButtonCard(item.id); + toggleHideButtonCard(item.id); cy.wait(`@postItemTag`).then( ({ @@ -73,15 +75,15 @@ describe('Hiding Item', () => { body: { tagId }, }, }) => { - expect(tagId).to.equals('b5373e38-e89b-4dc7-b4b9-fd3601504467'); + expect(tagId).to.equals(HiddenTagId); }, ); }); - it('Unpin Item', () => { + it('Show an Item', () => { const item = ITEMS_SETTINGS.items[0]; - togglePinButtonCard(item.id); + toggleHideButtonCard(item.id); cy.wait('@deleteItemTag').then(({ request: { url } }) => { expect(url).to.contain(item.tags[1].id); diff --git a/cypress/integration/item/pin/pinItem.spec.js b/cypress/integration/item/pin/pinItem.spec.js index 647573794..0f5f82bb4 100644 --- a/cypress/integration/item/pin/pinItem.spec.js +++ b/cypress/integration/item/pin/pinItem.spec.js @@ -17,13 +17,10 @@ const togglePinButton = (itemId) => { const togglePinButtonCard = (itemId) => { cy.wait(TABLE_ITEM_RENDER_TIME); - cy.get( - `#${buildItemCard(itemId)} .${PIN_ITEM_BUTTON_CLASS}`, - ).click(); + cy.get(`#${buildItemCard(itemId)} .${PIN_ITEM_BUTTON_CLASS}`).click(); }; describe('Pinning Item', () => { - describe('Successfully pinning item in List', () => { beforeEach(() => { cy.setUpApi(ITEMS_SETTINGS); @@ -37,16 +34,17 @@ describe('Pinning Item', () => { cy.wait(`@editItem`).then( ({ - request: { - body : { settings } - } + request: { + body: { settings }, + }, }) => { - expect(settings.isPinned).to.equals(true); - }); + expect(settings.isPinned).to.equals(true); + }, + ); }); it('Unpin Item', () => { - const item = ITEMS_SETTINGS.items[0]; + const item = ITEMS_SETTINGS.items[1]; togglePinButton(item.id); @@ -62,7 +60,6 @@ describe('Pinning Item', () => { }); }); - describe('Successfully pinning item in Grid', () => { beforeEach(() => { cy.setUpApi(ITEMS_SETTINGS); @@ -77,16 +74,17 @@ describe('Pinning Item', () => { cy.wait(`@editItem`).then( ({ - request: { - body : { settings } - } + request: { + body: { settings }, + }, }) => { - expect(settings.isPinned).to.equals(true); - }); + expect(settings.isPinned).to.equals(true); + }, + ); }); it('Unpin Item', () => { - const item = ITEMS_SETTINGS.items[0]; + const item = ITEMS_SETTINGS.items[1]; togglePinButtonCard(item.id); diff --git a/cypress/integration/item/settings/itemSettings.spec.js b/cypress/integration/item/settings/itemSettings.spec.js index 974d922be..c6e0adb68 100644 --- a/cypress/integration/item/settings/itemSettings.spec.js +++ b/cypress/integration/item/settings/itemSettings.spec.js @@ -9,12 +9,12 @@ import { EDIT_ITEM_PAUSE } from '../../../support/constants'; describe('Item Settings', () => { beforeEach(() => { - cy.setUpApi({...ITEMS_SETTINGS}); + cy.setUpApi({ ...ITEMS_SETTINGS }); }); describe('Chatbox Settings', () => { it('Disabling Chatbox', () => { - const itemId = ITEMS_SETTINGS.items[0].id; + const itemId = ITEMS_SETTINGS.items[1].id; cy.visit(buildItemPath(itemId)); cy.get(`.${ITEM_SETTINGS_BUTTON_CLASS}`).click(); @@ -25,9 +25,9 @@ describe('Item Settings', () => { cy.wait('@editItem').then( ({ - response: { - body: { settings }, - } + response: { + body: { settings }, + }, }) => { expect(settings.showChatbox).equals(false); cy.wait(EDIT_ITEM_PAUSE); @@ -37,7 +37,7 @@ describe('Item Settings', () => { }); it('Enabling Chatbox', () => { - const itemId = ITEMS_SETTINGS.items[1].id; + const itemId = ITEMS_SETTINGS.items[2].id; cy.visit(buildItemPath(itemId)); cy.get(`.${ITEM_SETTINGS_BUTTON_CLASS}`).click(); @@ -45,12 +45,12 @@ describe('Item Settings', () => { cy.get(`#${SETTINGS_CHATBOX_TOGGLE_ID}`).should('not.be.checked'); cy.get(`#${SETTINGS_CHATBOX_TOGGLE_ID}`).click(); - + cy.wait('@editItem').then( ({ - response: { - body: { settings }, - } + response: { + body: { settings }, + }, }) => { expect(settings.showChatbox).equals(true); cy.wait(EDIT_ITEM_PAUSE); @@ -62,7 +62,7 @@ describe('Item Settings', () => { describe('Pinned Settings', () => { it('Unpin Items', () => { - const itemId = ITEMS_SETTINGS.items[0].id; + const itemId = ITEMS_SETTINGS.items[1].id; cy.visit(buildItemPath(itemId)); cy.get(`.${ITEM_SETTINGS_BUTTON_CLASS}`).click(); @@ -73,9 +73,9 @@ describe('Item Settings', () => { cy.wait('@editItem').then( ({ - response: { - body: { settings }, - } + response: { + body: { settings }, + }, }) => { expect(settings.isPinned).equals(false); cy.wait(EDIT_ITEM_PAUSE); @@ -85,7 +85,7 @@ describe('Item Settings', () => { }); it('Pin Item', () => { - const itemId = ITEMS_SETTINGS.items[1].id; + const itemId = ITEMS_SETTINGS.items[2].id; cy.visit(buildItemPath(itemId)); cy.get(`.${ITEM_SETTINGS_BUTTON_CLASS}`).click(); @@ -95,9 +95,9 @@ describe('Item Settings', () => { cy.wait('@editItem').then( ({ - response: { - body: { settings }, - } + response: { + body: { settings }, + }, }) => { expect(settings.isPinned).equals(true); cy.wait(EDIT_ITEM_PAUSE);