twenty/packages/twenty-e2e-testing/lib/pom/settings/profileSection.ts
Abdullah. 0fcfcec426
(Breaking change) Switch between set password and change password on the settings page. (#15582)
Here is what the PR does:

- Surface password state in validatePasswordResetToken, returning
hasPassword so the client can tell whether a user is setting or changing
their password.
- Consume that flag throughout the front end (mock data, stories,
GraphQL types) and update the Reset/Set Password modal to swap the
heading/button label and success toast accordingly.
- After a successful password set/reset, immediately update the
logged-in user’s hasPassword flag so the Settings screen reflects the
new state without a reload.

Modal has two states now - reset password modal uses change password
state since it made intuitive sense.

<p align="center">
<img width="404" height="397" alt="image"
src="https://github.com/user-attachments/assets/c54cc581-1248-4395-833d-0202758e1947"
/>
</p>

<p align="center">
<img width="403" height="393" alt="image"
src="https://github.com/user-attachments/assets/d8a39a95-27e6-4037-86f2-1f74176002ba"
/>
</p>

---------

Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
2025-11-05 11:29:37 +01:00

44 lines
1.2 KiB
TypeScript

import { Locator, Page } from '@playwright/test';
export class ProfileSection {
private readonly firstNameField: Locator;
private readonly lastNameField: Locator;
private readonly emailField: Locator;
private readonly passwordLinkButton: Locator;
private readonly deleteAccountButton: Locator;
constructor(public readonly page: Page) {
this.page = page;
this.firstNameField = page.getByPlaceholder('Tim');
this.lastNameField = page.getByPlaceholder('Cook');
this.emailField = page.getByRole('textbox').nth(2);
this.passwordLinkButton = page.getByRole('button', {
name: /Change Password|Set Password/,
});
this.deleteAccountButton = page.getByRole('button', {
name: 'Delete account',
});
}
async changeFirstName(firstName: string) {
await this.firstNameField.clear();
await this.firstNameField.fill(firstName);
}
async changeLastName(lastName: string) {
await this.lastNameField.clear();
await this.lastNameField.fill(lastName);
}
async getEmail() {
await this.emailField.textContent();
}
async sendPasswordSetOrChangeEmail() {
await this.passwordLinkButton.click();
}
async deleteAccount() {
await this.deleteAccountButton.click();
}
}