mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
Who sees and may use what was spread over three tabs: the feature switches and feature profiles sat in Settings / Visibility beside the logo and colours, and three settings (Security, Delete, Notifications) sat in Problems among the reports, where they had landed when the Features tab was removed. - Settings / Visibility is Appearance (how this WeKan looks); its Features and Feature profiles groups are panes of their own. One template renders all three by `part`, so every field and Save is unchanged. - Problems / Security, Delete and Notifications are Settings / Security, Delete and "Activities and notifications". Problems is Summary, Backup and the Reports. - Every old address redirects (MOVED_PANES / movedPanePath in models/lib/adminUrls.js, applied by config/router.js). - People, Teams and Organizations show the feature profile that applies, so a profile can be found from either side. - Two new labels, Appearance and Activities and notifications, are translated into every language. tests/adminPanelStructure.test.cjs and admin-panel-structure.e2e.js cover the order, the redirects and that no feature switch is left in Appearance or Problems; older guards and specs follow the new panes. Thanks to xet7 !
69 lines
3.5 KiB
JavaScript
69 lines
3.5 KiB
JavaScript
'use strict';
|
|
|
|
// #6736: Admin Panel / Settings / Visibility / Features hides a disabled
|
|
// feature from everyone's Board View menu, lets a pilot user keep seeing it,
|
|
// and is saved by the site admin from the Visibility pane.
|
|
const { test, expect } = require('../fixtures');
|
|
const db = require('../helpers/db');
|
|
const { loginWithToken, waitForMeteor, navigateInApp } = require('../helpers/auth');
|
|
const { FEATURE_KEYS } = require('../../../models/lib/instanceFeatures');
|
|
|
|
const setting = () => db.findOne('settings', {}, { _id: 1, featureStates: 1, featureApprovalRequired: 1,
|
|
featureKnownKeys: 1, featurePreviewAdmins: 1 });
|
|
const restore = saved => db.updateOne('settings', { _id: saved._id }, { $set: {
|
|
featureStates: saved.featureStates || {}, featureApprovalRequired: saved.featureApprovalRequired === true,
|
|
featureKnownKeys: saved.featureKnownKeys || [], featurePreviewAdmins: saved.featurePreviewAdmins === true } });
|
|
const openViewMenu = page => page.evaluate(() => Popup.open('boardChangeView')({
|
|
currentTarget: document.body, target: document.body, preventDefault() {}, stopPropagation() {} }));
|
|
|
|
test.describe('Instance features', () => {
|
|
test('a disabled feature is gone from the Board View menu, and a pilot user still sees it', async ({ boardPage: page, user }) => {
|
|
const saved = setting();
|
|
try {
|
|
db.updateOne('settings', { _id: saved._id }, { $set: { featureStates: { 'views-gantt': false } } });
|
|
await openViewMenu(page);
|
|
const popup = page.locator('.js-pop-over');
|
|
await expect(popup.locator('.js-open-table-view')).toBeVisible();
|
|
await expect(popup.locator('.js-open-gantt-view')).toHaveCount(0);
|
|
await expect(popup.locator('.js-open-gantt-frappe-view')).toHaveCount(0);
|
|
await page.evaluate(() => Popup.close());
|
|
|
|
// Negative: the same user as a pilot sees the feature again.
|
|
db.updateOne('users', { _id: user.id }, { $set: { featurePreview: true } });
|
|
await openViewMenu(page);
|
|
await expect(page.locator('.js-pop-over .js-open-gantt-view')).toBeVisible();
|
|
} finally {
|
|
db.updateOne('users', { _id: user.id }, { $unset: { featurePreview: '' } });
|
|
restore(saved);
|
|
}
|
|
});
|
|
|
|
test('the site admin saves the features from Visibility', async ({ page, adminUser }) => {
|
|
const saved = setting();
|
|
try {
|
|
await loginWithToken(page, adminUser.id, adminUser.token);
|
|
await navigateInApp(page, '/admin/settings/features');
|
|
await waitForMeteor(page);
|
|
const row = page.locator('.js-feature-row[data-feature="views-map"]');
|
|
await expect(row).toBeVisible();
|
|
// One row per catalog feature. The catalog grows as features are added
|
|
// (8 when this was written, 16 now), so count it rather than a literal.
|
|
await expect(page.locator('.js-feature-row')).toHaveCount(FEATURE_KEYS.length);
|
|
await row.locator('a.js-toggle-feature').click();
|
|
await page.locator('#feature-approval-required').click();
|
|
await page.locator('button.js-visibility-features-save').click();
|
|
await expect(page.locator('.js-visibility-features-status')).not.toBeEmpty();
|
|
await expect.poll(() => setting().featureStates?.['views-map']).toBe(false);
|
|
expect(setting().featureApprovalRequired).toBe(!saved.featureApprovalRequired);
|
|
} finally {
|
|
restore(saved);
|
|
}
|
|
});
|
|
|
|
test('an ordinary member does not see the Features group', async ({ loggedInPage: page }) => {
|
|
await navigateInApp(page, '/admin/settings/features');
|
|
await waitForMeteor(page);
|
|
await expect(page.locator('.js-feature-row')).toHaveCount(0);
|
|
});
|
|
});
|