fb7bf6d01e
refs https://github.com/TryGhost/Product/issues/3832 --- <!-- Leave the line below if you'd like GitHub Copilot to generate a summary from your commit --> <!-- copilot:summary --> ### <samp>🤖 Generated by Copilot at 7eda74c</samp> This pull request improves the validation, customization, and feedback of various form components and modals in the admin-x-settings app. It also adds new components for user detail modal sections and modifies the user type to allow null values for social accounts. Additionally, it adds `dirty` props to some integration modals and a `data-testid` attribute to the exit settings button. It also deletes an unused file.
51 lines
2.0 KiB
TypeScript
51 lines
2.0 KiB
TypeScript
import {expect, test} from '@playwright/test';
|
|
import {globalDataRequests, meWithRole, mockApi, responseFixtures} from '../utils/acceptance';
|
|
|
|
test.describe('User permissions', async () => {
|
|
test('Editors can only see users', async ({page}) => {
|
|
await mockApi({page, requests: {
|
|
...globalDataRequests,
|
|
browseMe: {...globalDataRequests.browseMe, response: meWithRole('Editor')},
|
|
browseUsers: {method: 'GET', path: '/users/?limit=100&include=roles', response: responseFixtures.users}
|
|
}});
|
|
|
|
await page.goto('/');
|
|
|
|
await expect(page.getByTestId('users')).toBeVisible();
|
|
await expect(page.getByTestId('sidebar')).toBeHidden();
|
|
await expect(page.getByTestId('title-and-description')).toBeHidden();
|
|
});
|
|
|
|
test('Authors can only see their own profile', async ({page}) => {
|
|
await mockApi({page, requests: {
|
|
...globalDataRequests,
|
|
browseMe: {...globalDataRequests.browseMe, response: meWithRole('Author')}
|
|
}});
|
|
|
|
await page.goto('/');
|
|
|
|
await expect(page.getByTestId('user-detail-modal')).toBeVisible();
|
|
await expect(page.getByTestId('sidebar')).toBeHidden();
|
|
await expect(page.getByTestId('users')).toBeHidden();
|
|
await expect(page.getByTestId('title-and-description')).toBeHidden();
|
|
|
|
expect(page.url()).toMatch(/\/owner$/);
|
|
});
|
|
|
|
test('Contributors can only see their own profile', async ({page}) => {
|
|
await mockApi({page, requests: {
|
|
...globalDataRequests,
|
|
browseMe: {...globalDataRequests.browseMe, response: meWithRole('Contributor')}
|
|
}});
|
|
|
|
await page.goto('/');
|
|
|
|
await expect(page.getByTestId('user-detail-modal')).toBeVisible();
|
|
await expect(page.getByTestId('sidebar')).toBeHidden();
|
|
await expect(page.getByTestId('users')).toBeHidden();
|
|
await expect(page.getByTestId('title-and-description')).toBeHidden();
|
|
|
|
expect(page.url()).toMatch(/\/owner$/);
|
|
});
|
|
});
|