From 537c6c6b81abd63ed6ea5378b1f8e2a6905b5499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20=C3=96hlerking?= Date: Wed, 11 Dec 2024 15:29:50 +0100 Subject: [PATCH] remove dialog action --- cypress/e2e/mediashelf/useMediaShelf.feature | 4 - .../pages/mediashelf/pageMediaShelf.js | 233 +++++++++--------- .../mediashelf/commonMediaShelfSteps.spec.js | 93 +++---- 3 files changed, 169 insertions(+), 161 deletions(-) diff --git a/cypress/e2e/mediashelf/useMediaShelf.feature b/cypress/e2e/mediashelf/useMediaShelf.feature index 6ea26dfb..57ae6870 100644 --- a/cypress/e2e/mediashelf/useMediaShelf.feature +++ b/cypress/e2e/mediashelf/useMediaShelf.feature @@ -103,8 +103,6 @@ Feature: Media Shelf - To show media shelf with respective functionality # Teacher deletes tool When I click the three dot menu button on media element 'CY Test Tool 1' When I click on delete media element button - Then I see delete media element dialog - When I click confirm delete media element button Then I see tool 'CY Test Tool 1' in the available media line # Deleting a tool from another location @@ -122,8 +120,6 @@ Feature: Media Shelf - To show media shelf with respective functionality Then I see the no longer available chip on media element 'CY Test Tool 2' When I click the three dot menu button on media element 'CY Test Tool 2' When I click on delete media element button - Then I see delete media element dialog - When I click confirm delete media element button Then I do not see tool 'CY Test Tool 2' in the available media line # Post Test: Reset Media Shelf diff --git a/cypress/support/pages/mediashelf/pageMediaShelf.js b/cypress/support/pages/mediashelf/pageMediaShelf.js index 73284688..5df75696 100644 --- a/cypress/support/pages/mediashelf/pageMediaShelf.js +++ b/cypress/support/pages/mediashelf/pageMediaShelf.js @@ -1,6 +1,6 @@ "use strict"; -class MediaShelf { +class MediaShelf { static #mediaShelfNavigationButton = '[data-testid="Media-shelf"]'; static #mediaShelfPageTitle = '[data-testid="page-title"]'; static #gridLayoutButton = '[data-testid="media-board-layout-grid"]'; @@ -19,104 +19,107 @@ class MediaShelf { static #deleteLineButton = '[data-testid="action-delete-line"]'; static #availableLine = '[data-testid="available-line"]'; static #mediaElementThumbnail = '[data-testid="media-element-thumbnail"]'; - static #mediaElementDefaultThumbnail = '[data-testid="media-element-default-thumbnail"]'; + static #mediaElementDefaultThumbnail = + '[data-testid="media-element-default-thumbnail"]'; static #mediaElementTitle = '[data-testid="media-element-title"]'; static #mediaElementDescription = '[data-testid="media-element-description"]'; static #mediaElementDeactivatedChip = '[data-testid="warning-chip-deactivated"]'; static #mediaElementNotLicensedChip = '[data-testid="warning-chip-not-licensed"]'; static #mediaElementIncompleteChip = '[data-testid="warning-chip-incomplete"]'; - static #mediaElementNoLongerAvailableChip = '[data-testid="warning-chip-no-longer-available"]'; + static #mediaElementNoLongerAvailableChip = + '[data-testid="warning-chip-no-longer-available"]'; static #threeDotMenuOnMediaElement = '[data-testid="board-menu-icon"]'; static #deleteMediaElementButton = '[data-testid="board-menu-action-delete"]'; - static #deleteMediaElementDialog = '[data-testid="delete-dialog-item"]'; - static #confirmDeletionDialogButton = '[data-testid="dialog-confirm"]'; static #createLineButton = '[data-testid="create-line-button"]'; static #emptyStateSign = '[data-testid="empty-state"]'; static #emptyStateInfoText = '[data-testid="emptyTaskMessage"]'; - navigateToMediaShelf() { cy.get(MediaShelf.#mediaShelfNavigationButton).click(); cy.url().should("include", "/media-shelf"); } seeMediaShelfPageTitle() { - cy.get(MediaShelf.#mediaShelfPageTitle).should("exist") + cy.get(MediaShelf.#mediaShelfPageTitle).should("exist"); } - seeAvailableMediaLine() { - cy.get(MediaShelf.#availableLine).should("exist") + cy.get(MediaShelf.#availableLine).should("exist"); } seeFirstMediaLine() { - cy.get(MediaShelf.#mediaLine1).should("exist") + cy.get(MediaShelf.#mediaLine1).should("exist"); } firstMediaLineIsNotVisible() { - cy.get(MediaShelf.#mediaLine1).should("not.exist") + cy.get(MediaShelf.#mediaLine1).should("not.exist"); } seeFirstMediaLineWithTitle(title) { - const line = cy.get(MediaShelf.#mediaLineHeader1) - line.find('textarea.v-field__input') - .should('have.value', title); + const line = cy.get(MediaShelf.#mediaLineHeader1); + line.find("textarea.v-field__input").should("have.value", title); } seeMediaLineMenu() { - cy.get(MediaShelf.#editLineTitleButton).should("exist") - cy.get(MediaShelf.#colorPickerButton).should("exist") - cy.get(MediaShelf.#deleteLineButton).should("exist") + cy.get(MediaShelf.#editLineTitleButton).should("exist"); + cy.get(MediaShelf.#colorPickerButton).should("exist"); + cy.get(MediaShelf.#deleteLineButton).should("exist"); } seeAvailableMediaLineMenu() { - cy.get(MediaShelf.#colorPickerButton).should("exist") + cy.get(MediaShelf.#colorPickerButton).should("exist"); } seeAvailableBackgroundColors() { - cy.get(MediaShelf.#colorPicker).should("exist") + cy.get(MediaShelf.#colorPicker).should("exist"); } seeAvailableMediaLineMenuColor(color) { - cy.get(MediaShelf.#availableLine).should('have.css', 'background-color', color); + cy.get(MediaShelf.#availableLine).should("have.css", "background-color", color); } seeFirstMediaLineMenuColor(color) { - cy.get(MediaShelf.#mediaLine1).should('have.css', 'background-color', color); + cy.get(MediaShelf.#mediaLine1).should("have.css", "background-color", color); } isAvailableMediaLineCollapsed() { - const availableLine = cy.get(MediaShelf.#availableLine) - availableLine.find(".v-expansion-panel-text.no-inner-padding") + const availableLine = cy.get(MediaShelf.#availableLine); + availableLine + .find(".v-expansion-panel-text.no-inner-padding") .should("have.css", "display", "none"); } isAvailableMediaLineNotCollapsed() { - const availableLine = cy.get(MediaShelf.#availableLine) - availableLine.find(".v-expansion-panel-text.no-inner-padding") + const availableLine = cy.get(MediaShelf.#availableLine); + availableLine + .find(".v-expansion-panel-text.no-inner-padding") .should("not.have.css", "display", "none"); } isFirstMediaLineCollapsed() { - const line = cy.get(MediaShelf.#mediaLine1) - line.find(".v-expansion-panel-text.no-inner-padding") - .should("have.css", "display", "none"); + const line = cy.get(MediaShelf.#mediaLine1); + line.find(".v-expansion-panel-text.no-inner-padding").should( + "have.css", + "display", + "none" + ); } isFirstMediaLineNotCollapsed() { - const line = cy.get(MediaShelf.#mediaLine1) - line.find(".v-expansion-panel-text.no-inner-padding") - .should("not.have.css", "display", "none"); + const line = cy.get(MediaShelf.#mediaLine1); + line.find(".v-expansion-panel-text.no-inner-padding").should( + "not.have.css", + "display", + "none" + ); } seeGridLayout() { - cy.get(MediaShelf.#availableMediaLineSpace) - .should('have.class', 'flex-wrap') + cy.get(MediaShelf.#availableMediaLineSpace).should("have.class", "flex-wrap"); } seeListLayout() { - cy.get(MediaShelf.#availableMediaLineSpace) - .should('not.have.class', 'flex-wrap') + cy.get(MediaShelf.#availableMediaLineSpace).should("not.have.class", "flex-wrap"); } seeNumberOfMediaInAvailableMediaLine(count) { @@ -134,79 +137,70 @@ class MediaShelf { seeMediaElementDefaultThumbnail(toolName) { const element = cy.get('[data-testid="media-element-' + toolName + '"]'); - element.find(MediaShelf.#mediaElementDefaultThumbnail) - .should("exist") + element.find(MediaShelf.#mediaElementDefaultThumbnail).should("exist"); } seeMediaElementTitle(toolName) { const element = cy.get('[data-testid="media-element-' + toolName + '"]'); - element.find(MediaShelf.#mediaElementTitle) + element + .find(MediaShelf.#mediaElementTitle) .should("exist") .should("contain.text", toolName); } seeMediaElementDescription(toolName) { const element = cy.get('[data-testid="media-element-' + toolName + '"]'); - element.find(MediaShelf.#mediaElementDescription) - .should("exist") + element.find(MediaShelf.#mediaElementDescription).should("exist"); } seeMediaElementDeactivatedChip(toolName) { const element = cy.get('[data-testid="media-element-' + toolName + '"]'); - element.find(MediaShelf.#mediaElementDeactivatedChip) - .should("exist") + element.find(MediaShelf.#mediaElementDeactivatedChip).should("exist"); } seeMediaElementNotLicensedChip(toolName) { const element = cy.get('[data-testid="media-element-' + toolName + '"]'); - element.find(MediaShelf.#mediaElementNotLicensedChip) - .should("exist") + element.find(MediaShelf.#mediaElementNotLicensedChip).should("exist"); } seeMediaElementIncompleteChip(toolName) { const element = cy.get('[data-testid="media-element-' + toolName + '"]'); - element.find(MediaShelf.#mediaElementIncompleteChip) - .should("exist") + element.find(MediaShelf.#mediaElementIncompleteChip).should("exist"); } seeMediaElementNoLongerAvailableChip(toolName) { const element = cy.get('[data-testid="media-element-' + toolName + '"]'); - element.find(MediaShelf.#mediaElementNoLongerAvailableChip) - .should("exist") + element.find(MediaShelf.#mediaElementNoLongerAvailableChip).should("exist"); } mediaElementIsVisibleInAvailableMediaLine(toolName) { - const line = cy.get(MediaShelf.#availableMediaLineSpace) - line.find('[data-testid="media-element-' + toolName + '"]').should("exist") + const line = cy.get(MediaShelf.#availableMediaLineSpace); + line.find('[data-testid="media-element-' + toolName + '"]').should("exist"); } mediaElementIsNotVisibleInAvailableMediaLine(toolName) { - const line = cy.get(MediaShelf.#availableMediaLineSpace) - line.find('[data-testid="media-element-' + toolName + '"]').should("not.exist") + const line = cy.get(MediaShelf.#availableMediaLineSpace); + line.find('[data-testid="media-element-' + toolName + '"]').should("not.exist"); } clickGridLayoutButton() { - cy.get(MediaShelf.#gridLayoutButton).click() + cy.get(MediaShelf.#gridLayoutButton).click(); } clickListLayoutButton() { - cy.get(MediaShelf.#listLayoutButton).click() + cy.get(MediaShelf.#listLayoutButton).click(); } clickAddMediaLineButton() { - cy.get(MediaShelf.#createLineButton).click() + cy.get(MediaShelf.#createLineButton).click(); } clickCollapseAvailableMediaLineButton() { - cy.get(MediaShelf.#availableLine) - .find(MediaShelf.#collapseLineButton) - .click(); + cy.get(MediaShelf.#availableLine).find(MediaShelf.#collapseLineButton).click(); } clickCollapseButtonOnFirstMediaLine() { - cy.get(MediaShelf.#mediaLine1) - .find(MediaShelf.#collapseLineButton) - .click(); + cy.get(MediaShelf.#mediaLine1).find(MediaShelf.#collapseLineButton).click(); } clickThreeDotMenuButtonOnAvailableMediaLine() { @@ -216,9 +210,7 @@ class MediaShelf { } clickThreeDotMenuButtonOnFirstMediaLine() { - cy.get(MediaShelf.#mediaLine1) - .find(MediaShelf.#threeDotMenuInMediaLine) - .click(); + cy.get(MediaShelf.#mediaLine1).find(MediaShelf.#threeDotMenuInMediaLine).click(); } clickEditTitleButton() { @@ -226,15 +218,15 @@ class MediaShelf { } editTitleOfFirstMediaLine(title) { - const line = cy.get(MediaShelf.#mediaLine1) + const line = cy.get(MediaShelf.#mediaLine1); line.find(MediaShelf.#lineTitle) - .type('{selectAll}{backspace}') + .type("{selectAll}{backspace}") .type(title) - .type('{esc}'); + .type("{esc}"); } clickOnFirstMediaLineTitle() { - const line = cy.get(MediaShelf.#mediaLine1) + const line = cy.get(MediaShelf.#mediaLine1); line.find(MediaShelf.#lineTitle).dblclick(); } @@ -263,94 +255,113 @@ class MediaShelf { clickThreeDotMenuButtonOnMediaElement(toolName) { cy.get('[data-testid="media-element-' + toolName + '"]') .find(MediaShelf.#threeDotMenuOnMediaElement) - .click() + .click(); } clickDeleteMediaElementButton() { - cy.get(MediaShelf.#deleteMediaElementButton) - .click() - } - - seeDeleteMediaDialog() { - cy.get(MediaShelf.#deleteMediaElementDialog) - .should("exist") - } - - clickConfirmDeleteDialog() { - cy.get(MediaShelf.#confirmDeletionDialogButton) - .click() + cy.get(MediaShelf.#deleteMediaElementButton).click(); } moveToolInGhostMediaLine(toolName) { - cy.get('[data-testid="media-element-' + toolName + '"]').drag(MediaShelf.#ghostLineSpace); + cy.get('[data-testid="media-element-' + toolName + '"]').drag( + MediaShelf.#ghostLineSpace + ); } moveToolInEmptyFirstMediaLine(toolName) { - cy.get('[data-testid="media-element-' + toolName + '"]').drag(MediaShelf.#mediaLineSpace1); + cy.get('[data-testid="media-element-' + toolName + '"]').drag( + MediaShelf.#mediaLineSpace1 + ); } moveToolInFirstMediaLine(toolName) { - const options = { target: {x: 0 , y: 0}, source: { position: "right" }, force: true } - cy.get('[data-testid="media-element-' + toolName + '"]').drag(MediaShelf.#mediaLineSpace1, options); + const options = { + target: { x: 0, y: 0 }, + source: { position: "right" }, + force: true, + }; + cy.get('[data-testid="media-element-' + toolName + '"]').drag( + MediaShelf.#mediaLineSpace1, + options + ); } moveToolInAvailableMediaLine(toolName) { - const options = { target: {x: 0 , y: 0}, source: { position: "right" }, force: true } - cy.get('[data-testid="media-element-' + toolName + '"]').drag(MediaShelf.#availableMediaLineSpace, options); + const options = { + target: { x: 0, y: 0 }, + source: { position: "right" }, + force: true, + }; + cy.get('[data-testid="media-element-' + toolName + '"]').drag( + MediaShelf.#availableMediaLineSpace, + options + ); } moveToolInEmptyAvailableMediaLine(toolName) { - cy.get('[data-testid="media-element-' + toolName + '"]').drag(MediaShelf.#availableMediaLineSpace); + cy.get('[data-testid="media-element-' + toolName + '"]').drag( + MediaShelf.#availableMediaLineSpace + ); } moveToolNextToTool(toolNameSource, toolNameTarget) { - const options = { target: {x: 0 , y: 0}, source: { position: "right" }, force: true } - cy.get('[data-testid="media-element-' + toolNameSource + '"]') - .drag('[data-testid="media-element-' + toolNameTarget + '"]', options) + const options = { + target: { x: 0, y: 0 }, + source: { position: "right" }, + force: true, + }; + cy.get('[data-testid="media-element-' + toolNameSource + '"]').drag( + '[data-testid="media-element-' + toolNameTarget + '"]', + options + ); } mediaElementIsVisibleInFirstMediaLine(toolName) { - const line = cy.get(MediaShelf.#mediaLineSpace1) - line.find('[data-testid="media-element-' + toolName + '"]').should("exist") + const line = cy.get(MediaShelf.#mediaLineSpace1); + line.find('[data-testid="media-element-' + toolName + '"]').should("exist"); } launchToolInAvailableMediaLine(toolName, toolURL) { - const launchedTool = { toolName: toolName, isLaunched: false }; + const launchedTool = { toolName: toolName, isLaunched: false }; cy.window().then((win) => { - cy.stub(win, "open").as("openStub").callsFake((url) => { - expect(url).to.contain(toolURL); - launchedTool.isLaunched = true; - }); + cy.stub(win, "open") + .as("openStub") + .callsFake((url) => { + expect(url).to.contain(toolURL); + launchedTool.isLaunched = true; + }); }); cy.wrap(launchedTool).as("launchedTool"); - const line = cy.get(MediaShelf.#availableMediaLineSpace) - line.find('[data-testid="media-element-' + toolName + '"]').click() + const line = cy.get(MediaShelf.#availableMediaLineSpace); + line.find('[data-testid="media-element-' + toolName + '"]').click(); - cy.get("@openStub").invoke("restore") + cy.get("@openStub").invoke("restore"); } launchToolInFirstMediaLine(toolName, toolURL) { - const launchedTool = { toolName: toolName, isLaunched: false }; + const launchedTool = { toolName: toolName, isLaunched: false }; cy.window().then((win) => { - cy.stub(win, "open").as("openStub").callsFake((url) => { - expect(url).to.contain(toolURL); - launchedTool.isLaunched = true; - }); + cy.stub(win, "open") + .as("openStub") + .callsFake((url) => { + expect(url).to.contain(toolURL); + launchedTool.isLaunched = true; + }); }); cy.wrap(launchedTool).as("launchedTool"); - const line = cy.get(MediaShelf.#mediaLineSpace1) - line.find('[data-testid="media-element-' + toolName + '"]').click() + const line = cy.get(MediaShelf.#mediaLineSpace1); + line.find('[data-testid="media-element-' + toolName + '"]').click(); - cy.get("@openStub").invoke("restore") + cy.get("@openStub").invoke("restore"); } - toolWasLaunched(toolName){ + toolWasLaunched(toolName) { cy.get("@launchedTool").then((launchedTool) => { expect(launchedTool.toolName).to.equal(toolName); expect(launchedTool.isLaunched).to.be.true; @@ -360,7 +371,7 @@ class MediaShelf { } clickToolInFirstMediaLine(toolName) { - const line = cy.get(MediaShelf.#mediaLineSpace1) + const line = cy.get(MediaShelf.#mediaLineSpace1); line.find('[data-testid="media-element-' + toolName + '"]').click(); } diff --git a/cypress/support/step_definition/mediashelf/commonMediaShelfSteps.spec.js b/cypress/support/step_definition/mediashelf/commonMediaShelfSteps.spec.js index af8deb05..a6fe386e 100644 --- a/cypress/support/step_definition/mediashelf/commonMediaShelfSteps.spec.js +++ b/cypress/support/step_definition/mediashelf/commonMediaShelfSteps.spec.js @@ -1,7 +1,7 @@ import MediaShelf from "../../pages/mediashelf/pageMediaShelf"; import { Then, When } from "@badeball/cypress-cucumber-preprocessor"; -const mediaShelf = new MediaShelf() +const mediaShelf = new MediaShelf(); When("I go to media shelf", () => { mediaShelf.navigateToMediaShelf(); @@ -20,48 +20,48 @@ When("I click on three dot menu button on available media line", () => { }); When("I select the background color", () => { - mediaShelf.selectLineColor() -}) + mediaShelf.selectLineColor(); +}); When("I click on grid layout button", () => { - mediaShelf.clickGridLayoutButton() -}) + mediaShelf.clickGridLayoutButton(); +}); When("I click on list layout button", () => { - mediaShelf.clickListLayoutButton() -}) + mediaShelf.clickListLayoutButton(); +}); When("I click add media line button", () => { - mediaShelf.clickAddMediaLineButton() -}) + mediaShelf.clickAddMediaLineButton(); +}); When("I click the three dot menu button on the first media line", () => { - mediaShelf.clickThreeDotMenuButtonOnFirstMediaLine() -}) + mediaShelf.clickThreeDotMenuButtonOnFirstMediaLine(); +}); When("I click on edit title button", () => { - mediaShelf.clickEditTitleButton() -}) + mediaShelf.clickEditTitleButton(); +}); When("I click the collapse button on the first media line", () => { - mediaShelf.clickCollapseButtonOnFirstMediaLine() -}) + mediaShelf.clickCollapseButtonOnFirstMediaLine(); +}); When("I click on color picker button", () => { - mediaShelf.clickColorPickerButton() -}) + mediaShelf.clickColorPickerButton(); +}); When("I edit the title of the first median line to {string}", (title) => { - mediaShelf.editTitleOfFirstMediaLine(title) -}) + mediaShelf.editTitleOfFirstMediaLine(title); +}); When("I double click on the title of the first median line", () => { - mediaShelf.clickOnFirstMediaLineTitle() -}) + mediaShelf.clickOnFirstMediaLineTitle(); +}); When("I click on media element {string}", (toolName) => { - mediaShelf.clickMediaElement(toolName) -}) + mediaShelf.clickMediaElement(toolName); +}); Then("I see the media shelf page title", () => { mediaShelf.seeMediaShelfPageTitle(); @@ -135,11 +135,14 @@ Then("I see {int} tools in the first media line", (count) => { mediaShelf.seeNumberOfMediaInFirstMediaLine(count); }); -Then("I see the thumbnail, title and description of media element {string}", (toolName) => { - mediaShelf.seeMediaElementDefaultThumbnail(toolName); - mediaShelf.seeMediaElementTitle(toolName); - mediaShelf.seeMediaElementDescription(toolName); -}); +Then( + "I see the thumbnail, title and description of media element {string}", + (toolName) => { + mediaShelf.seeMediaElementDefaultThumbnail(toolName); + mediaShelf.seeMediaElementTitle(toolName); + mediaShelf.seeMediaElementDescription(toolName); + } +); Then("I see the deactivated chip on media element {string}", (toolName) => { mediaShelf.seeMediaElementDeactivatedChip(toolName); @@ -154,7 +157,7 @@ Then("I see the incomplete chip on media element {string}", (toolName) => { }); Then("I see the no longer available chip on media element {string}", (toolName) => { - mediaShelf.seeMediaElementNoLongerAvailableChip(toolName) + mediaShelf.seeMediaElementNoLongerAvailableChip(toolName); }); Then("I see tool {string} in the available media line", (toolName) => { @@ -166,19 +169,11 @@ Then("I do not see tool {string} in the available media line", (toolName) => { }); When("I click the three dot menu button on media element {string}", (toolName) => { - mediaShelf.clickThreeDotMenuButtonOnMediaElement(toolName) + mediaShelf.clickThreeDotMenuButtonOnMediaElement(toolName); }); When("I click on delete media element button", () => { - mediaShelf.clickDeleteMediaElementButton() -}); - -Then("I see delete media element dialog", () => { - mediaShelf.seeDeleteMediaDialog() -}); - -When("I click confirm delete media element button", () => { - mediaShelf.clickConfirmDeleteDialog() + mediaShelf.clickDeleteMediaElementButton(); }); When("I move tool {string} in to ghost media line", (toolName) => { @@ -213,13 +208,19 @@ When("I select default line color", () => { mediaShelf.selectLineColorWhite(); }); -When("I launch tool {string} in the available media line with given url {string}", (toolName, url) => { - mediaShelf.launchToolInAvailableMediaLine(toolName, url); -}); +When( + "I launch tool {string} in the available media line with given url {string}", + (toolName, url) => { + mediaShelf.launchToolInAvailableMediaLine(toolName, url); + } +); -When("I launch tool {string} in the first media line with given url {string}", (toolName, url) => { - mediaShelf.launchToolInFirstMediaLine(toolName, url); -}); +When( + "I launch tool {string} in the first media line with given url {string}", + (toolName, url) => { + mediaShelf.launchToolInFirstMediaLine(toolName, url); + } +); Then("I see tool {string} on media element was launched", (toolName) => { mediaShelf.toolWasLaunched(toolName); @@ -231,4 +232,4 @@ When("I try to launch tool {string} in the first media line", (toolName) => { Then("I see the no available media infotext", () => { mediaShelf.seeNoAvailableMediaInfoText(); -}); \ No newline at end of file +});