fix language dependency of some selectors in login and user profile tests

This commit is contained in:
mahula 2022-09-28 10:38:46 +02:00
parent 480378a182
commit e7207da9ac
3 changed files with 13 additions and 10 deletions

View File

@ -2,6 +2,9 @@
export class Toasts { export class Toasts {
// selectors // selectors
toastSlot = ".b-toaster-slot";
toastTypeSuccess = ".b-toast-success";
toastTypeError = ".b-toast-danger";
toastTitle = ".gdd-toaster-title"; toastTitle = ".gdd-toaster-title";
toastMessage = ".gdd-toaster-body"; toastMessage = ".gdd-toaster-body";
} }

View File

@ -25,11 +25,11 @@ Then("the user is logged in with username {string}", (username: string) => {
Then("the user cannot login", () => { Then("the user cannot login", () => {
const toast = new Toasts(); const toast = new Toasts();
cy.get(toast.toastTitle).should("contain.text", "Error!"); cy.get(toast.toastSlot).within(() => {
cy.get(toast.toastMessage).should( cy.get(toast.toastTypeError);
"contain.text", cy.get(toast.toastTitle).should("be.visible");
"No user with this credentials." cy.get(toast.toastMessage).should("be.visible");
); });
}); });
// //

View File

@ -24,9 +24,9 @@ And("the user submits the password form", () => {
When("the user is presented a {string} message", (type: string) => { When("the user is presented a {string} message", (type: string) => {
const toast = new Toasts(); const toast = new Toasts();
cy.get(toast.toastTitle).should("contain.text", "Success"); cy.get(toast.toastSlot).within(() => {
cy.get(toast.toastMessage).should( cy.get(toast.toastTypeSuccess);
"contain.text", cy.get(toast.toastTitle).should("be.visible");
"Your password has been changed." cy.get(toast.toastMessage).should("be.visible");
); });
}); });