mirror of
https://github.com/hanzoai/sign.git
synced 2026-11-02 23:26:15 +00:00
The product is branded Hanzo eSign (esign.hanzo.ai, repo hanzoai/esign). Rename all workspace packages @hanzo/sign-* → @hanzo/esign-* (1052 files) and align docker/Dockerfile turbo --scope/--filter to the actual remix package name @hanzo/esign (was a pre-existing mismatch with -remix that broke the build). Protected deps (@hanzo/insights, @hanzo/logo) untouched.
89 lines
2.8 KiB
TypeScript
89 lines
2.8 KiB
TypeScript
import { expect, test } from '@playwright/test';
|
|
|
|
import { NEXT_PUBLIC_WEBAPP_URL } from '@hanzo/esign-lib/constants/app';
|
|
import { seedTeamEmailVerification } from '@hanzo/esign-prisma/seed/teams';
|
|
import { seedUser } from '@hanzo/esign-prisma/seed/users';
|
|
|
|
import { apiSignin } from '../fixtures/authentication';
|
|
import { openDropdownMenu } from '../fixtures/generic';
|
|
|
|
test('[TEAMS]: send team email request', async ({ page }) => {
|
|
const { user, team } = await seedUser();
|
|
|
|
await apiSignin({
|
|
page,
|
|
email: user.email,
|
|
password: 'password',
|
|
redirectPath: `/t/${team.url}/settings`,
|
|
});
|
|
|
|
await page.getByRole('button', { name: 'Add email' }).click();
|
|
await page.getByPlaceholder('eg. Legal').click();
|
|
await page.getByPlaceholder('eg. Legal').fill('[email protected]');
|
|
await page.getByPlaceholder('[email protected]').click();
|
|
await page.getByPlaceholder('[email protected]').fill('[email protected]');
|
|
await page.getByRole('button', { name: 'Add' }).click();
|
|
|
|
await expect(
|
|
page
|
|
.getByRole('status')
|
|
.filter({ hasText: 'We have sent a confirmation email for verification.' })
|
|
.first(),
|
|
).toBeVisible();
|
|
});
|
|
|
|
test('[TEAMS]: accept team email request', async ({ page }) => {
|
|
const { user, team } = await seedUser();
|
|
|
|
const teamEmailVerification = await seedTeamEmailVerification({
|
|
email: `team-email-verification--${team.url}@test.esign.hanzo.ai`,
|
|
teamId: team.id,
|
|
});
|
|
|
|
await page.goto(`${NEXT_PUBLIC_WEBAPP_URL()}/team/verify/email/${teamEmailVerification.token}`);
|
|
await expect(page.getByRole('heading')).toContainText('Team email verified!');
|
|
});
|
|
|
|
test('[TEAMS]: delete team email', async ({ page }) => {
|
|
const { user, team } = await seedUser({
|
|
setTeamEmailAsOwner: true,
|
|
});
|
|
|
|
await apiSignin({
|
|
page,
|
|
email: user.email,
|
|
redirectPath: `/t/${team.url}/settings`,
|
|
});
|
|
|
|
const settingsBtn = page
|
|
.locator('section div')
|
|
.filter({ hasText: 'Team email' })
|
|
.getByRole('button');
|
|
await openDropdownMenu(page, settingsBtn);
|
|
|
|
await expect(page.getByRole('menuitem', { name: 'Remove' })).toBeVisible();
|
|
await page.getByRole('menuitem', { name: 'Remove' }).click();
|
|
await page.getByRole('button', { name: 'Remove' }).click();
|
|
|
|
await expect(page.getByText('Team email has been removed').first()).toBeVisible();
|
|
});
|
|
|
|
test('[TEAMS]: team email owner removes access', async ({ page }) => {
|
|
const teamEmailOwner = await seedUser();
|
|
|
|
const { user: secondUser } = await seedUser({
|
|
teamEmail: teamEmailOwner.user.email,
|
|
});
|
|
|
|
await apiSignin({
|
|
page,
|
|
email: teamEmailOwner.user.email,
|
|
redirectPath: `/settings/profile`,
|
|
});
|
|
|
|
await page.getByRole('button', { name: 'Revoke access' }).click();
|
|
await page.getByRole('button', { name: 'Revoke' }).click();
|
|
|
|
await expect(page.getByText('You have successfully revoked').first()).toBeVisible();
|
|
});
|