From 07b91b291d37d70bfd959e95241e6a5827f18e42 Mon Sep 17 00:00:00 2001 From: Gordon Nicholas Date: Mon, 2 Dec 2024 14:38:02 +0100 Subject: [PATCH 1/4] N21-1506 add tests for course share --- .../e2e/course/shareCourseSameSchool.feature | 178 ++++++++++++++++++ cypress/support/pages/course/pageCourses.js | 5 + .../pages/course/pageImportCourseModal.js | 33 ++++ .../pages/course/pageShareCourseModal.js | 63 +++++++ .../support/pages/course_board/pageBoard.js | 6 +- .../course/shareCourseSteps.spec.js | 64 +++++++ 6 files changed, 348 insertions(+), 1 deletion(-) create mode 100644 cypress/e2e/course/shareCourseSameSchool.feature create mode 100644 cypress/support/pages/course/pageImportCourseModal.js create mode 100644 cypress/support/pages/course/pageShareCourseModal.js create mode 100644 cypress/support/step_definition/course/shareCourseSteps.spec.js diff --git a/cypress/e2e/course/shareCourseSameSchool.feature b/cypress/e2e/course/shareCourseSameSchool.feature new file mode 100644 index 000000000..b9ab37aef --- /dev/null +++ b/cypress/e2e/course/shareCourseSameSchool.feature @@ -0,0 +1,178 @@ +@unstable_test +Feature: Teacher can share a course + + As a teacher I want to share a course with other teachers from the same school + + @unstable_test + Scenario: Pre-Condition: Admin adds external tools to school and teacher sets up a course with ctl tools + Given I am logged in as a 'admin1_nbc' at 'nbc' + When I click on administration in menu + When I navigate to new school admin page via sub menu + When I click on general settings panel + When I click the toggle switch to enable student visibility for teachers + When I click on button Save admin settings + When I click on external tools panel + When I click the add external tool button + When I select the tool 'CY Test Tool Context Scope' from available tools + When I click on save external tool button + When I click the add external tool button + When I select the tool 'CY Test Tool Optional Protected Parameter' from available tools + When I click on save external tool button + When I click the add external tool button + When I select the tool 'CY Test Tool Protected Parameter' from available tools + When I click on save external tool button + Then I see the tool 'CY Test Tool Context Scope' in external tools table + Then I see the tool 'CY Test Tool Optional Protected Parameter' in external tools table + Then I see the tool 'CY Test Tool Protected Parameter' in external tools table + + # Teacher creates a course and adds tools to the course + Given I am logged in as a 'teacher1_nbc' at 'nbc' + When I go to courses overview + When I click on FAB to create a new course depending on sub menu + When I enter the course title 'Cypress Test Course Share' + Then I see teacher 'Karl Herzog' is selected by default + When I click on button Next Steps after entering the course detail in section one + When I click on button Next Steps after selecting course participant details + Then I see the section three area as the finish page + When I click on button To Course Overview on the finish page + Then I see the course 'Cypress Test Course Share' on the course overview page + When I go to course 'Cypress Test Course Share' + Then I see course page 'Cypress Test Course Share' + When I click on the tools tab + Then I see the button to add a tool + # Teacher adds a tool with required parameter + When I click on the button to add a tool + Then I see the tool configuration page title + When I click on the tool configuration selection + When I select the tool 'CY Test Tool Context Scope' from available tools + When I enter 'test' in required custom parameter field 'searchparam' + When I click on save external tool button + Then I see the tool 'CY Test Tool Context Scope' in the tool overview + # Teacher adds a tool with optional protected parameter + When I click on the button to add a tool + Then I see the tool configuration page title + When I click on the tool configuration selection + When I select the tool 'CY Test Tool Optional Protected Parameter' from available tools + When I enter 'test' in required custom parameter field 'search' + When I enter 'protected' in optional custom parameter field 'protected' + When I click on save external tool button + Then I see the tool 'CY Test Tool Optional Protected Parameter' in the tool overview + # Teacher adds a tool with required protected parameter + When I click on the button to add a tool + Then I see the tool configuration page title + When I click on the tool configuration selection + When I select the tool 'CY Test Tool Protected Parameter' from available tools + When I enter 'test' in required custom parameter field 'search' + When I select 'Ja' in required protected custom parameter selection + When I click on save external tool button + Then I see the tool 'CY Test Tool Protected Parameter' in the tool overview + + # Teacher creates a board and adds tools + When I go to the tab contents in course detail page + When I click on FAB to create new content + When I click on the button FAB New Column Board + Then I see a dialog box for column board + Then I see in dialog box option for multi-column board + Then I see in dialog box option for single column board + When I choose multi-column board in the dialog box + Then I see the page Course Board details + Then I see the chip Draft in the course board + When I click on the button Add column in the course board + When I click on the page outside of the column + # Teacher adds a tool with required parameter + When I click on plus icon to add card in column + When I click on plus icon to add content into card + When I select external tools from the menu + When I click on the tool configuration selection + When I select the tool 'CY Test Tool Context Scope' from available tools + When I enter 'test' in required custom parameter field 'searchparam' + When I click on save external tool button + Then I see an external tool element with tool 'CY Test Tool Context Scope' + # Teacher adds a tool with optional protected parameter + When I click on three dot menu in the card + When I select the option Edit in three dot menu on the card + When I click on plus icon to add content into card + When I select external tools from the menu + When I click on the tool configuration selection + When I select the tool 'CY Test Tool Optional Protected Parameter' from available tools + When I enter 'test' in required custom parameter field 'search' + When I enter 'protected' in optional custom parameter field 'protected' + When I click on save external tool button + Then I see an external tool element with tool 'CY Test Tool Optional Protected Parameter' + # Teacher adds a tool with required parameter + When I click on three dot menu in the card + When I select the option Edit in three dot menu on the card + When I click on plus icon to add content into card + When I select external tools from the menu + When I click on the tool configuration selection + When I select the tool 'CY Test Tool Protected Parameter' from available tools + When I enter 'test' in required custom parameter field 'search' + When I select 'Ja' in required protected custom parameter selection + When I click on save external tool button + Then I see an external tool element with tool 'CY Test Tool Protected Parameter' + + @unstable_test + Scenario: Teacher shares the course with another teacher in the same school + Given I am logged in as a 'teacher1_nbc' at 'nbc' + When I go to courses overview + When I go to course 'Cypress Test Course Share' + Then I see course page 'Cypress Test Course Share' + When I click on share course button + Then I see the share course dialog box + Then I see the info text in the share course dialog + Then I see the school internal checkbox as checked + Then I see the expiry date checkbox as checked + When I click on the continue button + Then I see the import share course url + When I save the import share course url + # Switch teacher to import shared course + Given I am logged in as a 'teacher2_nbc' at 'nbc' + When I go to courses overview + When I visit the saved import url of the shared course + Then I see the import share course tools info + When I enter 'Cypress Test Course Import' in the course name field + When I click on the import course button + When I go to courses overview + When I go to course 'Cypress Test Course Import' + Then I see course page 'Cypress Test Course Import' + + When I click on the tools tab + Then I see the tool 'CY Test Tool Context Scope' in the tool overview + Then I see the tool 'CY Test Tool Optional Protected Parameter' in the tool overview + Then I see the tool 'CY Test Tool Optional Protected Parameter' is marked as incomplete operational + Then I see the tool 'CY Test Tool Protected Parameter' in the tool overview + Then I see the tool 'CY Test Tool Protected Parameter' is marked as incomplete + + When I go to the tab contents in course detail page + When I click on card Course Board + Then I see an external tool element with tool 'CY Test Tool Context Scope' + Then I see an external tool element with tool 'CY Test Tool Optional Protected Parameter' + Then I see external tool element with tool 'CY Test Tool Optional Protected Parameter' is marked as incomplete operational + Then I see an external tool element with tool 'CY Test Tool Protected Parameter' + Then I see external tool element with tool 'CY Test Tool Protected Parameter' is marked as incomplete + + @unstable_test + Scenario: Post-Condition: Admin deletes courses and external tools + Given I am logged in as a 'admin1_nbc' at 'nbc' + When I click on administration in menu + When I go to course administration page + When I click the delete button for course 'Cypress Test Course Share' in course table + Then I see the delete modal + When I click the confirmation button on the delete modal + When I click the delete button for course 'Cypress Test Course Import' in course table + Then I see the delete modal + When I click the confirmation button on the delete modal + Then I do not see course 'Cypress Test Course Share' in course table + Then I do not see course 'Cypress Test Course Import' in course table + + # Admin deletes external tools + When I click on administration in menu + When I navigate to new school admin page via sub menu + When I click on external tools panel + Then I see the external tools table + When I click on delete button of tool 'CY Test Tool Context Scope' + When I confirm deletion on deletion dialog + When I click on delete button of tool 'CY Test Tool Optional Protected Parameter' + When I confirm deletion on deletion dialog + When I click on delete button of tool 'CY Test Tool Protected Parameter' + When I confirm deletion on deletion dialog diff --git a/cypress/support/pages/course/pageCourses.js b/cypress/support/pages/course/pageCourses.js index 3175e1092..f0f08d334 100644 --- a/cypress/support/pages/course/pageCourses.js +++ b/cypress/support/pages/course/pageCourses.js @@ -144,6 +144,7 @@ class Courses { static #delteDialogTitle = '[data-testid="dialog-title"]'; static #delteDialogContent = '[data-testid="delete-dialog-content"]'; static #confirmDeleteDialogButton = '[data-testid="dialog-confirm"]'; + static #btnShareCourse = '[data-testid="room-menu-share"]'; selectTeacherFromTeacherField(userName) { cy.get(Courses.#teacherFieldContainer).click(); @@ -1192,5 +1193,9 @@ class Courses { cy.wrap({ toolName: "", isLaunched: false }).as("launchedTool"); } + clickShareCourseButton() { + cy.get(Courses.#dropDownCourse).parent().click(); + cy.get(Courses.#btnShareCourse).click(); + } } export default Courses; diff --git a/cypress/support/pages/course/pageImportCourseModal.js b/cypress/support/pages/course/pageImportCourseModal.js new file mode 100644 index 000000000..a26f1bf9e --- /dev/null +++ b/cypress/support/pages/course/pageImportCourseModal.js @@ -0,0 +1,33 @@ +"use strict" + +class ImportCourseModal { + + static #importShareCourseDialog = '[data-testid="import-modal"]' + static #importShareCourseToolsInfo = '[data-testid="import-modal-external-tools-info"]' + static #importShareCourseNameInput = '[data-testid="import-modal-name-input"]' + static #dialogConfirmButton = '[data-testid="dialog-confirm"]'; + + seeImportShareCourseDialogBox() { + cy.get(ImportCourseModal.#importShareCourseDialog).should("exist"); + } + + seeImportShareCourseToolsInfo() { + cy.get(ImportCourseModal.#importShareCourseToolsInfo).should("exist"); + } + + enterCourseNameForImportCourse(input) { + cy.get(ImportCourseModal.#importShareCourseNameInput).should("exist"); + cy.get(ImportCourseModal.#importShareCourseNameInput).clear(); + cy.get(ImportCourseModal.#importShareCourseNameInput).type(input); + } + + clickOnConfirmButtonInDialog() { + cy.get(ImportCourseModal.#dialogConfirmButton).click(); + } + + visitSavedShareCourseUrl() { + cy.visit(Cypress.env('importShareCourseUrl')); + } +} + +export default ImportCourseModal; diff --git a/cypress/support/pages/course/pageShareCourseModal.js b/cypress/support/pages/course/pageShareCourseModal.js new file mode 100644 index 000000000..5146068b6 --- /dev/null +++ b/cypress/support/pages/course/pageShareCourseModal.js @@ -0,0 +1,63 @@ +"use strict" + +class ShareCourseModal { + static #shareCourseDialog = '[data-testid="share-dialog"]' + static #shareCourseDialogInfoTextTitle = '[data-testid="share-options-info-text"]'; + static #shareCourseDialogInfoTextContainer = '[data-testid="share-options-table-header"]'; + static #shareCourseDialogPersonalDataInfo = '[data-testid="share-options-personal-data-text"]'; + static #shareCourseDialogExternalToolsInfo = '[data-testid="share-modal-external-tools-info"]'; + static #shareCourseDialogSchoolInternalCheckBox = '[data-testid="isSchoolInternal"]'; + static #shareCourseDialogExpiryDateCheckBox = '[data-testid="hasExpiryDate"]'; + static #shareCourseResultUrlTextBox = '[data-testid="share-course-result-url"]'; + static #dialogNextButton = '[data-testid="dialog-next"]'; + + seeShareCourseDialogBox() { + cy.get(ShareCourseModal.#shareCourseDialog).should("exist"); + } + + seeInfoTextInShareCourseDialog() { + cy.get(ShareCourseModal.#shareCourseDialogInfoTextTitle).should("exist"); + cy.get(ShareCourseModal.#shareCourseDialogInfoTextContainer).should("exist"); + cy.get(ShareCourseModal.#shareCourseDialogPersonalDataInfo).should("exist"); + cy.get(ShareCourseModal.#shareCourseDialogExternalToolsInfo).should("exist"); + } + + seeSchoolInternalCheckBoxAsChecked() { + cy.get(ShareCourseModal.#shareCourseDialogSchoolInternalCheckBox).should("exist"); + cy.get(ShareCourseModal.#shareCourseDialogSchoolInternalCheckBox) + .find('input[type="checkbox"]') + .should("be.checked"); + } + + seeExpiryDateCheckBoxAsChecked() { + cy.get(ShareCourseModal.#shareCourseDialogExpiryDateCheckBox).should("exist"); + cy.get(ShareCourseModal.#shareCourseDialogSchoolInternalCheckBox) + .find('input[type="checkbox"]') + .should("be.checked"); + } + + uncheckSchoolInternalCheckBoxInShareCourseDialog() { + cy.get(ShareCourseModal.#shareCourseDialogSchoolInternalCheckBox) + .find('input[type="checkbox"]') + .uncheck(); + } + + clickContinueButtonInDialog() { + cy.get(ShareCourseModal.#dialogNextButton).click(); + } + + seeCopyUrlInShareCourseResultDialog() { + cy.get(ShareCourseModal.#shareCourseResultUrlTextBox).should("exist"); + } + + saveTheUrlInShareCourseResultDialog() { + cy.get(ShareCourseModal.#shareCourseResultUrlTextBox) + .find(".v-field__input") + .invoke("attr", "value") + .then((value) => { + Cypress.env('importShareCourseUrl', value); + }); + } +} + +export default ShareCourseModal; diff --git a/cypress/support/pages/course_board/pageBoard.js b/cypress/support/pages/course_board/pageBoard.js index 72e13fbff..f6803c1c1 100644 --- a/cypress/support/pages/course_board/pageBoard.js +++ b/cypress/support/pages/course_board/pageBoard.js @@ -11,7 +11,7 @@ class Board { static #mainPageArea = '[id="main-content"]'; static #editOptionThreeDot = '[data-testid="board-menu-action-edit"]'; static #threeDotMenuInColumn = '[data-testid="column-menu-btn-0"]'; - static #threeDotMenuInCard = '[data-testid="card-menu-btn"]'; + static #threeDotMenuInCard = '[data-testid="card-menu-btn-0-0"]'; static #threeDotMenuOnDeletedElement = '[data-testid="deleted-element-menu-btn"]'; static #deleteOptionThreeDot = '[data-testid="board-menu-action-delete"]'; static #confirmButtonInModal = '[data-testid="dialog-confirm"]'; @@ -370,5 +370,9 @@ class Board { seeTextInTextFieldInCard(textContent){ cy.contains(textContent); } + + canSeeDeletedElement(name) { + cy.get(Board.#deletedElement).contains(name).should("be.visible"); + } } export default Board; diff --git a/cypress/support/step_definition/course/shareCourseSteps.spec.js b/cypress/support/step_definition/course/shareCourseSteps.spec.js new file mode 100644 index 000000000..0503067d4 --- /dev/null +++ b/cypress/support/step_definition/course/shareCourseSteps.spec.js @@ -0,0 +1,64 @@ +const { When, Then } = require("@badeball/cypress-cucumber-preprocessor"); +import Courses from "../../pages/course/pageCourses"; +import ShareCourseModal from "../../pages/course/pageShareCourseModal" +import ImportCourseModal from "../../pages/course/pageImportCourseModal" + +const courses = new Courses(); +const shareCourseModal = new ShareCourseModal(); +const importCourseModal = new ImportCourseModal(); + +When("I click on share course button", () => { + courses.clickShareCourseButton(); +}); + +Then("I see the share course dialog box", () => { + shareCourseModal.seeShareCourseDialogBox(); +}); + +Then("I see the info text in the share course dialog", () => { + shareCourseModal.seeInfoTextInShareCourseDialog(); +}); + +Then("I see the school internal checkbox as checked", () => { + shareCourseModal.seeSchoolInternalCheckBoxAsChecked(); +}); + +Then("I see the expiry date checkbox as checked", () => { + shareCourseModal.seeExpiryDateCheckBoxAsChecked(); +}); + +When("I uncheck the school internal checkbox", () => { + shareCourseModal.uncheckSchoolInternalCheckBoxInShareCourseDialog(); +}); + +When("I click on the continue button", () => { + shareCourseModal.clickContinueButtonInDialog(); +}); + +Then("I see the import share course url", () => { + shareCourseModal.seeCopyUrlInShareCourseResultDialog(); +}); + +When("I save the import share course url", () => { + shareCourseModal.saveTheUrlInShareCourseResultDialog(); +}); + +When("I visit the saved import url of the shared course", () => { + importCourseModal.visitSavedShareCourseUrl(); +}); + +Then("I see the import share course dialog", () => { + importCourseModal.seeImportShareCourseDialogBox(); +}); + +Then("I see the import share course tools info", () => { + importCourseModal.seeImportShareCourseToolsInfo(); +}); + +When("I enter {string} in the course name field", (importCourseName) => { + importCourseModal.enterCourseNameForImportCourse(importCourseName); +}); + +When("I click on the import course button", () => { + importCourseModal.clickOnConfirmButtonInDialog(); +}); From 1e90bf72b51660b9b3ad8f5f41a25ccc4fc9bb18 Mon Sep 17 00:00:00 2001 From: Gordon Nicholas Date: Mon, 2 Dec 2024 16:49:02 +0100 Subject: [PATCH 2/4] N21-1506 renamed feature test --- .../{shareCourseSameSchool.feature => shareCtlTools.feature} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename cypress/e2e/course/{shareCourseSameSchool.feature => shareCtlTools.feature} (100%) diff --git a/cypress/e2e/course/shareCourseSameSchool.feature b/cypress/e2e/course/shareCtlTools.feature similarity index 100% rename from cypress/e2e/course/shareCourseSameSchool.feature rename to cypress/e2e/course/shareCtlTools.feature From f364260d763881a87ffe630c10cca4ea144e5dee Mon Sep 17 00:00:00 2001 From: Gordon Nicholas Date: Thu, 5 Dec 2024 17:14:12 +0100 Subject: [PATCH 3/4] N21-1506 review changes --- cypress/e2e/course/shareCtlTools.feature | 47 +++++++++---------- .../pages/course/pageImportCourseModal.js | 35 +++++++++++--- .../pages/course/pageShareCourseModal.js | 38 +++++++++++---- .../support/pages/course_board/pageBoard.js | 2 +- .../course/shareCourseSteps.spec.js | 22 +++++++-- 5 files changed, 99 insertions(+), 45 deletions(-) diff --git a/cypress/e2e/course/shareCtlTools.feature b/cypress/e2e/course/shareCtlTools.feature index b9ab37aef..a409609ba 100644 --- a/cypress/e2e/course/shareCtlTools.feature +++ b/cypress/e2e/course/shareCtlTools.feature @@ -4,13 +4,10 @@ Feature: Teacher can share a course As a teacher I want to share a course with other teachers from the same school @unstable_test - Scenario: Pre-Condition: Admin adds external tools to school and teacher sets up a course with ctl tools + Scenario: Pre-condition: admin adds external tools to school and teacher sets up a course with ctl tools Given I am logged in as a 'admin1_nbc' at 'nbc' When I click on administration in menu When I navigate to new school admin page via sub menu - When I click on general settings panel - When I click the toggle switch to enable student visibility for teachers - When I click on button Save admin settings When I click on external tools panel When I click the add external tool button When I select the tool 'CY Test Tool Context Scope' from available tools @@ -25,7 +22,7 @@ Feature: Teacher can share a course Then I see the tool 'CY Test Tool Optional Protected Parameter' in external tools table Then I see the tool 'CY Test Tool Protected Parameter' in external tools table - # Teacher creates a course and adds tools to the course + # Pre-condition: teacher creates a course and adds tools to the course Given I am logged in as a 'teacher1_nbc' at 'nbc' When I go to courses overview When I click on FAB to create a new course depending on sub menu @@ -40,7 +37,7 @@ Feature: Teacher can share a course Then I see course page 'Cypress Test Course Share' When I click on the tools tab Then I see the button to add a tool - # Teacher adds a tool with required parameter + # Pre-condition: teacher adds a tool with required parameter When I click on the button to add a tool Then I see the tool configuration page title When I click on the tool configuration selection @@ -48,7 +45,7 @@ Feature: Teacher can share a course When I enter 'test' in required custom parameter field 'searchparam' When I click on save external tool button Then I see the tool 'CY Test Tool Context Scope' in the tool overview - # Teacher adds a tool with optional protected parameter + # Pre-condition: teacher adds a tool with optional protected parameter When I click on the button to add a tool Then I see the tool configuration page title When I click on the tool configuration selection @@ -57,7 +54,7 @@ Feature: Teacher can share a course When I enter 'protected' in optional custom parameter field 'protected' When I click on save external tool button Then I see the tool 'CY Test Tool Optional Protected Parameter' in the tool overview - # Teacher adds a tool with required protected parameter + # Pre-condition: teacher adds a tool with required protected parameter When I click on the button to add a tool Then I see the tool configuration page title When I click on the tool configuration selection @@ -67,7 +64,7 @@ Feature: Teacher can share a course When I click on save external tool button Then I see the tool 'CY Test Tool Protected Parameter' in the tool overview - # Teacher creates a board and adds tools + # Pre-condition: teacher creates a board and adds tools When I go to the tab contents in course detail page When I click on FAB to create new content When I click on the button FAB New Column Board @@ -79,7 +76,7 @@ Feature: Teacher can share a course Then I see the chip Draft in the course board When I click on the button Add column in the course board When I click on the page outside of the column - # Teacher adds a tool with required parameter + # Pre-condition: teacher adds a tool with required parameter When I click on plus icon to add card in column When I click on plus icon to add content into card When I select external tools from the menu @@ -88,7 +85,7 @@ Feature: Teacher can share a course When I enter 'test' in required custom parameter field 'searchparam' When I click on save external tool button Then I see an external tool element with tool 'CY Test Tool Context Scope' - # Teacher adds a tool with optional protected parameter + # Pre-condition: teacher adds a tool with optional protected parameter When I click on three dot menu in the card When I select the option Edit in three dot menu on the card When I click on plus icon to add content into card @@ -99,7 +96,7 @@ Feature: Teacher can share a course When I enter 'protected' in optional custom parameter field 'protected' When I click on save external tool button Then I see an external tool element with tool 'CY Test Tool Optional Protected Parameter' - # Teacher adds a tool with required parameter + # Pre-condition: teacher adds a tool with required parameter When I click on three dot menu in the card When I select the option Edit in three dot menu on the card When I click on plus icon to add content into card @@ -111,8 +108,7 @@ Feature: Teacher can share a course When I click on save external tool button Then I see an external tool element with tool 'CY Test Tool Protected Parameter' - @unstable_test - Scenario: Teacher shares the course with another teacher in the same school + # Teacher shares the course with another teacher in the same school Given I am logged in as a 'teacher1_nbc' at 'nbc' When I go to courses overview When I go to course 'Cypress Test Course Share' @@ -122,27 +118,31 @@ Feature: Teacher can share a course Then I see the info text in the share course dialog Then I see the school internal checkbox as checked Then I see the expiry date checkbox as checked - When I click on the continue button - Then I see the import share course url + When I click on the continue button in the share course dialog + Then I see the import share course url in the share course result dialog + Then I see the mail button in the share course result dialog + Then I see the copy link button in the share course result dialog + Then I see the mail QR-Code button in the share course result dialog When I save the import share course url - # Switch teacher to import shared course + # Switch teacher to import shared course Given I am logged in as a 'teacher2_nbc' at 'nbc' When I go to courses overview When I visit the saved import url of the shared course + Then I see the import share course dialog Then I see the import share course tools info + Then I see 'Cypress Test Course Share' in the course name field When I enter 'Cypress Test Course Import' in the course name field When I click on the import course button - When I go to courses overview When I go to course 'Cypress Test Course Import' Then I see course page 'Cypress Test Course Import' - + # Teacher sees marked tools in tools tab When I click on the tools tab Then I see the tool 'CY Test Tool Context Scope' in the tool overview Then I see the tool 'CY Test Tool Optional Protected Parameter' in the tool overview Then I see the tool 'CY Test Tool Optional Protected Parameter' is marked as incomplete operational Then I see the tool 'CY Test Tool Protected Parameter' in the tool overview Then I see the tool 'CY Test Tool Protected Parameter' is marked as incomplete - + # Teacher sees marked tools in board When I go to the tab contents in course detail page When I click on card Course Board Then I see an external tool element with tool 'CY Test Tool Context Scope' @@ -150,9 +150,7 @@ Feature: Teacher can share a course Then I see external tool element with tool 'CY Test Tool Optional Protected Parameter' is marked as incomplete operational Then I see an external tool element with tool 'CY Test Tool Protected Parameter' Then I see external tool element with tool 'CY Test Tool Protected Parameter' is marked as incomplete - - @unstable_test - Scenario: Post-Condition: Admin deletes courses and external tools + # Post-condition: admin deletes courses Given I am logged in as a 'admin1_nbc' at 'nbc' When I click on administration in menu When I go to course administration page @@ -164,8 +162,7 @@ Feature: Teacher can share a course When I click the confirmation button on the delete modal Then I do not see course 'Cypress Test Course Share' in course table Then I do not see course 'Cypress Test Course Import' in course table - - # Admin deletes external tools + # Post-condition: admin deletes external tools When I click on administration in menu When I navigate to new school admin page via sub menu When I click on external tools panel diff --git a/cypress/support/pages/course/pageImportCourseModal.js b/cypress/support/pages/course/pageImportCourseModal.js index a26f1bf9e..72051b70a 100644 --- a/cypress/support/pages/course/pageImportCourseModal.js +++ b/cypress/support/pages/course/pageImportCourseModal.js @@ -5,28 +5,49 @@ class ImportCourseModal { static #importShareCourseDialog = '[data-testid="import-modal"]' static #importShareCourseToolsInfo = '[data-testid="import-modal-external-tools-info"]' static #importShareCourseNameInput = '[data-testid="import-modal-name-input"]' - static #dialogConfirmButton = '[data-testid="dialog-confirm"]'; + static #importShareCourseDialogConfirmButton = '[data-testid="dialog-confirm"]'; + static #importShareCourseDialogTitle = '[data-testid="dialog-title"]'; + static #importShareCourseDialogTableHeader = '[data-testid="import-options-table-header"]'; + static #importShareCourseDialogPersonalData = '[data-testid="import-options-personal-data-text"]'; + static #importShareCourseDialogFilesInfo = '[data-testid="import-modal-coursefiles-info"]'; + static #importShareCourseDialogExternalToolsInfo = '[data-testid="import-modal-external-tools-protected-parameter-info"]'; seeImportShareCourseDialogBox() { - cy.get(ImportCourseModal.#importShareCourseDialog).should("exist"); + cy.get(ImportCourseModal.#importShareCourseDialog).should("be.visible"); } seeImportShareCourseToolsInfo() { - cy.get(ImportCourseModal.#importShareCourseToolsInfo).should("exist"); + cy.get(ImportCourseModal.#importShareCourseToolsInfo).should("be.visible"); + cy.get(ImportCourseModal.#importShareCourseDialogTitle).should("be.visible"); + cy.get(ImportCourseModal.#importShareCourseDialogTableHeader).should("be.visible"); + cy.get(ImportCourseModal.#importShareCourseDialogPersonalData).should("be.visible"); + cy.get(ImportCourseModal.#importShareCourseDialogFilesInfo).should("be.visible"); + cy.get(ImportCourseModal.#importShareCourseDialogExternalToolsInfo).should("be.visible"); } enterCourseNameForImportCourse(input) { - cy.get(ImportCourseModal.#importShareCourseNameInput).should("exist"); + cy.get(ImportCourseModal.#importShareCourseNameInput).should("be.visible"); cy.get(ImportCourseModal.#importShareCourseNameInput).clear(); cy.get(ImportCourseModal.#importShareCourseNameInput).type(input); } - clickOnConfirmButtonInDialog() { - cy.get(ImportCourseModal.#dialogConfirmButton).click(); + clickOnConfirmButtonInImportShareCourseDialog() { + cy.get(ImportCourseModal.#importShareCourseDialogConfirmButton).click(); } visitSavedShareCourseUrl() { - cy.visit(Cypress.env('importShareCourseUrl')); + cy.get("@importShareCourseUrl").then((url) => { + cy.visit(url) + }); + } + + seeDefaultCourseNameForImportCourse(defaultCourseName) { + cy.get(ImportCourseModal.#importShareCourseNameInput).should("be.visible") + .invoke("attr", "value") + .then((value) => { + expect(value).to.equal(defaultCourseName); + }); + } } diff --git a/cypress/support/pages/course/pageShareCourseModal.js b/cypress/support/pages/course/pageShareCourseModal.js index 5146068b6..207b163de 100644 --- a/cypress/support/pages/course/pageShareCourseModal.js +++ b/cypress/support/pages/course/pageShareCourseModal.js @@ -6,31 +6,38 @@ class ShareCourseModal { static #shareCourseDialogInfoTextContainer = '[data-testid="share-options-table-header"]'; static #shareCourseDialogPersonalDataInfo = '[data-testid="share-options-personal-data-text"]'; static #shareCourseDialogExternalToolsInfo = '[data-testid="share-modal-external-tools-info"]'; + static #shareCourseDialogToolProtectedParamsInfo = '[data-testid="share-modal-external-tools-protected-parameter-info"]'; + static #shareCourseDialogFilesInfo = '[data-testid="share-modal-coursefiles-info"]'; static #shareCourseDialogSchoolInternalCheckBox = '[data-testid="isSchoolInternal"]'; static #shareCourseDialogExpiryDateCheckBox = '[data-testid="hasExpiryDate"]'; static #shareCourseResultUrlTextBox = '[data-testid="share-course-result-url"]'; static #dialogNextButton = '[data-testid="dialog-next"]'; + static #shareCourseDialogMailButton = '[data-testid="shareMailAction"]'; + static #shareCourseDialogCopyLinkButton = '[data-testid="copyAction"]'; + static #shareCourseDialogQrCodeButton = '[data-testid="qrCodeAction"]'; seeShareCourseDialogBox() { - cy.get(ShareCourseModal.#shareCourseDialog).should("exist"); + cy.get(ShareCourseModal.#shareCourseDialog).should("be.visible"); } seeInfoTextInShareCourseDialog() { - cy.get(ShareCourseModal.#shareCourseDialogInfoTextTitle).should("exist"); - cy.get(ShareCourseModal.#shareCourseDialogInfoTextContainer).should("exist"); - cy.get(ShareCourseModal.#shareCourseDialogPersonalDataInfo).should("exist"); - cy.get(ShareCourseModal.#shareCourseDialogExternalToolsInfo).should("exist"); + cy.get(ShareCourseModal.#shareCourseDialogInfoTextTitle).should("be.visible"); + cy.get(ShareCourseModal.#shareCourseDialogInfoTextContainer).should("be.visible"); + cy.get(ShareCourseModal.#shareCourseDialogPersonalDataInfo).should("be.visible"); + cy.get(ShareCourseModal.#shareCourseDialogExternalToolsInfo).should("be.visible"); + cy.get(ShareCourseModal.#shareCourseDialogToolProtectedParamsInfo).should("be.visible"); + cy.get(ShareCourseModal.#shareCourseDialogFilesInfo).should("be.visible"); } seeSchoolInternalCheckBoxAsChecked() { - cy.get(ShareCourseModal.#shareCourseDialogSchoolInternalCheckBox).should("exist"); + cy.get(ShareCourseModal.#shareCourseDialogSchoolInternalCheckBox).should("be.visible"); cy.get(ShareCourseModal.#shareCourseDialogSchoolInternalCheckBox) .find('input[type="checkbox"]') .should("be.checked"); } seeExpiryDateCheckBoxAsChecked() { - cy.get(ShareCourseModal.#shareCourseDialogExpiryDateCheckBox).should("exist"); + cy.get(ShareCourseModal.#shareCourseDialogExpiryDateCheckBox).should("be.visible"); cy.get(ShareCourseModal.#shareCourseDialogSchoolInternalCheckBox) .find('input[type="checkbox"]') .should("be.checked"); @@ -47,7 +54,7 @@ class ShareCourseModal { } seeCopyUrlInShareCourseResultDialog() { - cy.get(ShareCourseModal.#shareCourseResultUrlTextBox).should("exist"); + cy.get(ShareCourseModal.#shareCourseResultUrlTextBox).should("be.visible"); } saveTheUrlInShareCourseResultDialog() { @@ -55,9 +62,22 @@ class ShareCourseModal { .find(".v-field__input") .invoke("attr", "value") .then((value) => { - Cypress.env('importShareCourseUrl', value); + cy.wrap(value).as("importShareCourseUrl"); }); } + + seeMailButtonInShareCourseResultDialog() { + cy.get(ShareCourseModal.#shareCourseDialogMailButton).should("be.visible"); + } + + seeCopyLinkButtonInShareCourseResultDialog() { + cy.get(ShareCourseModal.#shareCourseDialogCopyLinkButton).should("be.visible"); + } + + seeQrCodeButtonInShareCourseResultDialog() { + cy.get(ShareCourseModal.#shareCourseDialogQrCodeButton).should("be.visible"); + } + } export default ShareCourseModal; diff --git a/cypress/support/pages/course_board/pageBoard.js b/cypress/support/pages/course_board/pageBoard.js index f6803c1c1..4ac04c31c 100644 --- a/cypress/support/pages/course_board/pageBoard.js +++ b/cypress/support/pages/course_board/pageBoard.js @@ -371,7 +371,7 @@ class Board { cy.contains(textContent); } - canSeeDeletedElement(name) { + seeDeletedElement(name) { cy.get(Board.#deletedElement).contains(name).should("be.visible"); } } diff --git a/cypress/support/step_definition/course/shareCourseSteps.spec.js b/cypress/support/step_definition/course/shareCourseSteps.spec.js index 0503067d4..feabac530 100644 --- a/cypress/support/step_definition/course/shareCourseSteps.spec.js +++ b/cypress/support/step_definition/course/shareCourseSteps.spec.js @@ -31,14 +31,26 @@ When("I uncheck the school internal checkbox", () => { shareCourseModal.uncheckSchoolInternalCheckBoxInShareCourseDialog(); }); -When("I click on the continue button", () => { +When("I click on the continue button in the share course dialog", () => { shareCourseModal.clickContinueButtonInDialog(); }); -Then("I see the import share course url", () => { +Then("I see the import share course url in the share course result dialog", () => { shareCourseModal.seeCopyUrlInShareCourseResultDialog(); }); +Then("I see the mail button in the share course result dialog", () => { + shareCourseModal.seeMailButtonInShareCourseResultDialog(); +}); + +Then("I see the copy link button in the share course result dialog", () => { + shareCourseModal.seeCopyLinkButtonInShareCourseResultDialog(); +}); + +Then("I see the mail QR-Code button in the share course result dialog", () => { + shareCourseModal.seeQrCodeButtonInShareCourseResultDialog(); +}); + When("I save the import share course url", () => { shareCourseModal.saveTheUrlInShareCourseResultDialog(); }); @@ -55,10 +67,14 @@ Then("I see the import share course tools info", () => { importCourseModal.seeImportShareCourseToolsInfo(); }); +Then("I see {string} in the course name field", (defaultCourseName) => { + importCourseModal.seeDefaultCourseNameForImportCourse(defaultCourseName); +}); + When("I enter {string} in the course name field", (importCourseName) => { importCourseModal.enterCourseNameForImportCourse(importCourseName); }); When("I click on the import course button", () => { - importCourseModal.clickOnConfirmButtonInDialog(); + importCourseModal.clickOnConfirmButtonInImportShareCourseDialog(); }); From 73a64275111f6d873e625bb60fc9c99fc4bc5d8d Mon Sep 17 00:00:00 2001 From: Gordon Nicholas Date: Fri, 6 Dec 2024 11:40:06 +0100 Subject: [PATCH 4/4] N21-1506 fix failing test --- .../support/pages/course/pageImportCourseModal.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cypress/support/pages/course/pageImportCourseModal.js b/cypress/support/pages/course/pageImportCourseModal.js index 72051b70a..07a20cdd2 100644 --- a/cypress/support/pages/course/pageImportCourseModal.js +++ b/cypress/support/pages/course/pageImportCourseModal.js @@ -4,7 +4,8 @@ class ImportCourseModal { static #importShareCourseDialog = '[data-testid="import-modal"]' static #importShareCourseToolsInfo = '[data-testid="import-modal-external-tools-info"]' - static #importShareCourseNameInput = '[data-testid="import-modal-name-input"]' + static #importShareCourseNameInputDiv = '[data-testid="import-modal-name-input"]' + static #importShareCourseNameInputField = 'div[data-testid="import-modal-name-input"] input[class="v-field__input"]' static #importShareCourseDialogConfirmButton = '[data-testid="dialog-confirm"]'; static #importShareCourseDialogTitle = '[data-testid="dialog-title"]'; static #importShareCourseDialogTableHeader = '[data-testid="import-options-table-header"]'; @@ -26,9 +27,9 @@ class ImportCourseModal { } enterCourseNameForImportCourse(input) { - cy.get(ImportCourseModal.#importShareCourseNameInput).should("be.visible"); - cy.get(ImportCourseModal.#importShareCourseNameInput).clear(); - cy.get(ImportCourseModal.#importShareCourseNameInput).type(input); + cy.get(ImportCourseModal.#importShareCourseNameInputDiv).should("be.visible"); + cy.get(ImportCourseModal.#importShareCourseNameInputDiv).clear(); + cy.get(ImportCourseModal.#importShareCourseNameInputDiv).type(input); } clickOnConfirmButtonInImportShareCourseDialog() { @@ -42,7 +43,9 @@ class ImportCourseModal { } seeDefaultCourseNameForImportCourse(defaultCourseName) { - cy.get(ImportCourseModal.#importShareCourseNameInput).should("be.visible") + cy.get(ImportCourseModal.#importShareCourseNameInputDiv).should("be.visible"); + cy.get(ImportCourseModal.#importShareCourseNameInputField).should("be.visible"); + cy.get(ImportCourseModal.#importShareCourseNameInputField) .invoke("attr", "value") .then((value) => { expect(value).to.equal(defaultCourseName);