From 190bba2eaf7463cf3b71701a4799785c94172dad Mon Sep 17 00:00:00 2001 From: hbukvic Date: Fri, 18 Aug 2023 11:26:34 +0200 Subject: [PATCH 1/6] wip --- .../e2e/admin/administrateMigration.feature | 25 +++++++ .../support/pages/admin/pageAdministration.js | 69 +++++++++++++++++++ .../admin/administrateMigrationSteps.js | 44 ++++++++++++ 3 files changed, 138 insertions(+) create mode 100644 cypress/e2e/admin/administrateMigration.feature create mode 100644 cypress/support/step_definition/admin/administrateMigrationSteps.js diff --git a/cypress/e2e/admin/administrateMigration.feature b/cypress/e2e/admin/administrateMigration.feature new file mode 100644 index 00000000..54592699 --- /dev/null +++ b/cypress/e2e/admin/administrateMigration.feature @@ -0,0 +1,25 @@ +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 + When I can see the school number + Then I can click on the start migration button + Then I can see the migration information text + Then I can write an email to a pre-defined receiver + Then I can click on the information link that opens a new tab + 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..160f5fd3 100644 --- a/cypress/support/pages/admin/pageAdministration.js +++ b/cypress/support/pages/admin/pageAdministration.js @@ -33,6 +33,12 @@ 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"]' disableTeamsVideoConferenceByAdmin () { @@ -269,5 +275,68 @@ class Management { .find('input') .click({ force: true }) } + + schoolNumberIsAdded() { + cy.get('#input-193') + .should('not.be.empty') + } + + + migrationButtonIsEnabled() { + cy.get(Management.#startMigrationButton) + .should('be.enabled') + } + + clickStartMigration() { + cy.get(Management.#startMigrationButton) + .click() + } + + migrationInformationIsVisible() { + cy.get(Management.#migrationInformationText) + .should('be.visible') + } + + clickSupportLink() { + cy.contains("a", "Support") + .invoke("attr", "href") + .should('contain', 'mailto:nbc-support@netz-21.de') + } + + clickInfoLink() { + cy.contains("[data-testid=\"text-description\"] > a", "hier") + .should("have.attr", "href", "https://blog.niedersachsen.cloud/umzug") + } + + clickAgreeMigrationButton() { + cy.get(Management.#agreeMigrationButton) + .click() + } + + migrationActiveTextInformation() { + cy.get('.v-alert__content > span') + .should('contain', 'Die Account-Migration ist aktiv.') + } + + endMigrationButtonIsVisible() { + 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..47c5497f --- /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() + +When('I can see the school number', () => { + management.schoolNumberIsAdded() +}) + +Then('I can click on the start migration button',() => { + management.migrationButtonIsEnabled() +}) + +When('I click on the start migration button', () => { + management.clickStartMigration() +}) +Then('I can see the migration information text', () => { + management.migrationInformationIsVisible() +}); +Then('I can write an email to a pre-defined receiver', () => { + management.clickSupportLink() +}); +When('I can click on the information link that opens a new tab', () =>{ + management.clickInfoLink() +}); +When('I click on agree migration button', () =>{ + management.clickAgreeMigrationButton() +}); +Then('I see the migration is active field', () => { +management.migrationActiveTextInformation() +}); +Then('I see the end migration button', () => { +management.endMigrationButtonIsVisible() +}); +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() + +}); From 0de26d00ab7ad13c537dbd9759ef91cc2dd71d2c Mon Sep 17 00:00:00 2001 From: hbukvic Date: Wed, 23 Aug 2023 11:37:07 +0200 Subject: [PATCH 2/6] Changes query selectors to new testid --- cypress/support/pages/admin/pageAdministration.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cypress/support/pages/admin/pageAdministration.js b/cypress/support/pages/admin/pageAdministration.js index 160f5fd3..2c8cc6ff 100644 --- a/cypress/support/pages/admin/pageAdministration.js +++ b/cypress/support/pages/admin/pageAdministration.js @@ -39,6 +39,8 @@ class Management { 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"]' disableTeamsVideoConferenceByAdmin () { @@ -277,7 +279,7 @@ class Management { } schoolNumberIsAdded() { - cy.get('#input-193') + cy.get(Management.#schoolNumberForm) .should('not.be.empty') } @@ -314,7 +316,7 @@ class Management { } migrationActiveTextInformation() { - cy.get('.v-alert__content > span') + cy.get(Management.#migrationActiveStatus) .should('contain', 'Die Account-Migration ist aktiv.') } From adbec4c59c1f4336678c95258d6a4d9dc9406c2e Mon Sep 17 00:00:00 2001 From: hbukvic Date: Wed, 23 Aug 2023 13:05:01 +0200 Subject: [PATCH 3/6] adds release tag --- cypress/e2e/admin/administrateMigration.feature | 1 + 1 file changed, 1 insertion(+) diff --git a/cypress/e2e/admin/administrateMigration.feature b/cypress/e2e/admin/administrateMigration.feature index 54592699..f6194de3 100644 --- a/cypress/e2e/admin/administrateMigration.feature +++ b/cypress/e2e/admin/administrateMigration.feature @@ -1,3 +1,4 @@ +@release Feature: Admin Users - To administrate the Migration process. As an Admin I want to start, finish and make the migration mandatory. From c55f8645576d1fd8f24f2131ace9c5041f9f6469 Mon Sep 17 00:00:00 2001 From: hbukvic Date: Wed, 23 Aug 2023 16:46:46 +0200 Subject: [PATCH 4/6] changes step definitions, adds new variables --- cypress/e2e/admin/administrateMigration.feature | 6 +++--- cypress/support/pages/admin/pageAdministration.js | 10 ++++++---- .../admin/administrateMigrationSteps.js | 10 +++++----- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/cypress/e2e/admin/administrateMigration.feature b/cypress/e2e/admin/administrateMigration.feature index f6194de3..5acc2ef3 100644 --- a/cypress/e2e/admin/administrateMigration.feature +++ b/cypress/e2e/admin/administrateMigration.feature @@ -9,11 +9,11 @@ Feature: Admin Users - To administrate the Migration process. When I go to school administration Scenario: Admin starts the migration and the School Number is added - When I can see the school number - Then I can click on the start migration button + 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 can write an email to a pre-defined receiver - Then I can click on the information link that opens a new tab + 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 diff --git a/cypress/support/pages/admin/pageAdministration.js b/cypress/support/pages/admin/pageAdministration.js index 2c8cc6ff..17042874 100644 --- a/cypress/support/pages/admin/pageAdministration.js +++ b/cypress/support/pages/admin/pageAdministration.js @@ -41,6 +41,8 @@ class Management { 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 () { @@ -299,14 +301,14 @@ class Management { .should('be.visible') } - clickSupportLink() { - cy.contains("a", "Support") + checkSupportLink() { + cy.get(Management.#migrationTextSupportLink) .invoke("attr", "href") .should('contain', 'mailto:nbc-support@netz-21.de') } - clickInfoLink() { - cy.contains("[data-testid=\"text-description\"] > a", "hier") + checkInfoLink() { + cy.get(Management.#migrationTextBlogLink) .should("have.attr", "href", "https://blog.niedersachsen.cloud/umzug") } diff --git a/cypress/support/step_definition/admin/administrateMigrationSteps.js b/cypress/support/step_definition/admin/administrateMigrationSteps.js index 47c5497f..5b654ad7 100644 --- a/cypress/support/step_definition/admin/administrateMigrationSteps.js +++ b/cypress/support/step_definition/admin/administrateMigrationSteps.js @@ -3,11 +3,11 @@ import Management from '../../pages/admin/pageAdministration' const management = new Management() -When('I can see the school number', () => { +Then('I can see the school number', () => { management.schoolNumberIsAdded() }) -Then('I can click on the start migration button',() => { +Then('I see button Start migration is enabled',() => { management.migrationButtonIsEnabled() }) @@ -18,10 +18,10 @@ Then('I can see the migration information text', () => { management.migrationInformationIsVisible() }); Then('I can write an email to a pre-defined receiver', () => { - management.clickSupportLink() + management.checkSupportLink() }); -When('I can click on the information link that opens a new tab', () =>{ - management.clickInfoLink() +Then(/^I see the information link href is blog\.niedersachsen\.cloud\/umzug$/, () =>{ + management.checkInfoLink() }); When('I click on agree migration button', () =>{ management.clickAgreeMigrationButton() From 34e240caa572a0bbc4d8b5e13629551e2e1d5251 Mon Sep 17 00:00:00 2001 From: hbukvic Date: Thu, 24 Aug 2023 09:32:39 +0200 Subject: [PATCH 5/6] changes method names --- cypress/support/pages/admin/pageAdministration.js | 8 ++++---- .../step_definition/admin/administrateMigrationSteps.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cypress/support/pages/admin/pageAdministration.js b/cypress/support/pages/admin/pageAdministration.js index 17042874..12a10ba7 100644 --- a/cypress/support/pages/admin/pageAdministration.js +++ b/cypress/support/pages/admin/pageAdministration.js @@ -280,13 +280,13 @@ class Management { .click({ force: true }) } - schoolNumberIsAdded() { + addedSchoolNumberIsShowing() { cy.get(Management.#schoolNumberForm) .should('not.be.empty') } - migrationButtonIsEnabled() { + seeMigrationButtonIsEnabled() { cy.get(Management.#startMigrationButton) .should('be.enabled') } @@ -296,7 +296,7 @@ class Management { .click() } - migrationInformationIsVisible() { + seeVisibleMigrationInformation() { cy.get(Management.#migrationInformationText) .should('be.visible') } @@ -317,7 +317,7 @@ class Management { .click() } - migrationActiveTextInformation() { + seeMigrationActiveTextInformation() { cy.get(Management.#migrationActiveStatus) .should('contain', 'Die Account-Migration ist aktiv.') } diff --git a/cypress/support/step_definition/admin/administrateMigrationSteps.js b/cypress/support/step_definition/admin/administrateMigrationSteps.js index 5b654ad7..26b12bda 100644 --- a/cypress/support/step_definition/admin/administrateMigrationSteps.js +++ b/cypress/support/step_definition/admin/administrateMigrationSteps.js @@ -4,18 +4,18 @@ import Management from '../../pages/admin/pageAdministration' const management = new Management() Then('I can see the school number', () => { - management.schoolNumberIsAdded() + management.addedSchoolNumberIsShowing() }) Then('I see button Start migration is enabled',() => { - management.migrationButtonIsEnabled() + management.seeMigrationButtonIsEnabled() }) When('I click on the start migration button', () => { management.clickStartMigration() }) Then('I can see the migration information text', () => { - management.migrationInformationIsVisible() + management.seeVisibleMigrationInformation() }); Then('I can write an email to a pre-defined receiver', () => { management.checkSupportLink() @@ -27,7 +27,7 @@ When('I click on agree migration button', () =>{ management.clickAgreeMigrationButton() }); Then('I see the migration is active field', () => { -management.migrationActiveTextInformation() +management.seeMigrationActiveTextInformation() }); Then('I see the end migration button', () => { management.endMigrationButtonIsVisible() From 3eab7e26ed9f997e8c962b22d5f4f7c45ebdad15 Mon Sep 17 00:00:00 2001 From: hbukvic Date: Thu, 24 Aug 2023 10:59:41 +0200 Subject: [PATCH 6/6] changes method names and step definition --- cypress/e2e/admin/administrateMigration.feature | 2 +- cypress/support/pages/admin/pageAdministration.js | 4 ++-- .../step_definition/admin/administrateMigrationSteps.js | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cypress/e2e/admin/administrateMigration.feature b/cypress/e2e/admin/administrateMigration.feature index 5acc2ef3..4fd768a2 100644 --- a/cypress/e2e/admin/administrateMigration.feature +++ b/cypress/e2e/admin/administrateMigration.feature @@ -12,7 +12,7 @@ Feature: Admin Users - To administrate the Migration process. 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 can write an email to a pre-defined receiver + 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 diff --git a/cypress/support/pages/admin/pageAdministration.js b/cypress/support/pages/admin/pageAdministration.js index 12a10ba7..876a4e44 100644 --- a/cypress/support/pages/admin/pageAdministration.js +++ b/cypress/support/pages/admin/pageAdministration.js @@ -280,7 +280,7 @@ class Management { .click({ force: true }) } - addedSchoolNumberIsShowing() { + seeAddedSchoolNumber() { cy.get(Management.#schoolNumberForm) .should('not.be.empty') } @@ -322,7 +322,7 @@ class Management { .should('contain', 'Die Account-Migration ist aktiv.') } - endMigrationButtonIsVisible() { + seeEndMigrationButtonIsEnabled() { cy.get(Management.#migrationEndButton) .should('be.enabled') } diff --git a/cypress/support/step_definition/admin/administrateMigrationSteps.js b/cypress/support/step_definition/admin/administrateMigrationSteps.js index 26b12bda..6604b26f 100644 --- a/cypress/support/step_definition/admin/administrateMigrationSteps.js +++ b/cypress/support/step_definition/admin/administrateMigrationSteps.js @@ -4,7 +4,7 @@ import Management from '../../pages/admin/pageAdministration' const management = new Management() Then('I can see the school number', () => { - management.addedSchoolNumberIsShowing() + management.seeAddedSchoolNumber() }) Then('I see button Start migration is enabled',() => { @@ -17,7 +17,7 @@ When('I click on the start migration button', () => { Then('I can see the migration information text', () => { management.seeVisibleMigrationInformation() }); -Then('I can write an email to a pre-defined receiver', () => { +Then('I see the email form with correct recipient', () => { management.checkSupportLink() }); Then(/^I see the information link href is blog\.niedersachsen\.cloud\/umzug$/, () =>{ @@ -30,7 +30,7 @@ Then('I see the migration is active field', () => { management.seeMigrationActiveTextInformation() }); Then('I see the end migration button', () => { -management.endMigrationButtonIsVisible() +management.seeEndMigrationButtonIsEnabled() }); When('I click on end migration button', () => { management.clickEndMigrationButton()