mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
adapt step definitions for new user story
This commit is contained in:
parent
926ca9c209
commit
58513fa299
@ -1,5 +1,4 @@
|
||||
import { Given, Then, When } from "@badeball/cypress-cucumber-preprocessor";
|
||||
import { LoginPage } from "../../e2e/models/LoginPage";
|
||||
import { OverviewPage } from "../../e2e/models/OverviewPage";
|
||||
import { SideNavMenu } from "../../e2e/models/SideNavMenu";
|
||||
import { Toasts } from "../../e2e/models/Toasts";
|
||||
@ -8,7 +7,7 @@ Given("the browser navigates to page {string}", (page: string) => {
|
||||
cy.visit(page);
|
||||
});
|
||||
|
||||
// login-related
|
||||
// login related
|
||||
|
||||
Given(
|
||||
"the user is logged in as {string} {string}",
|
||||
@ -32,18 +31,6 @@ Then("the user cannot login", () => {
|
||||
});
|
||||
});
|
||||
|
||||
//
|
||||
|
||||
When(
|
||||
"the user submits the credentials {string} {string}",
|
||||
(email: string, password: string) => {
|
||||
const loginPage = new LoginPage();
|
||||
loginPage.enterEmail(email);
|
||||
loginPage.enterPassword(password);
|
||||
loginPage.submitLogin();
|
||||
}
|
||||
);
|
||||
|
||||
// logout
|
||||
|
||||
Then("the user logs out", () => {
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
import { Then, When } from "@badeball/cypress-cucumber-preprocessor";
|
||||
import { ResetPasswordPage } from "../../e2e/models/ResetPasswordPage";
|
||||
import { UserEMailSite } from "../../e2e/models/UserEMailSite";
|
||||
|
||||
const userEMailSite = new UserEMailSite();
|
||||
const resetPasswordPage = new ResetPasswordPage();
|
||||
|
||||
Then("the user receives an e-mail containing the password reset link", () => {
|
||||
cy.origin(
|
||||
Cypress.env("mailserverURL"),
|
||||
{ args: userEMailSite },
|
||||
(userEMailSite) => {
|
||||
const linkPattern = /\/reset-password\/[0-9]+\d/;
|
||||
|
||||
cy.visit("/"); // navigate to user's e-maile site (on fake mail server)
|
||||
cy.get(userEMailSite.emailInbox).should("be.visible");
|
||||
|
||||
cy.get(userEMailSite.emailList)
|
||||
.find(".email-item")
|
||||
.filter(":contains(asswor)")
|
||||
.first()
|
||||
.click();
|
||||
|
||||
cy.get(userEMailSite.emailMeta)
|
||||
.find(userEMailSite.emailSubject)
|
||||
.contains("asswor");
|
||||
|
||||
cy.get(".email-content")
|
||||
.find(".plain-text")
|
||||
.contains(linkPattern)
|
||||
.invoke("text")
|
||||
.then((text) => {
|
||||
const resetPasswordLink = text.match(linkPattern)[0];
|
||||
cy.task("setResetPasswordLink", resetPasswordLink);
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
When("the user opens the password reset link in the browser", () => {
|
||||
cy.task("getResetPasswordLink").then((passwordResetLink) => {
|
||||
cy.visit(passwordResetLink);
|
||||
});
|
||||
cy.get(resetPasswordPage.newPasswordRepeatBlock).should("be.visible");
|
||||
});
|
||||
@ -1,7 +1,57 @@
|
||||
import { When } from "@badeball/cypress-cucumber-preprocessor";
|
||||
import { When, And } from "@badeball/cypress-cucumber-preprocessor";
|
||||
import { ForgotPasswordPage } from "../../e2e/models/ForgotPasswordPage";
|
||||
import { LoginPage } from "../../e2e/models/LoginPage";
|
||||
import { ResetPasswordPage } from "../../e2e/models/ResetPasswordPage";
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const forgotPasswordPage = new ForgotPasswordPage();
|
||||
const resetPasswordPage = new ResetPasswordPage();
|
||||
|
||||
// login related
|
||||
|
||||
When("the user submits no credentials", () => {
|
||||
const loginPage = new LoginPage();
|
||||
loginPage.submitLogin();
|
||||
});
|
||||
|
||||
When(
|
||||
"the user submits the credentials {string} {string}",
|
||||
(email: string, password: string) => {
|
||||
loginPage.enterEmail(email);
|
||||
loginPage.enterPassword(password);
|
||||
loginPage.submitLogin();
|
||||
}
|
||||
);
|
||||
|
||||
// password reset related
|
||||
|
||||
And("the user navigates to the forgot password page", () => {
|
||||
loginPage.openForgotPasswordPage();
|
||||
cy.url().should("include", "/forgot-password");
|
||||
});
|
||||
|
||||
When("the user enters the e-mail address {string}", (email: string) => {
|
||||
forgotPasswordPage.enterEmail(email);
|
||||
});
|
||||
|
||||
And("the user submits the e-mail form", () => {
|
||||
forgotPasswordPage.submitEmail();
|
||||
cy.get(forgotPasswordPage.successComponent).should("be.visible");
|
||||
});
|
||||
|
||||
And("the user enters the password {string}", (password: string) => {
|
||||
resetPasswordPage.enterNewPassword(password);
|
||||
});
|
||||
|
||||
And("the user repeats the password {string}", (password: string) => {
|
||||
resetPasswordPage.repeatNewPassword(password);
|
||||
});
|
||||
|
||||
And("the user submits the new password", () => {
|
||||
resetPasswordPage.submitNewPassword();
|
||||
cy.get(resetPasswordPage.resetPasswordMessageBlock).should("be.visible");
|
||||
});
|
||||
|
||||
And("the user clicks the sign in button", () => {
|
||||
resetPasswordPage.openSigninPage();
|
||||
cy.url().should("contain", "/login");
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user