-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(editor): Add e2e tests for personal settings page (#5451)
✅ Added tests for personal user settings
- Loading branch information
1 parent
40879f6
commit 8494c97
Showing
5 changed files
with
122 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { BasePage } from './../base'; | ||
|
||
export class ChangePasswordModal extends BasePage { | ||
getters = { | ||
modalContainer: () => cy.getByTestId('changePassword-modal').last(), | ||
currentPasswordInput: () => cy.getByTestId('currentPassword').find('input').first(), | ||
newPasswordInputContainer: () => cy.getByTestId('password'), | ||
newPasswordInput: () => cy.getByTestId('password').find('input').first(), | ||
repeatPasswordInput: () => cy.getByTestId('password2').find('input').first(), | ||
changePasswordButton: () => cy.getByTestId('change-password-button'), | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { ChangePasswordModal } from './modals/change-password-modal'; | ||
import { BasePage } from './base'; | ||
|
||
const changePasswordModal = new ChangePasswordModal(); | ||
|
||
export class PersonalSettingsPage extends BasePage { | ||
url = '/settings/personal'; | ||
getters = { | ||
currentUserName: () => cy.getByTestId('current-user-name'), | ||
firstNameInput: () => cy.getByTestId('firstName').find('input').first(), | ||
lastNameInput: () => cy.getByTestId('lastName').find('input').first(), | ||
emailInputContainer: () => cy.getByTestId('email'), | ||
emailInput: () => cy.getByTestId('email').find('input').first(), | ||
changePasswordLink: () => cy.getByTestId('change-password-link').find('a').first(), | ||
saveSettingsButton: () => cy.getByTestId('save-settings-button'), | ||
}; | ||
actions = { | ||
loginAndVisit: (email: string, password: string) => { | ||
cy.signin({ email, password }); | ||
cy.visit(this.url); | ||
}, | ||
updateFirstAndLastName: (newFirstName: string, newLastName: string) => { | ||
this.getters.firstNameInput().type('{selectall}').type(newFirstName); | ||
this.getters.lastNameInput().type('{selectall}').type(newLastName); | ||
this.getters.saveSettingsButton().realClick(); | ||
}, | ||
updatePassword: (oldPassword: string, newPassword: string) => { | ||
this.getters.changePasswordLink().realClick(); | ||
changePasswordModal.getters.modalContainer().should('be.visible'); | ||
changePasswordModal.getters.currentPasswordInput().type('{selectall}').type(oldPassword); | ||
changePasswordModal.getters.newPasswordInput().type('{selectall}').type(newPassword); | ||
changePasswordModal.getters.repeatPasswordInput().type('{selectall}').type(newPassword); | ||
changePasswordModal.getters.changePasswordButton().click(); | ||
}, | ||
tryToSetWeakPassword: (oldPassword: string, newPassword: string) => { | ||
this.actions.updatePassword(oldPassword, newPassword); | ||
changePasswordModal.getters.newPasswordInputContainer().find('div[class^="_errorInput"]').should('exist'); | ||
}, | ||
updateEmail: (newEmail: string) => { | ||
this.getters.emailInput().type('{selectall}').type(newEmail).type('{enter}'); | ||
}, | ||
tryToSetInvalidEmail: (newEmail: string) => { | ||
this.actions.updateEmail(newEmail); | ||
this.getters.emailInputContainer().find('div[class^="_errorInput"]').should('exist'); | ||
}, | ||
loginWithNewData: (email: string, password: string) => { | ||
cy.signout(); | ||
this.actions.loginAndVisit(email, password); | ||
cy.url().should('match', new RegExp(this.url)); | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters