diff --git a/cypress/e2e/topics/accessH5PEditor.feature b/cypress/e2e/topics/accessH5PEditor.feature index cd85264a..a9fa5a19 100644 --- a/cypress/e2e/topics/accessH5PEditor.feature +++ b/cypress/e2e/topics/accessH5PEditor.feature @@ -1,14 +1,16 @@ -@release -Feature: To access the H5P editor as a teacher. +@release +Feature: To access the H5P editor as a teacher. As a teacher, I want to access the H5P Editor for a topic in my course to create learning content @stable_test -Scenario: Access H5P Editor for existing topic +Scenario: Access H5P Editor Given I am logged in as a 'teacher1_dbc' at 'default' - When I go to the courses page - And I click on the existing course 'Mathe' - And I click on the existing topic 'Testthema' - And I enter click on the edit button - And I click on the H5P button - Then a new window with a H5P editor should open \ No newline at end of file + When I go to rooms overview + When I go to room 'Course with subject and tasks' + When I click on topic 'Statistic' on course page + When I click on the button Edit on topic page + When I click on the Add Content H5P button + Then I can click on the Create H5P button + + diff --git a/cypress/support/pages/topics/pageTopics.js b/cypress/support/pages/topics/pageTopics.js index 6b4130b2..0b772f2f 100644 --- a/cypress/support/pages/topics/pageTopics.js +++ b/cypress/support/pages/topics/pageTopics.js @@ -11,6 +11,8 @@ class Topics { static #addLearningMaterialBtn = '[data-testid="topic-addcontent-material-btn"]' static #addEtherpadBtn = '[data-testid="topic-addcontent-etherpad-btn"]' static #addTaskBtn = '[data-testid="topic-addcontent-task-btn"]' + static #addContentH5pBtn = '[data-testid="topic-addcontent-h5p-btn"]' + static #createH5pBtn = '[data-testid="topic-h5p-create-btn"]' // class is used for cardHeader and cardBlock because the elements are too generic and depend on position of the element, so using data-testid would need much more logic (also in the feature file) and code than using class. static #cardHeader = '[class="card-header"]' static #cardBlock = '[class="card-block"]' @@ -71,11 +73,22 @@ class Topics { cy.get(Topics.#addTaskBtn).click() } + clickOnAddContentH5PToTopic() { + cy.get(Topics.#addContentH5pBtn).click() + } + + seeCreateH5PInTopic() { + cy.get(Topics.#createH5pBtn) + .should('exist') + } + clickOnSubmitChangesInTopicBtn() { cy.get(Topics.#submitChangesInTopicBtn) .click() } + + seeFormElementText(textElementPosition) { if(textElementPosition === '0'){ cy.get(Topics.#textElementPos0).should('exist') diff --git a/cypress/support/step_definition/topics/accessH5PEditor.spec.js b/cypress/support/step_definition/topics/accessH5PEditor.spec.js new file mode 100644 index 00000000..d9d21f2f --- /dev/null +++ b/cypress/support/step_definition/topics/accessH5PEditor.spec.js @@ -0,0 +1,21 @@ +const { When, Then } = require("@badeball/cypress-cucumber-preprocessor") +import Topics from '../../pages/topics/pageTopics' +import Courses from '../../pages/course/pageCourses' + + +const topics = new Topics() +const courses = new Courses() + +When('I click on the Add Content H5P button', () =>{ + topics.clickOnAddContentH5PToTopic(); +}) + +When('I click on the button Edit on topic page', () => { + topics.clickOnButtonEditInTopicPage() + }) + + Then('I can click on the Create H5P button', ()=>{ + topics.seeCreateH5PInTopic(); + }) + +