mirror of https://github.com/docusealco/docuseal
parent
1b6aa56757
commit
2afbabed16
@ -0,0 +1,8 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class AddVisibilityToTemplates < ActiveRecord::Migration[7.2]
|
||||||
|
def change
|
||||||
|
add_column :templates, :visibility, :string, default: 'private', null: false
|
||||||
|
add_index :templates, %i[account_id visibility]
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
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();
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
Reference in new issue