Refactor account settings and e2e tests

Renamed several components related to account settings and updated corresponding data-test selectors for more clarity. Adjusted e2e tests to reflect these changes and added tests for new functionalities, like changing password and deleting account. In addition, generator description in monorepo configuration was simplified. Minor changes were also made to e2e test utilities for better error handling.
This commit is contained in:
giancarlo
2024-04-11 20:11:49 +08:00
parent d3cfa3d8f3
commit 9ac0707bef
9 changed files with 78 additions and 16 deletions

View File

@@ -10,12 +10,12 @@ test.describe('Account Settings', () => {
account = new AccountPageObject(page);
await account.setup();
})
});
test('user can update their profile name', async () => {
const name = 'John Doe';
await account.updateProfileName(name);
await account.updateName(name);
await page.waitForResponse((resp) => {
return resp.url().includes('accounts');
@@ -27,7 +27,7 @@ test.describe('Account Settings', () => {
test('user can update their email', async () => {
const email = account.auth.createRandomEmail();
await account.updateProfileEmail(email);
await account.updateEmail(email);
const req = await page.waitForResponse((resp) => {
return resp.url().includes('auth/v1/user');
@@ -35,4 +35,36 @@ test.describe('Account Settings', () => {
expect(req.status()).toBe(200);
});
test('user can update their password', async () => {
const password = (Math.random() * 1000).toString();
await account.updatePassword(password);
await page.waitForResponse((resp) => {
return resp.url().includes('auth/v1/user');
});
await account.auth.signOut();
});
});
test.describe('Account Deletion', () => {
let page: Page;
let account: AccountPageObject;
test.beforeAll(async ({ browser }) => {
page = await browser.newPage();
account = new AccountPageObject(page);
await account.setup();
});
test('user can delete their own account', async () => {
await account.deleteAccount();
await page.waitForURL('http://localhost:3000');
expect(page.url()).toEqual('http://localhost:3000/');
});
});