Update test logs, adjust webhook timeout, and modify email handling
Improved the clarity of console logs within e2e tests for better debugging. Changed the timeout timing for webhook requests from 1000ms to 5000ms in the supabase seed.sql. The "deleteAfter" option of the visitConfirmEmailLink and getInviteEmail functions in the e2e tests has been set to "false" for email persistence.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { expect, Page } from '@playwright/test';
|
||||
import { Page } from '@playwright/test';
|
||||
import { AuthPageObject } from '../authentication/auth.po';
|
||||
import { TeamAccountsPageObject } from '../team-accounts/team-accounts.po';
|
||||
|
||||
@@ -30,6 +30,8 @@ export class InvitationsPageObject {
|
||||
continue;
|
||||
}
|
||||
|
||||
console.log(`Inviting ${invite.email} with role ${invite.role}...`)
|
||||
|
||||
const nth = index + 1;
|
||||
|
||||
await this.page.fill(`[data-test="invite-member-form-item"]:nth-child(${nth}) [data-test="invite-email-input"]`, invite.email);
|
||||
@@ -91,10 +93,12 @@ export class InvitationsPageObject {
|
||||
}
|
||||
|
||||
async acceptInvitation() {
|
||||
console.log('Accepting invitation...');
|
||||
|
||||
await this.page.locator('[data-test="join-team-form"] button[type="submit"]').click();
|
||||
|
||||
await this.page.waitForResponse(response => {
|
||||
return response.url().includes('/join') && response.request().method() === 'POST';
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ test.describe('Invitations', () => {
|
||||
await invitations.auth.signOut();
|
||||
|
||||
await invitations.auth.visitConfirmEmailLink(invites[0]!.email, {
|
||||
deleteAfter: true
|
||||
deleteAfter: false
|
||||
});
|
||||
|
||||
await invitations.auth.signUp({
|
||||
|
||||
@@ -12,7 +12,7 @@ export class Mailbox {
|
||||
}) {
|
||||
const mailbox = email.split('@')[0];
|
||||
|
||||
console.log(`Visiting mailbox ${mailbox} ...`)
|
||||
console.log(`Visiting mailbox ${email} ...`)
|
||||
|
||||
if (!mailbox) {
|
||||
throw new Error('Invalid email');
|
||||
@@ -33,7 +33,7 @@ export class Mailbox {
|
||||
throw new Error('No link found in email');
|
||||
}
|
||||
|
||||
console.log(`Visiting ${linkHref} ...`);
|
||||
console.log(`Visiting ${linkHref} from mailbox ${email}...`);
|
||||
|
||||
return this.page.goto(linkHref);
|
||||
}
|
||||
@@ -41,7 +41,7 @@ export class Mailbox {
|
||||
async getInviteEmail(
|
||||
mailbox: string,
|
||||
params = {
|
||||
deleteAfter: true
|
||||
deleteAfter: false,
|
||||
}
|
||||
) {
|
||||
const url = `http://localhost:54324/api/v1/mailbox/${mailbox}`;
|
||||
|
||||
@@ -10,29 +10,7 @@ execute function "supabase_functions"."http_request"(
|
||||
'POST',
|
||||
'{"Content-Type":"application/json", "X-Supabase-Event-Signature":"WEBHOOKSECRET"}',
|
||||
'{}',
|
||||
'1000'
|
||||
);
|
||||
|
||||
-- this webhook will be triggered after every insert on the accounts_memberships table
|
||||
create trigger "accounts_memberships_insert" after insert
|
||||
on "public"."accounts_memberships" for each row
|
||||
execute function "supabase_functions"."http_request"(
|
||||
'http://host.docker.internal:3000/api/db/webhook',
|
||||
'POST',
|
||||
'{"Content-Type":"application/json", "X-Supabase-Event-Signature":"WEBHOOKSECRET"}',
|
||||
'{}',
|
||||
'1000'
|
||||
);
|
||||
|
||||
-- this webhook will be triggered after every delete on the accounts_memberships table
|
||||
create trigger "accounts_memberships_delete" after delete
|
||||
on "public"."accounts_memberships" for each row
|
||||
execute function "supabase_functions"."http_request"(
|
||||
'http://host.docker.internal:3000/api/db/webhook',
|
||||
'POST',
|
||||
'{"Content-Type":"application/json", "X-Supabase-Event-Signature":"WEBHOOKSECRET"}',
|
||||
'{}',
|
||||
'1000'
|
||||
'5000'
|
||||
);
|
||||
|
||||
-- this webhook will be triggered after a delete on the subscriptions table
|
||||
@@ -44,7 +22,7 @@ execute function "supabase_functions"."http_request"(
|
||||
'POST',
|
||||
'{"Content-Type":"application/json", "X-Supabase-Event-Signature":"WEBHOOKSECRET"}',
|
||||
'{}',
|
||||
'1000'
|
||||
'5000'
|
||||
);
|
||||
|
||||
-- this webhook will be triggered after every insert on the invitations table
|
||||
@@ -56,5 +34,5 @@ execute function "supabase_functions"."http_request"(
|
||||
'POST',
|
||||
'{"Content-Type":"application/json", "X-Supabase-Event-Signature":"WEBHOOKSECRET"}',
|
||||
'{}',
|
||||
'1000'
|
||||
'5000'
|
||||
);
|
||||
Reference in New Issue
Block a user