mirror of
https://github.com/IT4Change/gradido.git
synced 2026-04-06 01:25:28 +00:00
bundle cypress step definitions
- bundle step definitions in feature-related multiple-step files - avoid the long ugly file names
This commit is contained in:
parent
9f23ac9734
commit
a12bb9e09b
@ -1,11 +0,0 @@
|
|||||||
import { When } from "@badeball/cypress-cucumber-preprocessor";
|
|
||||||
import { ProfilePage } from "../models/ProfilePage";
|
|
||||||
|
|
||||||
When("the user fills the password form with:", (table) => {
|
|
||||||
table = table.rowsHash();
|
|
||||||
const profilePage = new ProfilePage();
|
|
||||||
profilePage.enterOldPassword(table["Old password"]);
|
|
||||||
profilePage.enterNewPassword(table["New password"]);
|
|
||||||
profilePage.enterRepeatPassword(table["Repeat new password"]);
|
|
||||||
cy.get(profilePage.submitNewPasswordBtn).should("be.enabled");
|
|
||||||
});
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
import { When } from "@badeball/cypress-cucumber-preprocessor";
|
|
||||||
import { Toasts } from "../models/Toasts";
|
|
||||||
|
|
||||||
When("the user is presented a {string} message", (type: string) => {
|
|
||||||
const toast = new Toasts();
|
|
||||||
cy.get(toast.toastTitle).should("contain.text", "Success");
|
|
||||||
cy.get(toast.toastMessage).should(
|
|
||||||
"contain.text",
|
|
||||||
"Your password has been changed."
|
|
||||||
);
|
|
||||||
});
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
import { And } from "@badeball/cypress-cucumber-preprocessor";
|
|
||||||
import { ProfilePage } from "../models/ProfilePage";
|
|
||||||
|
|
||||||
And("the user opens the change password menu", () => {
|
|
||||||
const profilePage = new ProfilePage();
|
|
||||||
cy.get(profilePage.openChangePassword).click();
|
|
||||||
cy.get(profilePage.newPasswordRepeatInput).should("be.visible");
|
|
||||||
cy.get(profilePage.submitNewPasswordBtn).should("be.disabled");
|
|
||||||
});
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
import { And } from "@badeball/cypress-cucumber-preprocessor";
|
|
||||||
import { ProfilePage } from "../models/ProfilePage";
|
|
||||||
|
|
||||||
And("the user submits the password form", () => {
|
|
||||||
const profilePage = new ProfilePage();
|
|
||||||
profilePage.submitPasswordForm();
|
|
||||||
});
|
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
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";
|
||||||
|
|
||||||
|
Given("the browser navigates to page {string}", (page: string) => {
|
||||||
|
cy.visit(page);
|
||||||
|
});
|
||||||
|
|
||||||
|
// login-related
|
||||||
|
|
||||||
|
Given(
|
||||||
|
"the user is logged in as {string} {string}",
|
||||||
|
(email: string, password: string) => {
|
||||||
|
cy.login(email, password);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
Then("the user is logged in with username {string}", (username: string) => {
|
||||||
|
const overviewPage = new OverviewPage();
|
||||||
|
cy.url().should("include", "/overview");
|
||||||
|
cy.get(overviewPage.navbarName).should("contain", username);
|
||||||
|
});
|
||||||
|
|
||||||
|
Then("the user cannot login", () => {
|
||||||
|
const toast = new Toasts();
|
||||||
|
cy.get(toast.toastTitle).should("contain.text", "Error!");
|
||||||
|
cy.get(toast.toastMessage).should(
|
||||||
|
"contain.text",
|
||||||
|
"No user with this credentials."
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
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", () => {
|
||||||
|
const sideNavMenu = new SideNavMenu();
|
||||||
|
sideNavMenu.logout();
|
||||||
|
});
|
||||||
@ -1,5 +0,0 @@
|
|||||||
import { Given } from "@badeball/cypress-cucumber-preprocessor";
|
|
||||||
|
|
||||||
Given("the browser navigates to page {string}", (page: string) => {
|
|
||||||
cy.visit(page);
|
|
||||||
});
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
import { Then } from "@badeball/cypress-cucumber-preprocessor";
|
|
||||||
import { Toasts } from "../../e2e/models/Toasts";
|
|
||||||
|
|
||||||
Then("the user cannot login", () => {
|
|
||||||
const toast = new Toasts();
|
|
||||||
cy.get(toast.toastTitle).should("contain.text", "Error!");
|
|
||||||
cy.get(toast.toastMessage).should(
|
|
||||||
"contain.text",
|
|
||||||
"No user with this credentials."
|
|
||||||
);
|
|
||||||
});
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
import { Given } from "@badeball/cypress-cucumber-preprocessor";
|
|
||||||
|
|
||||||
Given(
|
|
||||||
"the user is logged in as {string} {string}",
|
|
||||||
(email: string, password: string) => {
|
|
||||||
cy.login(email, password);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
import { Then } from "@badeball/cypress-cucumber-preprocessor";
|
|
||||||
import { OverviewPage } from "../../e2e/models/OverviewPage";
|
|
||||||
|
|
||||||
Then("the user is logged in with username {string}", (username: string) => {
|
|
||||||
const overviewPage = new OverviewPage();
|
|
||||||
cy.url().should("include", "/overview");
|
|
||||||
cy.get(overviewPage.navbarName).should("contain", username);
|
|
||||||
});
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
import { Then } from "@badeball/cypress-cucumber-preprocessor";
|
|
||||||
import { SideNavMenu } from "../../e2e/models/SideNavMenu";
|
|
||||||
|
|
||||||
Then("the user logs out", () => {
|
|
||||||
const sideNavMenu = new SideNavMenu();
|
|
||||||
sideNavMenu.logout();
|
|
||||||
});
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
import { When } from "@badeball/cypress-cucumber-preprocessor";
|
|
||||||
import { LoginPage } from "../../e2e/models/LoginPage";
|
|
||||||
|
|
||||||
When(
|
|
||||||
"the user submits the credentials {string} {string}",
|
|
||||||
(email: string, password: string) => {
|
|
||||||
const loginPage = new LoginPage();
|
|
||||||
loginPage.enterEmail(email);
|
|
||||||
loginPage.enterPassword(password);
|
|
||||||
loginPage.submitLogin();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
import { When } from "@badeball/cypress-cucumber-preprocessor";
|
||||||
|
import { LoginPage } from "../../e2e/models/LoginPage";
|
||||||
|
|
||||||
|
When("the user submits no credentials", () => {
|
||||||
|
const loginPage = new LoginPage();
|
||||||
|
loginPage.submitLogin();
|
||||||
|
});
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
import { And, When } from "@badeball/cypress-cucumber-preprocessor";
|
||||||
|
import { ProfilePage } from "../../e2e/models/ProfilePage";
|
||||||
|
import { Toasts } from "../../e2e/models/Toasts";
|
||||||
|
|
||||||
|
const profilePage = new ProfilePage();
|
||||||
|
|
||||||
|
And("the user opens the change password menu", () => {
|
||||||
|
cy.get(profilePage.openChangePassword).click();
|
||||||
|
cy.get(profilePage.newPasswordRepeatInput).should("be.visible");
|
||||||
|
cy.get(profilePage.submitNewPasswordBtn).should("be.disabled");
|
||||||
|
});
|
||||||
|
|
||||||
|
When("the user fills the password form with:", (table) => {
|
||||||
|
table = table.rowsHash();
|
||||||
|
profilePage.enterOldPassword(table["Old password"]);
|
||||||
|
profilePage.enterNewPassword(table["New password"]);
|
||||||
|
profilePage.enterRepeatPassword(table["Repeat new password"]);
|
||||||
|
cy.get(profilePage.submitNewPasswordBtn).should("be.enabled");
|
||||||
|
});
|
||||||
|
|
||||||
|
And("the user submits the password form", () => {
|
||||||
|
profilePage.submitPasswordForm();
|
||||||
|
});
|
||||||
|
|
||||||
|
When("the user is presented a {string} message", (type: string) => {
|
||||||
|
const toast = new Toasts();
|
||||||
|
cy.get(toast.toastTitle).should("contain.text", "Success");
|
||||||
|
cy.get(toast.toastMessage).should(
|
||||||
|
"contain.text",
|
||||||
|
"Your password has been changed."
|
||||||
|
);
|
||||||
|
});
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
import { And, When } from "@badeball/cypress-cucumber-preprocessor";
|
||||||
|
import { RegistrationPage } from "../../e2e/models/RegistrationPage";
|
||||||
|
|
||||||
|
const registrationPage = new RegistrationPage();
|
||||||
|
|
||||||
|
When(
|
||||||
|
"the user fills name and email {string} {string} {string}",
|
||||||
|
(firstname: string, lastname: string, email: string) => {
|
||||||
|
const registrationPage = new RegistrationPage();
|
||||||
|
registrationPage.enterFirstname(firstname);
|
||||||
|
registrationPage.enterLastname(lastname);
|
||||||
|
registrationPage.enterEmail(email);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
And("the user agrees to the privacy policy", () => {
|
||||||
|
registrationPage.checkPrivacyCheckbox();
|
||||||
|
});
|
||||||
|
|
||||||
|
And("the user submits the registration form", () => {
|
||||||
|
registrationPage.submitRegistrationPage();
|
||||||
|
cy.get(registrationPage.RegistrationThanxHeadline).should("be.visible");
|
||||||
|
cy.get(registrationPage.RegistrationThanxText).should("be.visible");
|
||||||
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user