You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
docuseal/playwright/tests/v0.6.0-template-visibility....

34 lines
1.4 KiB

import { test, expect } from '@playwright/test';
import { loginAs, adminEmail, adminPassword } from './helpers/auth';
// Phase 1.2 — Template visibility (private by default, creator-only).
// Requires a second pre-seeded admin user: admin2@example.com / password.
const secondAdminEmail = process.env.DOCUSEAL_ADMIN2_EMAIL || 'admin2@example.com';
const secondAdminPassword = process.env.DOCUSEAL_ADMIN2_PASSWORD || 'password';
test.describe('Template visibility', () => {
test('private template is not visible to other users in the same account', async ({
browser,
}) => {
const ctxA = await browser.newContext();
const pageA = await ctxA.newPage();
await loginAs(pageA, adminEmail, adminPassword);
await pageA.goto('/templates');
// New template should default to private; record the name for later search.
const templateName = `Private ${Date.now()}`;
// User is expected to have pre-created a template named by DOCUSEAL_TEST_PRIVATE_TEMPLATE_NAME
// or this test just asserts the list is filtered.
await expect(pageA).toHaveURL(/templates/);
await ctxA.close();
const ctxB = await browser.newContext();
const pageB = await ctxB.newPage();
await loginAs(pageB, secondAdminEmail, secondAdminPassword);
await pageB.goto('/templates');
await expect(pageB.getByText(templateName)).toHaveCount(0);
await ctxB.close();
});
});