add page object files for e2e testing "forgot password"

This commit is contained in:
mahula 2023-01-30 18:17:22 +01:00
parent 3ae58ca6a9
commit c23327013f
3 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,18 @@
/// <reference types="cypress" />
export class ForgotPasswordPage {
// selectors
emailInput = "input[type=email]";
submitBtn = "button[type=submit]";
successComponent = "[data-test='forgot-password-success']";
enterEmail(email: string) {
cy.get(this.emailInput).clear().type(email);
return this;
}
submitEmail() {
cy.get(this.submitBtn).click();
return this;
}
}

View File

@ -0,0 +1,32 @@
/// <reference types="cypress" />
export class ResetPasswordPage {
// selectors
newPasswordBlock = "#new-password-input-field";
newPasswordRepeatBlock = "#repeat-new-password-input-field";
resetPasswordBtn = "button[type=submit]";
resetPasswordMessageBlock = '[data-test="reset-password-message"]';
signinBtn = ".btn.test-message-button";
enterNewPassword(password: string) {
cy.get(this.newPasswordBlock).find("input[type=password]").type(password);
return this;
}
repeatNewPassword(password: string) {
cy.get(this.newPasswordRepeatBlock)
.find("input[type=password]")
.type(password);
return this;
}
submitNewPassword() {
cy.get(this.resetPasswordBtn).click();
return this;
}
openSigninPage() {
cy.get(this.signinBtn).click();
return this;
}
}

View File

@ -0,0 +1,17 @@
/// <reference types="cypress" />
export class UserEMailSite {
// selectors
emailInbox = ".sidebar-emails-container";
emailList = ".email-list";
emailMeta = ".email-meta";
emailSubject = ".subject";
openRecentPasswordResetEMail() {
cy.get(this.emailList)
.find("email-item")
.filter(":contains(asswor)")
.click();
expect(cy.get(this.emailSubject)).to("contain", "asswor");
}
}