💄(frontend) redirect home according to abilities
We try to detect the landing page according to user permissions (abilities) instead of just the configuration setting. This will be improved when the homepage is developed
This commit is contained in:
@@ -32,14 +32,40 @@ test.describe('Config', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('it checks that the config can deactivate the feature "teams"', async ({
|
||||
test('it checks that the user abilities display mail domains', async ({
|
||||
page,
|
||||
browserName,
|
||||
}) => {
|
||||
await page.goto('/');
|
||||
await keyCloakSignIn(page, browserName, 'mail-member');
|
||||
|
||||
await expect(page.locator('menu')).toBeHidden();
|
||||
|
||||
await expect(page.getByText('Mail Domains')).toBeVisible();
|
||||
});
|
||||
|
||||
test('it checks that the user abilities display teams', async ({
|
||||
page,
|
||||
browserName,
|
||||
}) => {
|
||||
await page.goto('/');
|
||||
// Login with a user who has the visibility on the groups
|
||||
await keyCloakSignIn(page, browserName, 'team-member');
|
||||
|
||||
await expect(page.locator('menu')).toBeHidden();
|
||||
|
||||
await expect(page.getByText('Groups')).toBeVisible();
|
||||
});
|
||||
|
||||
test('it checks that the config does not deactivate the feature "teams"', async ({
|
||||
page,
|
||||
browserName,
|
||||
}) => {
|
||||
await page.goto('/');
|
||||
// Login with a user who has the visibility on the groups should see groups
|
||||
// It's now the backend that decides if the user can see the group menu and they
|
||||
// should be redirected to the groups page in such case
|
||||
await keyCloakSignIn(page, browserName, 'team-administrator');
|
||||
|
||||
await page.route('**/api/v1.0/config/', async (route) => {
|
||||
const request = route.request();
|
||||
if (request.method().includes('GET')) {
|
||||
@@ -59,12 +85,6 @@ test.describe('Config', () => {
|
||||
|
||||
await expect(page.locator('menu')).toBeHidden();
|
||||
|
||||
await expect(
|
||||
page.getByRole('button', {
|
||||
name: 'Create a new team',
|
||||
}),
|
||||
).toBeHidden();
|
||||
|
||||
await expect(page.getByText('Mail Domains')).toBeVisible();
|
||||
await expect(page.getByText('Groups')).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -75,7 +75,11 @@ test.describe('Mail domains', () => {
|
||||
test.describe('checks all the elements are visible', () => {
|
||||
test.beforeEach(async ({ page, browserName }) => {
|
||||
await page.goto('/');
|
||||
await keyCloakSignIn(page, browserName, 'mail-member');
|
||||
// The user is a team administrator, so they land on the team page
|
||||
// This allows to prevent the redirection to the mail domains page
|
||||
// to make the '/api/v1.0/mail-domains/?page=1&ordering=created_at'
|
||||
// query at login, which will be cached and not called afterward in tests.
|
||||
await keyCloakSignIn(page, browserName, 'team-administrator-mail-member');
|
||||
});
|
||||
|
||||
test('checks the sort button', async ({ page }) => {
|
||||
|
||||
Reference in New Issue
Block a user