Refactor E2E tests, update utils, and modify plan-picker validation
Several changes have been made to optimize the testing and validation workflows. The end-to-end tests for user billing, invitations, account, team billing, and team accounts have been retouched for improved performance and better accuracy. There has been a minor modification in the validation rules for plan-picker in the billing component. Furthermore, modifications are made to several utility functions to fine-tune their operations.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Page } from '@playwright/test';
|
||||
import { Page, expect } from '@playwright/test';
|
||||
|
||||
import { AuthPageObject } from '../authentication/auth.po';
|
||||
|
||||
export class AccountPageObject {
|
||||
@@ -20,24 +21,60 @@ export class AccountPageObject {
|
||||
}
|
||||
|
||||
async updateEmail(email: string) {
|
||||
await this.page.fill('[data-test="account-email-form-email-input"]', email);
|
||||
await this.page.fill('[data-test="account-email-form-repeat-email-input"]', email);
|
||||
await this.page.click('[data-test="account-email-form"] button');
|
||||
await expect(async () => {
|
||||
await this.page.fill(
|
||||
'[data-test="account-email-form-email-input"]',
|
||||
email,
|
||||
);
|
||||
|
||||
await this.page.fill(
|
||||
'[data-test="account-email-form-repeat-email-input"]',
|
||||
email,
|
||||
);
|
||||
|
||||
await this.page.click('[data-test="account-email-form"] button');
|
||||
|
||||
const req = await this.page.waitForResponse((resp) => {
|
||||
return resp.url().includes('auth/v1/user');
|
||||
});
|
||||
|
||||
expect(req.status()).toBe(200);
|
||||
}).toPass();
|
||||
}
|
||||
|
||||
async updatePassword(password: string) {
|
||||
await this.page.fill('[data-test="account-password-form-password-input"]', password);
|
||||
await this.page.fill('[data-test="account-password-form-repeat-password-input"]', password);
|
||||
await this.page.fill(
|
||||
'[data-test="account-password-form-password-input"]',
|
||||
password,
|
||||
);
|
||||
await this.page.fill(
|
||||
'[data-test="account-password-form-repeat-password-input"]',
|
||||
password,
|
||||
);
|
||||
await this.page.click('[data-test="account-password-form"] button');
|
||||
}
|
||||
|
||||
async deleteAccount() {
|
||||
await this.page.click('[data-test="delete-account-button"]');
|
||||
await this.page.fill('[data-test="delete-account-input-field"]', 'DELETE');
|
||||
await this.page.click('[data-test="confirm-delete-account-button"]');
|
||||
await expect(async () => {
|
||||
await this.page.click('[data-test="delete-account-button"]');
|
||||
await this.page.fill(
|
||||
'[data-test="delete-account-input-field"]',
|
||||
'DELETE',
|
||||
);
|
||||
await this.page.click('[data-test="confirm-delete-account-button"]');
|
||||
|
||||
const response = await this.page.waitForResponse((resp) => {
|
||||
return (
|
||||
resp.url().includes('home/settings') &&
|
||||
resp.request().method() === 'POST'
|
||||
);
|
||||
});
|
||||
|
||||
expect(response.status()).toBe(204);
|
||||
}).toPass();
|
||||
}
|
||||
|
||||
getProfileName() {
|
||||
return this.page.locator('[data-test="account-dropdown-display-name"]');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { expect, Page, test } from '@playwright/test';
|
||||
import { Page, expect, test } from '@playwright/test';
|
||||
|
||||
import { AccountPageObject } from './account.po';
|
||||
|
||||
test.describe('Account Settings', () => {
|
||||
@@ -28,12 +29,6 @@ test.describe('Account Settings', () => {
|
||||
const email = account.auth.createRandomEmail();
|
||||
|
||||
await account.updateEmail(email);
|
||||
|
||||
const req = await page.waitForResponse((resp) => {
|
||||
return resp.url().includes('auth/v1/user');
|
||||
});
|
||||
|
||||
expect(req.status()).toBe(200);
|
||||
});
|
||||
|
||||
test('user can update their password', async () => {
|
||||
@@ -57,11 +52,13 @@ test.describe('Account Deletion', () => {
|
||||
await account.deleteAccount();
|
||||
|
||||
const response = await page.waitForResponse((resp) => {
|
||||
return resp.url().includes('home/settings') &&
|
||||
resp.request().method() === 'POST';
|
||||
return (
|
||||
resp.url().includes('home/settings') &&
|
||||
resp.request().method() === 'POST'
|
||||
);
|
||||
});
|
||||
|
||||
// The server should respond with a 303 redirect
|
||||
expect(response.status()).toBe(303);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user