mirror of
https://github.com/documenso/documenso.git
synced 2025-11-15 01:01:49 +10:00
feat: add organisations (#1820)
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { type Page, expect, test } from '@playwright/test';
|
||||
|
||||
import { alphaid } from '@documenso/lib/universal/id';
|
||||
import { prisma } from '@documenso/prisma';
|
||||
import {
|
||||
extractUserVerificationToken,
|
||||
seedTestEmail,
|
||||
@ -23,17 +23,26 @@ test('[USER] can sign up with email and password', async ({ page }: { page: Page
|
||||
|
||||
await signSignaturePad(page);
|
||||
|
||||
await page.getByRole('button', { name: 'Next', exact: true }).click();
|
||||
|
||||
await page.getByLabel('Public profile username').fill(alphaid(10));
|
||||
await page.getByLabel('Public profile username').blur();
|
||||
|
||||
await page.getByRole('button', { name: 'Complete' }).click();
|
||||
await page.getByRole('button', { name: 'Complete', exact: true }).click();
|
||||
|
||||
await page.waitForURL('/unverified-account');
|
||||
|
||||
const { token } = await extractUserVerificationToken(email);
|
||||
|
||||
const team = await prisma.team.findFirstOrThrow({
|
||||
where: {
|
||||
organisation: {
|
||||
members: {
|
||||
some: {
|
||||
user: {
|
||||
email,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await page.goto(`/verify-email/${token}`);
|
||||
|
||||
await expect(page.getByRole('heading')).toContainText('Email Confirmed!');
|
||||
@ -41,19 +50,19 @@ test('[USER] can sign up with email and password', async ({ page }: { page: Page
|
||||
// We now automatically redirect to the home page
|
||||
await page.getByRole('link', { name: 'Continue' }).click();
|
||||
|
||||
await page.waitForURL('/documents');
|
||||
|
||||
await expect(page).toHaveURL('/documents');
|
||||
// Expect to be redirected to their only team.
|
||||
await page.waitForURL(`/t/${team.url}/documents`);
|
||||
await expect(page).toHaveURL(`/t/${team.url}/documents`);
|
||||
});
|
||||
|
||||
test('[USER] can sign in using email and password', async ({ page }: { page: Page }) => {
|
||||
const user = await seedUser();
|
||||
const { user, team } = await seedUser();
|
||||
|
||||
await page.goto('/signin');
|
||||
await page.getByLabel('Email').fill(user.email);
|
||||
await page.getByLabel('Password', { exact: true }).fill('password');
|
||||
await page.getByRole('button', { name: 'Sign In' }).click();
|
||||
|
||||
await page.waitForURL('/documents');
|
||||
await expect(page).toHaveURL('/documents');
|
||||
await page.waitForURL(`/t/${team.url}/documents`);
|
||||
await expect(page).toHaveURL(`/t/${team.url}/documents`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user