diff --git a/cypress/e2e/admin/administrateMigration.feature b/cypress/e2e/admin/administrateMigration.feature new file mode 100644 index 00000000..4fd768a2 --- /dev/null +++ b/cypress/e2e/admin/administrateMigration.feature @@ -0,0 +1,26 @@ +@release +Feature: Admin Users - To administrate the Migration process. + + As an Admin I want to start, finish and make the migration mandatory. + + Background: + Given I am logged in as a 'admin' at 'nbc' + When I go to administration page + When I go to school administration + + Scenario: Admin starts the migration and the School Number is added + Then I can see the school number + Then I see button Start migration is enabled + Then I can see the migration information text + Then I see the email form with correct recipient + Then I see the information link href is blog.niedersachsen.cloud/umzug + When I click on the start migration button + When I click on agree migration button + Then I see the migration is active field + Then I see the end migration button + + + Scenario: Admin ends the migration + When I click on end migration button + When I click on the end migration confirmation checkbox + When I click on the end migration confirmation button diff --git a/cypress/support/pages/admin/pageAdministration.js b/cypress/support/pages/admin/pageAdministration.js index 8899cd25..876a4e44 100644 --- a/cypress/support/pages/admin/pageAdministration.js +++ b/cypress/support/pages/admin/pageAdministration.js @@ -33,6 +33,16 @@ class Management { static #schoolAdministrationNavigationButton = '[data-testid="Schule"]' static #studentTeamCheckbox = '[data-testid="student_team_checkbox"]' static #submitButtonTeamsAdmin = '[data-testid="button_save_team_administration"]' + static #startMigrationButton = '[data-testid="migration-start-button"]' + static #migrationInformationText = '[data-testid="text-description"]' + static #agreeMigrationButton = '[data-testid="agree-btn"]' + static #migrationEndButton = '[data-testid="migration-end-button"]' + static #endMigrationConfirmationCheckbox = '[data-testid="migration-confirmation-checkbox"]' + static #endMigrationConfirmationButton = '[data-testid="agree-btn"]' + static #migrationActiveStatus = '[data-testid="migration-active-status"]' + static #schoolNumberForm = '[data-testid="school-number"]' + static #migrationTextSupportLink = '[data-testid="support-link"]' + static #migrationTextBlogLink = '[data-testid="migration-blog-link"]' disableTeamsVideoConferenceByAdmin () { @@ -269,5 +279,68 @@ class Management { .find('input') .click({ force: true }) } + + seeAddedSchoolNumber() { + cy.get(Management.#schoolNumberForm) + .should('not.be.empty') + } + + + seeMigrationButtonIsEnabled() { + cy.get(Management.#startMigrationButton) + .should('be.enabled') + } + + clickStartMigration() { + cy.get(Management.#startMigrationButton) + .click() + } + + seeVisibleMigrationInformation() { + cy.get(Management.#migrationInformationText) + .should('be.visible') + } + + checkSupportLink() { + cy.get(Management.#migrationTextSupportLink) + .invoke("attr", "href") + .should('contain', 'mailto:nbc-support@netz-21.de') + } + + checkInfoLink() { + cy.get(Management.#migrationTextBlogLink) + .should("have.attr", "href", "https://blog.niedersachsen.cloud/umzug") + } + + clickAgreeMigrationButton() { + cy.get(Management.#agreeMigrationButton) + .click() + } + + seeMigrationActiveTextInformation() { + cy.get(Management.#migrationActiveStatus) + .should('contain', 'Die Account-Migration ist aktiv.') + } + + seeEndMigrationButtonIsEnabled() { + cy.get(Management.#migrationEndButton) + .should('be.enabled') + } + + clickEndMigrationButton() { + cy.get(Management.#migrationEndButton) + .click() + } + + + clickEndMigrationConfirmationCheckbox() { + cy.get(Management.#endMigrationConfirmationCheckbox) + .check( {force: true} ) + } + + clickEndMigrationConfirmationButton() { + cy.get(Management.#endMigrationConfirmationButton) + .click() + } } export default Management diff --git a/cypress/support/step_definition/admin/administrateMigrationSteps.js b/cypress/support/step_definition/admin/administrateMigrationSteps.js new file mode 100644 index 00000000..6604b26f --- /dev/null +++ b/cypress/support/step_definition/admin/administrateMigrationSteps.js @@ -0,0 +1,44 @@ +const { When, Then } = require('@badeball/cypress-cucumber-preprocessor') +import Management from '../../pages/admin/pageAdministration' + +const management = new Management() + +Then('I can see the school number', () => { + management.seeAddedSchoolNumber() +}) + +Then('I see button Start migration is enabled',() => { + management.seeMigrationButtonIsEnabled() +}) + +When('I click on the start migration button', () => { + management.clickStartMigration() +}) +Then('I can see the migration information text', () => { + management.seeVisibleMigrationInformation() +}); +Then('I see the email form with correct recipient', () => { + management.checkSupportLink() +}); +Then(/^I see the information link href is blog\.niedersachsen\.cloud\/umzug$/, () =>{ + management.checkInfoLink() +}); +When('I click on agree migration button', () =>{ + management.clickAgreeMigrationButton() +}); +Then('I see the migration is active field', () => { +management.seeMigrationActiveTextInformation() +}); +Then('I see the end migration button', () => { +management.seeEndMigrationButtonIsEnabled() +}); +When('I click on end migration button', () => { +management.clickEndMigrationButton() +}); +When('I click on the end migration confirmation checkbox', () => { +management.clickEndMigrationConfirmationCheckbox() +}); +When('I click on the end migration confirmation button', () => { +management.clickEndMigrationConfirmationButton() + +});