Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

N21-1506-tests-for-course-share #268

Merged
merged 6 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
178 changes: 178 additions & 0 deletions cypress/e2e/course/shareCtlTools.feature
Original file line number Diff line number Diff line change
@@ -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
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
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
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
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
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
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
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
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
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
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
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
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
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
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
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
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
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
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
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
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
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
Scenario: Teacher shares the course with another teacher in the same school
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
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
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
Then I see the import share course url
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
When I save the import share course url
# Switch teacher to import shared course
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
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
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
Then I see the import share course tools info
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
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
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
When I go to course 'Cypress Test Course Import'
Then I see course page 'Cypress Test Course Import'

GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
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

GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
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
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
Scenario: Post-Condition: Admin deletes courses and external tools
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
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
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
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
5 changes: 5 additions & 0 deletions cypress/support/pages/course/pageCourses.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
33 changes: 33 additions & 0 deletions cypress/support/pages/course/pageImportCourseModal.js
Original file line number Diff line number Diff line change
@@ -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");
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
}

seeImportShareCourseToolsInfo() {
cy.get(ImportCourseModal.#importShareCourseToolsInfo).should("exist");
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
}

enterCourseNameForImportCourse(input) {
cy.get(ImportCourseModal.#importShareCourseNameInput).should("exist");
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
cy.get(ImportCourseModal.#importShareCourseNameInput).clear();
cy.get(ImportCourseModal.#importShareCourseNameInput).type(input);
}

clickOnConfirmButtonInDialog() {
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
cy.get(ImportCourseModal.#dialogConfirmButton).click();
}

visitSavedShareCourseUrl() {
cy.visit(Cypress.env('importShareCourseUrl'));
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
}
}

export default ImportCourseModal;
63 changes: 63 additions & 0 deletions cypress/support/pages/course/pageShareCourseModal.js
Original file line number Diff line number Diff line change
@@ -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");
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
}

seeInfoTextInShareCourseDialog() {
cy.get(ShareCourseModal.#shareCourseDialogInfoTextTitle).should("exist");
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
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");
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
cy.get(ShareCourseModal.#shareCourseDialogSchoolInternalCheckBox)
.find('input[type="checkbox"]')
.should("be.checked");
}

seeExpiryDateCheckBoxAsChecked() {
cy.get(ShareCourseModal.#shareCourseDialogExpiryDateCheckBox).should("exist");
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
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");
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
}

saveTheUrlInShareCourseResultDialog() {
cy.get(ShareCourseModal.#shareCourseResultUrlTextBox)
.find(".v-field__input")
.invoke("attr", "value")
.then((value) => {
Cypress.env('importShareCourseUrl', value);
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
});
}
}

export default ShareCourseModal;
6 changes: 5 additions & 1 deletion cypress/support/pages/course_board/pageBoard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"]';
Expand Down Expand Up @@ -370,5 +370,9 @@ class Board {
seeTextInTextFieldInCard(textContent){
cy.contains(textContent);
}

canSeeDeletedElement(name) {
GordonNicholasCap marked this conversation as resolved.
Show resolved Hide resolved
cy.get(Board.#deletedElement).contains(name).should("be.visible");
}
}
export default Board;
64 changes: 64 additions & 0 deletions cypress/support/step_definition/course/shareCourseSteps.spec.js
Original file line number Diff line number Diff line change
@@ -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();
});
Loading