mirror of https://github.com/docusealco/docuseal
parent
fd953d71fe
commit
a44531c6a7
@ -0,0 +1,33 @@
|
||||
<div class="space-y-2">
|
||||
<p class="text-4xl font-bold mb-4 mt-8"><%= t('ui_visibility') %></p>
|
||||
<% [
|
||||
[AccountConfig::SHOW_CONSOLE_LINK_KEY, t('show_console_link')],
|
||||
[AccountConfig::SHOW_API_LINK_KEY, t('show_api_link')],
|
||||
[AccountConfig::SHOW_TEST_MODE_KEY, t('show_test_mode')]
|
||||
].each do |key, label| %>
|
||||
<% env_var_name = "DOCUSEAL_CONFIG_#{key.upcase}" %>
|
||||
<% locked = ENV.fetch(env_var_name, nil).present? %>
|
||||
<% current = current_account.ui_visible?(key, default: true) %>
|
||||
<%= form_for(AccountConfig.new,
|
||||
url: settings_personalization_index_path,
|
||||
method: :post,
|
||||
html: { class: 'flex items-center justify-between py-1' }) do |f| %>
|
||||
<%= f.hidden_field :key, value: key %>
|
||||
<%= f.hidden_field :value, value: current ? 'false' : 'true' %>
|
||||
<label class="flex items-center space-x-3 flex-grow"
|
||||
<%= "title=\"#{t('locked_by_env')}\"".html_safe if locked %>>
|
||||
<submit-form data-on="change" class="flex">
|
||||
<input type="checkbox"
|
||||
class="toggle toggle-sm"
|
||||
<%= 'checked' if current %>
|
||||
<%= 'disabled' if locked %>
|
||||
onchange="this.form.submit()">
|
||||
</submit-form>
|
||||
<span class="text-base"><%= label %></span>
|
||||
<% if locked %>
|
||||
<span class="text-xs text-base-content/60">(<%= t('locked_by_env') %>)</span>
|
||||
<% end %>
|
||||
</label>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
@ -0,0 +1,43 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { loginAsAdmin } from './helpers/auth';
|
||||
|
||||
// Phase 0.3 — UI visibility preferences.
|
||||
// Toggle "Show Console Link" off and verify the console link disappears.
|
||||
|
||||
test.describe('UI visibility preferences', () => {
|
||||
test('toggling Show Console Link hides and shows the link', async ({ page }) => {
|
||||
await loginAsAdmin(page);
|
||||
await page.goto('/settings/personalization');
|
||||
|
||||
const consoleToggle = page.locator('form input[type="hidden"][value="show_console_link"]').locator('..')
|
||||
.locator('input[type="checkbox"]');
|
||||
await expect(consoleToggle).toBeVisible();
|
||||
|
||||
const initiallyChecked = await consoleToggle.isChecked();
|
||||
|
||||
// Toggle off
|
||||
if (initiallyChecked) {
|
||||
await consoleToggle.click();
|
||||
await page.waitForLoadState('networkidle');
|
||||
}
|
||||
|
||||
await page.goto('/');
|
||||
// Open user-menu dropdown
|
||||
await page.locator('.dropdown label').first().click();
|
||||
await expect(page.getByRole('link', { name: /console/i })).toHaveCount(0);
|
||||
|
||||
// Toggle back on
|
||||
await page.goto('/settings/personalization');
|
||||
const toggle2 = page.locator('form input[type="hidden"][value="show_console_link"]').locator('..')
|
||||
.locator('input[type="checkbox"]');
|
||||
if (!(await toggle2.isChecked())) {
|
||||
await toggle2.click();
|
||||
await page.waitForLoadState('networkidle');
|
||||
}
|
||||
|
||||
await page.goto('/settings/profile');
|
||||
// With Console link enabled and admin signed in, the Console link should appear
|
||||
// in the settings sidebar when not in multitenant mode.
|
||||
await expect(page.getByRole('link', { name: /console/i }).first()).toBeVisible();
|
||||
});
|
||||
});
|
||||
Loading…
Reference in new issue