Split full flow test

This commit is contained in:
giancarlo
2024-04-14 14:01:44 +08:00
parent 91bee99857
commit 1321b31ae4

View File

@@ -12,51 +12,6 @@ test.describe('Invitations', () => {
await invitations.setup();
});
test('Full invite flow', async () => {
await invitations.navigateToMembers();
await invitations.openInviteForm();
const invites = [
{
email: invitations.auth.createRandomEmail(),
role: 'member'
},
{
email: invitations.auth.createRandomEmail(),
role: 'member'
},
];
await invitations.inviteMembers(invites);
const firstEmail = invites[0]!.email;
await expect(await invitations.getInvitations()).toHaveCount(2)
// sign out and sign in with the first email
await invitations.auth.signOut();
await invitations.auth.visitConfirmEmailLink(invites[0]!.email);
console.log(`Signing up with ${firstEmail}`);
await invitations.auth.signUp({
email: firstEmail,
password: 'password',
repeatPassword: 'password'
});
await invitations.auth.visitConfirmEmailLink(firstEmail);
console.log(`Accepting invitation as ${firstEmail}`);
await invitations.acceptInvitation();
await invitations.teamAccounts.openAccountsSelector();
await expect(await invitations.teamAccounts.getTeams()).toHaveCount(1);
});
test('users can delete invites', async () => {
await invitations.navigateToMembers();
await invitations.openInviteForm();
@@ -103,3 +58,60 @@ test.describe('Invitations', () => {
await expect(row.locator('[data-test="member-role-badge"]')).toHaveText('owner');
});
});
test.describe('Full Invitation Flow', () => {
let page: Page;
let invitations: InvitationsPageObject;
test.beforeAll(async ({ browser }) => {
page = await browser.newPage();
invitations = new InvitationsPageObject(page);
await invitations.setup();
});
test('should invite users and let users accept an invite', async () => {
await invitations.navigateToMembers();
await invitations.openInviteForm();
const invites = [
{
email: invitations.auth.createRandomEmail(),
role: 'member'
},
{
email: invitations.auth.createRandomEmail(),
role: 'member'
},
];
await invitations.inviteMembers(invites);
const firstEmail = invites[0]!.email;
await expect(await invitations.getInvitations()).toHaveCount(2)
// sign out and sign in with the first email
await invitations.auth.signOut();
await invitations.auth.visitConfirmEmailLink(invites[0]!.email);
console.log(`Signing up with ${firstEmail}`);
await invitations.auth.signUp({
email: firstEmail,
password: 'password',
repeatPassword: 'password'
});
await invitations.auth.visitConfirmEmailLink(firstEmail);
console.log(`Accepting invitation as ${firstEmail}`);
await invitations.acceptInvitation();
await invitations.teamAccounts.openAccountsSelector();
await expect(await invitations.teamAccounts.getTeams()).toHaveCount(1);
});
});