The join page's redirect functionality has been replaced with permanentRedirect. Adjustments were also made for handling conditional authentication and user account verification. Package upgrades were performed and the i18n client now checks if an instance is already initialized. The process tends to deliver performance benefits and enhancing the code readability.
106 lines
2.6 KiB
TypeScript
106 lines
2.6 KiB
TypeScript
import { expect, Page, test } from '@playwright/test';
|
|
import { InvitationsPageObject } from './invitations.po';
|
|
|
|
test.describe('Invitations', () => {
|
|
let page: Page;
|
|
let invitations: InvitationsPageObject;
|
|
|
|
test.beforeAll(async ({ browser }) => {
|
|
page = await browser.newPage();
|
|
invitations = new InvitationsPageObject(page);
|
|
|
|
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();
|
|
|
|
const email = invitations.auth.createRandomEmail();
|
|
|
|
const invites = [
|
|
{
|
|
email,
|
|
role: 'member'
|
|
},
|
|
];
|
|
|
|
await invitations.inviteMembers(invites);
|
|
|
|
await expect(await invitations.getInvitations()).toHaveCount(1);
|
|
|
|
await invitations.deleteInvitation(email);
|
|
|
|
await expect(await invitations.getInvitations()).toHaveCount(0);
|
|
});
|
|
|
|
test('users can update invites', async () => {
|
|
await invitations.navigateToMembers();
|
|
await invitations.openInviteForm();
|
|
|
|
const email = invitations.auth.createRandomEmail();
|
|
|
|
const invites = [
|
|
{
|
|
email,
|
|
role: 'member'
|
|
},
|
|
];
|
|
|
|
await invitations.inviteMembers(invites);
|
|
|
|
await expect(await invitations.getInvitations()).toHaveCount(1);
|
|
|
|
await invitations.updateInvitation(email, 'owner');
|
|
|
|
const row = invitations.getInvitationRow(email);
|
|
|
|
await expect(row.locator('[data-test="member-role-badge"]')).toHaveText('owner');
|
|
});
|
|
});
|