Refactor code and improve error handling in authentication methods

This commit contains several changes including the removal of an unused onClick event handler in remove-member-dialog.tsx. It also includes an update to the POST handler in the Webhook route of the database API where the authentication property has been updated. Lastly, it also brings improvements in error handling and logging in various areas, such as e2e authentication tests and the mailbox utility.
This commit is contained in:
giancarlo
2024-05-03 23:56:23 +07:00
parent e159c52d41
commit 08c86102d8
5 changed files with 62 additions and 45 deletions

View File

@@ -1,4 +1,5 @@
import { expect, Page } from '@playwright/test';
import { Page, expect } from '@playwright/test';
import { Mailbox } from '../utils/mailbox';
export class AuthPageObject {
@@ -23,10 +24,7 @@ export class AuthPageObject {
await this.page.click('[data-test="account-dropdown-sign-out"]');
}
async signIn(params: {
email: string,
password: string
}) {
async signIn(params: { email: string; password: string }) {
await this.page.waitForTimeout(1000);
await this.page.fill('input[name="email"]', params.email);
@@ -35,9 +33,9 @@ export class AuthPageObject {
}
async signUp(params: {
email: string,
password: string,
repeatPassword: string
email: string;
password: string;
repeatPassword: string;
}) {
await this.page.waitForTimeout(1000);
@@ -48,14 +46,19 @@ export class AuthPageObject {
await this.page.click('button[type="submit"]');
}
async visitConfirmEmailLink(email: string, params: {
deleteAfter: boolean
} = {
deleteAfter: true
}) {
return expect(async() => {
async visitConfirmEmailLink(
email: string,
params: {
deleteAfter: boolean;
} = {
deleteAfter: true,
},
) {
return expect(async () => {
const res = await this.mailbox.visitMailbox(email, params);
console.log(res);
expect(res).not.toBeNull();
}).toPass();
}
@@ -79,4 +82,4 @@ export class AuthPageObject {
await this.visitConfirmEmailLink(email);
}
}
}