diff --git a/cypress/e2e/room_board/createEditDeleteMultiAndSingleColumnBoardInRoom.feature b/cypress/e2e/room_board/createEditDeleteMultiAndSingleColumnBoardInRoom.feature new file mode 100644 index 00000000..a29a33ce --- /dev/null +++ b/cypress/e2e/room_board/createEditDeleteMultiAndSingleColumnBoardInRoom.feature @@ -0,0 +1,92 @@ +@regression_test +@stable_test +Feature: Room - Add, edit and delete board in room + + As a teacher I want to add, edit and delete board in the room. + + Scenario: Teacher add, edit, and delete board in the room, including pre-conditions + Given I am logged in as a '' at '' + + # pre-condition: teacher creating a new room + When I go to room overview + When I click on FAB to create new room + Then I see room creation page + When I enter the room name '' + When I click on the button to save the room + Then I see the detail page of room '' + + # teacher creates a new multi column board in the room + Given I am logged in as a '' at '' + When I go to room overview + When I go to room '' + When I click on the button add content + Then I see the button to add board + When I click on the fab button to add a Board + Then I see the dialog box to select the Board type + When I click on button to add multi column board + Then I see the page board details + + # teacher edits title of the new multi column board + When I click on the three dot menu in room board + When I click on edit in board menu + Then I change the room board title to '' + When I click on the page outside of the title of the board + Then I see my room board is named '' + + # cancel delete-process of the new multi column board + When I click on the three dot menu in room board + When I click on delete in board menu + Then I see the button to cancel the dialog + When I click on the button to cancel the deletion + Then I see the page board details + Then I see the board '' on the room overview page + + # confirm delete-process of the new multi column board + When I click on the three dot menu in room board + When I click on delete in board menu + Then I see the button to confirm the dialog + Then I click on the button to confirm the deletion + Then I do not see the board '' in the room + + # teacher creates a new single column board in the room + Given I am logged in as a '' at '' + When I go to room overview + When I go to room '' + When I click on the button add content + Then I see the button to add board + When I click on the fab button to add a Board + Then I see the dialog box to select the Board type + When I click on button to add single column board + Then I see the page board details + + # teacher edits title of the new single column board + When I click on the three dot menu in room board + When I click on edit in board menu + Then I change the room board title to '' + When I click on the page outside of the title of the board + Then I see my room board is named '' + + # confirm delete-process of single column board + When I click on the three dot menu in room board + When I click on delete in board menu + Then I see the button to confirm the dialog + Then I click on the button to confirm the deletion + Then I do not see the page board details + + # post-condition: teacher deletes room + When I click on three dot menu in room page + When I click on delete option in room menu + Then I see confirmation modal for deleting the room + When I click on delete button in confirmation modal + Then I do not see '' on room overview page + + + @school_api_test + Examples: + | teacher | namespace | room_name | board_name | edited_board_title | + | teacher1_brb | brb | Cypress Room Name | Cypress Board Name | Board Cy Title | + + @staging_test + Examples: + | teacher | namespace | room_name | board_name | edited_board_title | + | teacher1_brb | brb | Cypress Room Name | Cypress Board Name | Board Cy Title | diff --git a/cypress/support/pages/room/pageRooms.js b/cypress/support/pages/room/pageRooms.js index 628951a2..c5ea82b2 100644 --- a/cypress/support/pages/room/pageRooms.js +++ b/cypress/support/pages/room/pageRooms.js @@ -10,6 +10,8 @@ class Rooms { static #roomDetailFABEdit = '[data-testid="room-action-edit"]'; static #roomDetailFABParticipants = '[data-testid="room-action-manage-participants"]'; static #roomDetailFABDelete = '[data-testid="room-action-delete"]'; + static #addContentButton = '[data-testid="add-content-button"]'; + static #fabButtonAddBoard = '[data-testid="fab_button_add_board"]'; static #confirmDeletionModalTitle = '[data-testid="delete-dialog-item"]'; static #confirmDeletionModalDelete = '[data-testid="dialog-confirm"]'; static #addParticipantsModal = '[data-testid="dialog-add-participants"]'; @@ -26,6 +28,8 @@ class Rooms { static #inputSatrtdateForRoom = '[data-testid="room-start-date-input"]'; static #inputEndtdateForRoom = '[data-testid="room-end-date-input"]'; + + selectEndDateForRoom() { const currentDate = new Date(); //set the date which is two days later than the current day @@ -168,5 +172,16 @@ class Rooms { notSeeParticipantInList(participantName) { cy.get(Rooms.#participantTable).should("not.contain", participantName); } + clickOnAddContentButton() { + cy.get(Rooms.#addContentButton).click(); + } + seeFabButtonToAddBoard() { + cy.get(Rooms.#fabButtonAddBoard).should("be.visible"); + } + clickOnFabButtonToAddBoard() { + cy.get(Rooms.#fabButtonAddBoard).click(); + } + + } export default Rooms; diff --git a/cypress/support/pages/room_board/pageRoomBoards.js b/cypress/support/pages/room_board/pageRoomBoards.js new file mode 100644 index 00000000..2c14dd3d --- /dev/null +++ b/cypress/support/pages/room_board/pageRoomBoards.js @@ -0,0 +1,81 @@ +"use strict"; + +class RoomBoards { + static #btnDialogCancel = '[data-testid="dialog-cancel"]'; + static #btnDialogConfirm = '[data-testid="dialog-confirm"]'; + static #boardMenuActionDelete = '[data-testid="board-menu-action-delete"]'; + static #mainPageArea = '[id="main-content"]'; + static #roomBoardTitleOnPage = '[data-testid="board-title"]'; + static #boardMenuIcon = '[data-testid="board-menu-icon"]'; + static #btnBoardMenuActionEdit = '[data-testid="board-menu-action-edit"]'; + static #dialogAddMultiColumnBoard = '[data-testid="dialog-add-multi-column-board"]'; + static #dialogAddSingleColumnBoard = '[data-testid="dialog-add-single-column-board"]'; + static #boardLayoutDialogTitle = '[data-testid="board-layout-dialog-title"]'; + + clearAndType(selector, newTitle) { + cy.get(selector) + .first() + .then((element) => { + const currentTitle = element.val(); + if (currentTitle) { + cy.wrap(element).type("{backspace}".repeat(currentTitle.length)); + } + cy.wrap(element).type(newTitle); + }); + } + seeColumnBoardDialogBox() { + cy.get(RoomBoards.#boardLayoutDialogTitle).should("be.visible"); + } + clickOnButtonToAddMultiColumnBoard() { + cy.get(RoomBoards.#dialogAddMultiColumnBoard).click(); + } + clickOnButtonToAddSingleColumnBoard() { + cy.get(RoomBoards.#dialogAddSingleColumnBoard).click(); + } + seeNewRoomBoardCreatePage() { + cy.url().should("include", "/board"); + } + doNotSeeNewRoomBoardCreatePage() { + cy.url().should("not.include", "/board"); + } + enterRoomBoardTitle(boardTitle) { + cy.get(RoomBoards.#roomBoardTitleOnPage).within(() => { + this.clearAndType("input", boardTitle); + }); + } + seeGivenRoomBoardTitle(boardTitle) { + cy.get(RoomBoards.#roomBoardTitleOnPage).find('input').should('have.value', boardTitle); + } + clickOutsideTheTitleToSaveTheModifiedTitle() { + cy.get(RoomBoards.#mainPageArea).click("bottom"); + } + clickOnDeleteInBoardMenu() { + cy.get(RoomBoards.#boardMenuActionDelete).click(); + } + seeBoardOnRoomDetailPage(boardName) { + cy.contains(boardName).should("exist"); + } + doNotSeeBoardOnRoomDetailPage(boardName) { + cy.contains(boardName).should("not.exist"); + } + seeBtnDialogCancel() { + cy.get(RoomBoards.#btnDialogCancel).should("be.visible"); + } + clickOnBtnDialogCancel() { + cy.get(RoomBoards.#btnDialogCancel).click(); + } + seeBtnDialogConfirmDelete() { + cy.get(RoomBoards.#btnDialogConfirm).should("be.visible"); + } + clickBtnDialogConfirmDelete() { + cy.get(RoomBoards.#btnDialogConfirm).click(); + } + clickOnThreeDotMenuInRoomBoardTitle() { + cy.get(RoomBoards.#boardMenuIcon).click(); + } + clickOnEditInBoardMenu() { + cy.get(RoomBoards.#btnBoardMenuActionEdit).click(); + } +} + +export default RoomBoards; \ No newline at end of file diff --git a/cypress/support/step_definition/course_board/createEditDeleteMultiColumnInBoardSteps.spec.js b/cypress/support/step_definition/course_board/createEditDeleteMultiColumnInBoardSteps.spec.js index e29d10c0..e6a42567 100644 --- a/cypress/support/step_definition/course_board/createEditDeleteMultiColumnInBoardSteps.spec.js +++ b/cypress/support/step_definition/course_board/createEditDeleteMultiColumnInBoardSteps.spec.js @@ -11,7 +11,6 @@ Then("I see the page Course Board details", () => { board.seeNewCourseBoardCreatePage(); }); - When("I click on the option Edit in three dot menu in course board", () => { board.clickOnEditInThreeDotCourseBoardTitle(); }); diff --git a/cypress/support/step_definition/room/roomSteps.spec.js b/cypress/support/step_definition/room/roomSteps.spec.js index ed3c0c18..896aea38 100644 --- a/cypress/support/step_definition/room/roomSteps.spec.js +++ b/cypress/support/step_definition/room/roomSteps.spec.js @@ -1,7 +1,9 @@ const { When, Then } = require("@badeball/cypress-cucumber-preprocessor"); import Rooms from "../../pages/room/pageRooms"; +import RoomBoards from "../../pages/room_board/pageRoomBoards"; const rooms = new Rooms(); +const roomBoards = new RoomBoards(); When("I select the colour for the room", () => { rooms.selectRoomColour(); @@ -127,3 +129,17 @@ Then( rooms.notSeeParticipantInList(participantName); } ); + +When("I click on the button add content", () => { + rooms.clickOnAddContentButton(); +}); + +Then("I see the button to add board", () => { + rooms.seeFabButtonToAddBoard(); +}); + +When ("I click on the fab button to add a Board", () => { + rooms.clickOnFabButtonToAddBoard(); +}); + + diff --git a/cypress/support/step_definition/room_boards/roomBoardSteps.spec.js b/cypress/support/step_definition/room_boards/roomBoardSteps.spec.js new file mode 100644 index 00000000..582ee490 --- /dev/null +++ b/cypress/support/step_definition/room_boards/roomBoardSteps.spec.js @@ -0,0 +1,65 @@ +const { When, Then } = require("@badeball/cypress-cucumber-preprocessor"); +import RoomBoards from "../../pages/room_board/pageRoomBoards"; + +const roomBoards = new RoomBoards(); + +Then("I see the dialog box to select the Board type", () => { + roomBoards.seeColumnBoardDialogBox(); +}); + +When("I click on button to add multi column board", () => { + roomBoards.clickOnButtonToAddMultiColumnBoard(); +}); + +When("I click on button to add single column board", () => { + roomBoards.clickOnButtonToAddSingleColumnBoard(); +}); + +Then("I see the page board details", () => { + roomBoards.seeNewRoomBoardCreatePage(); +}); + +Then("I do not see the page board details", () => { + roomBoards.doNotSeeNewRoomBoardCreatePage(); +}); + +When("I click on the three dot menu in room board", () => { + roomBoards.clickOnThreeDotMenuInRoomBoardTitle(); +}); + +When("I click on edit in board menu", () => { + roomBoards.clickOnEditInBoardMenu(); +}); + +Then("I change the room board title to {string}", (boardTitle) => { + roomBoards.enterRoomBoardTitle(boardTitle); +}); + +When("I click on the page outside of the title of the board", () => { + roomBoards.clickOutsideTheTitleToSaveTheModifiedTitle(); +}); +Then("I see my room board is named {string}", (boardTitle) => { + roomBoards.seeGivenRoomBoardTitle(boardTitle); +}); +When("I click on delete in board menu", () => { + roomBoards.clickOnDeleteInBoardMenu(); +}); +Then("I see the button to cancel the dialog", () => { + roomBoards.seeBtnDialogCancel(); +}); +When("I click on the button to cancel the deletion", () => { + roomBoards.clickOnBtnDialogCancel(); +}); +Then("I see the board {string} on the room overview page", (boardTitle) => { + roomBoards.seeBoardOnRoomDetailPage(boardTitle); +}); +Then("I see the button to confirm the dialog", () => { + roomBoards.seeBtnDialogConfirmDelete(); +}); +When("I click on the button to confirm the deletion", () => { + roomBoards.clickBtnDialogConfirmDelete(); +}); +Then("I do not see the board {string} in the room", (boardTitle) => { + roomBoards.doNotSeeBoardOnRoomDetailPage(boardTitle); +}); +