diff --git a/cypress/e2e/topics/accessH5PEditor.feature b/cypress/e2e/topics/accessH5PEditor.feature new file mode 100644 index 00000000..19ac2cdc --- /dev/null +++ b/cypress/e2e/topics/accessH5PEditor.feature @@ -0,0 +1,16 @@ +@release +Feature: To access the H5P editor as a teacher. + +As a teacher, I want to be able to access the H5P Editor for a topic in my course to create learning content + +@stable_test +Scenario: Access H5P Editor + Given I am logged in as a 'teacher1_dbc' at 'default' + 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..e42b7f7a 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,23 @@ class Topics { cy.get(Topics.#addTaskBtn).click() } + clickOnAddContentH5PToTopic() { + cy.get(Topics.#addContentH5pBtn).click() + } + + seeCreateH5PInTopic() { + cy.get(Topics.#createH5pBtn) + .should('exist') + .click() + } + 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..110cf070 --- /dev/null +++ b/cypress/support/step_definition/topics/accessH5PEditor.spec.js @@ -0,0 +1,18 @@ +const { When, Then } = require("@badeball/cypress-cucumber-preprocessor") +import Topics from '../../pages/topics/pageTopics' + +const topics = new Topics() + +When('I click on the button Edit on topic page', () => { + topics.clickOnButtonEditInTopicPage() +}) + +When('I click on the Add Content H5P button', () =>{ + topics.clickOnAddContentH5PToTopic(); +}) + +Then('I can click on the Create H5P button', ()=>{ + topics.seeCreateH5PInTopic(); +}) + +