2024-09-06 18:03:19 +02:00
|
|
|
import { expect, test } from '@playwright/test';
|
|
|
|
|
|
2025-02-03 11:02:29 +01:00
|
|
|
import {
|
2025-06-25 11:21:32 +02:00
|
|
|
BROWSERS,
|
2025-02-03 11:02:29 +01:00
|
|
|
createDoc,
|
|
|
|
|
expectLoginPage,
|
|
|
|
|
keyCloakSignIn,
|
|
|
|
|
verifyDocName,
|
2025-07-16 13:56:18 +02:00
|
|
|
} from './utils-common';
|
|
|
|
|
import { createRootSubPage } from './utils-sub-pages';
|
2024-09-06 18:03:19 +02:00
|
|
|
|
|
|
|
|
test.describe('Doc Visibility', () => {
|
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
|
|
|
await page.goto('/');
|
|
|
|
|
});
|
|
|
|
|
|
2024-10-23 11:11:29 +02:00
|
|
|
test('It checks the copy link button', async ({ page, browserName }) => {
|
|
|
|
|
test.skip(
|
|
|
|
|
browserName === 'webkit',
|
|
|
|
|
'navigator.clipboard is not working with webkit and playwright',
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await createDoc(page, 'My button copy doc', browserName, 1);
|
|
|
|
|
|
|
|
|
|
await page.getByRole('button', { name: 'Share' }).click();
|
|
|
|
|
await page.getByRole('button', { name: 'Copy link' }).click();
|
|
|
|
|
|
|
|
|
|
await expect(page.getByText('Link Copied !')).toBeVisible();
|
|
|
|
|
|
|
|
|
|
const handle = await page.evaluateHandle(() =>
|
|
|
|
|
navigator.clipboard.readText(),
|
|
|
|
|
);
|
|
|
|
|
const clipboardContent = await handle.jsonValue();
|
|
|
|
|
|
|
|
|
|
expect(clipboardContent).toMatch(page.url());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('It checks the link role options', async ({ page, browserName }) => {
|
|
|
|
|
await createDoc(page, 'Doc role options', browserName, 1);
|
|
|
|
|
|
|
|
|
|
await page.getByRole('button', { name: 'Share' }).click();
|
|
|
|
|
|
2025-08-07 11:54:32 +02:00
|
|
|
const selectVisibility = page.getByTestId('doc-visibility');
|
2024-10-23 11:11:29 +02:00
|
|
|
|
2024-12-16 10:21:28 +01:00
|
|
|
await expect(selectVisibility.getByText('Private')).toBeVisible();
|
2024-10-23 11:11:29 +02:00
|
|
|
|
2024-10-25 14:16:29 +02:00
|
|
|
await expect(page.getByLabel('Read only')).toBeHidden();
|
|
|
|
|
await expect(page.getByLabel('Can read and edit')).toBeHidden();
|
2024-10-23 11:11:29 +02:00
|
|
|
|
|
|
|
|
await selectVisibility.click();
|
2025-02-25 15:44:33 +01:00
|
|
|
await page.getByLabel('Connected').click();
|
2024-10-23 11:11:29 +02:00
|
|
|
|
2025-08-07 11:54:32 +02:00
|
|
|
await expect(page.getByTestId('doc-access-mode')).toBeVisible();
|
2024-10-23 11:11:29 +02:00
|
|
|
|
|
|
|
|
await selectVisibility.click();
|
|
|
|
|
|
2025-02-25 15:44:33 +01:00
|
|
|
await page.getByLabel('Public', { exact: true }).click();
|
2024-10-23 11:11:29 +02:00
|
|
|
|
2025-08-07 11:54:32 +02:00
|
|
|
await expect(page.getByTestId('doc-access-mode')).toBeVisible();
|
2024-10-23 11:11:29 +02:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.describe('Doc Visibility: Restricted', () => {
|
|
|
|
|
test.use({ storageState: { cookies: [], origins: [] } });
|
|
|
|
|
|
2025-01-29 11:22:34 +01:00
|
|
|
test('A doc is not accessible when not authentified.', async ({
|
|
|
|
|
page,
|
|
|
|
|
browserName,
|
|
|
|
|
}) => {
|
2024-10-23 11:11:29 +02:00
|
|
|
await page.goto('/');
|
|
|
|
|
await keyCloakSignIn(page, browserName);
|
|
|
|
|
|
2025-01-29 11:22:34 +01:00
|
|
|
const [docTitle] = await createDoc(
|
|
|
|
|
page,
|
|
|
|
|
'Restricted no auth',
|
|
|
|
|
browserName,
|
|
|
|
|
1,
|
|
|
|
|
);
|
2024-09-06 18:03:19 +02:00
|
|
|
|
2024-11-25 12:10:16 +01:00
|
|
|
await verifyDocName(page, docTitle);
|
2024-09-06 18:03:19 +02:00
|
|
|
|
2024-10-23 11:11:29 +02:00
|
|
|
const urlDoc = page.url();
|
|
|
|
|
|
|
|
|
|
await page
|
|
|
|
|
.getByRole('button', {
|
|
|
|
|
name: 'Logout',
|
|
|
|
|
})
|
|
|
|
|
.click();
|
|
|
|
|
|
2025-02-03 11:02:29 +01:00
|
|
|
await expectLoginPage(page);
|
2024-10-23 11:11:29 +02:00
|
|
|
|
|
|
|
|
await page.goto(urlDoc);
|
|
|
|
|
|
2025-02-17 13:05:20 +01:00
|
|
|
await expect(
|
|
|
|
|
page.getByText('Log in to access the document.'),
|
|
|
|
|
).toBeVisible();
|
2024-10-23 11:11:29 +02:00
|
|
|
});
|
|
|
|
|
|
2025-01-29 11:22:34 +01:00
|
|
|
test('A doc is not accessible when authentified but not member.', async ({
|
2024-10-23 11:11:29 +02:00
|
|
|
page,
|
|
|
|
|
browserName,
|
|
|
|
|
}) => {
|
2025-03-25 13:01:48 +01:00
|
|
|
test.slow();
|
|
|
|
|
|
2024-10-23 11:11:29 +02:00
|
|
|
await page.goto('/');
|
|
|
|
|
await keyCloakSignIn(page, browserName);
|
|
|
|
|
|
2025-01-29 11:22:34 +01:00
|
|
|
const [docTitle] = await createDoc(page, 'Restricted auth', browserName, 1);
|
2024-09-06 18:03:19 +02:00
|
|
|
|
2024-11-25 12:10:16 +01:00
|
|
|
await verifyDocName(page, docTitle);
|
2024-10-23 11:11:29 +02:00
|
|
|
|
|
|
|
|
const urlDoc = page.url();
|
|
|
|
|
|
|
|
|
|
await page
|
|
|
|
|
.getByRole('button', {
|
|
|
|
|
name: 'Logout',
|
|
|
|
|
})
|
|
|
|
|
.click();
|
|
|
|
|
|
2025-06-25 11:21:32 +02:00
|
|
|
const otherBrowser = BROWSERS.find((b) => b !== browserName);
|
2025-08-07 16:59:08 +02:00
|
|
|
if (!otherBrowser) {
|
|
|
|
|
throw new Error('No alternative browser found');
|
|
|
|
|
}
|
2025-01-29 11:22:34 +01:00
|
|
|
|
2025-08-07 16:59:08 +02:00
|
|
|
await keyCloakSignIn(page, otherBrowser);
|
2024-10-23 11:11:29 +02:00
|
|
|
|
2025-08-01 10:12:16 +02:00
|
|
|
await expect(page.getByTestId('header-logo-link')).toBeVisible({
|
2025-06-25 11:21:32 +02:00
|
|
|
timeout: 10000,
|
|
|
|
|
});
|
2025-02-03 11:02:29 +01:00
|
|
|
|
2024-10-23 11:11:29 +02:00
|
|
|
await page.goto(urlDoc);
|
|
|
|
|
|
2025-01-29 11:22:34 +01:00
|
|
|
await expect(
|
2025-06-25 11:21:32 +02:00
|
|
|
page.getByText('Insufficient access rights to view the document.'),
|
2025-03-25 13:01:48 +01:00
|
|
|
).toBeVisible({
|
|
|
|
|
timeout: 10000,
|
|
|
|
|
});
|
2024-09-06 18:03:19 +02:00
|
|
|
});
|
2024-09-06 18:03:30 +02:00
|
|
|
|
2025-01-29 11:22:34 +01:00
|
|
|
test('A doc is accessible when member.', async ({ page, browserName }) => {
|
|
|
|
|
test.slow();
|
2024-10-23 11:11:29 +02:00
|
|
|
await page.goto('/');
|
|
|
|
|
await keyCloakSignIn(page, browserName);
|
2024-09-06 18:03:30 +02:00
|
|
|
|
2024-10-23 11:11:29 +02:00
|
|
|
const [docTitle] = await createDoc(page, 'Restricted auth', browserName, 1);
|
|
|
|
|
|
2024-11-25 12:10:16 +01:00
|
|
|
await verifyDocName(page, docTitle);
|
2024-09-06 18:03:30 +02:00
|
|
|
|
2025-01-29 11:22:34 +01:00
|
|
|
await page.getByRole('button', { name: 'Share' }).click();
|
|
|
|
|
|
|
|
|
|
const inputSearch = page.getByRole('combobox', {
|
|
|
|
|
name: 'Quick search input',
|
|
|
|
|
});
|
|
|
|
|
|
2025-06-25 11:21:32 +02:00
|
|
|
const otherBrowser = BROWSERS.find((b) => b !== browserName);
|
2025-08-07 16:59:08 +02:00
|
|
|
if (!otherBrowser) {
|
|
|
|
|
throw new Error('No alternative browser found');
|
|
|
|
|
}
|
2025-06-17 12:17:22 +02:00
|
|
|
const username = `user@${otherBrowser}.test`;
|
2025-01-29 11:22:34 +01:00
|
|
|
await inputSearch.fill(username);
|
|
|
|
|
await page.getByRole('option', { name: username }).click();
|
|
|
|
|
|
|
|
|
|
// Choose a role
|
|
|
|
|
const container = page.getByTestId('doc-share-add-member-list');
|
|
|
|
|
await container.getByLabel('doc-role-dropdown').click();
|
2025-03-14 14:27:56 +01:00
|
|
|
await page.getByLabel('Reader').click();
|
2025-01-29 11:22:34 +01:00
|
|
|
|
|
|
|
|
await page.getByRole('button', { name: 'Invite' }).click();
|
|
|
|
|
|
|
|
|
|
await page.locator('.c__modal__backdrop').click({
|
|
|
|
|
position: { x: 0, y: 0 },
|
|
|
|
|
});
|
|
|
|
|
|
2024-10-23 11:11:29 +02:00
|
|
|
const urlDoc = page.url();
|
|
|
|
|
|
|
|
|
|
await page
|
|
|
|
|
.getByRole('button', {
|
|
|
|
|
name: 'Logout',
|
|
|
|
|
})
|
|
|
|
|
.click();
|
|
|
|
|
|
2025-08-07 16:59:08 +02:00
|
|
|
await keyCloakSignIn(page, otherBrowser);
|
2024-10-23 11:11:29 +02:00
|
|
|
|
2025-08-01 10:12:16 +02:00
|
|
|
await expect(page.getByTestId('header-logo-link')).toBeVisible();
|
2024-10-23 11:11:29 +02:00
|
|
|
|
2025-02-03 11:02:29 +01:00
|
|
|
await page.goto(urlDoc);
|
2025-01-29 14:06:38 +01:00
|
|
|
|
2025-01-29 11:22:34 +01:00
|
|
|
await verifyDocName(page, docTitle);
|
|
|
|
|
await expect(page.getByLabel('Share button')).toBeVisible();
|
2024-09-06 18:03:30 +02:00
|
|
|
});
|
2024-09-06 18:03:19 +02:00
|
|
|
});
|
|
|
|
|
|
2024-10-23 11:11:29 +02:00
|
|
|
test.describe('Doc Visibility: Public', () => {
|
2024-09-06 18:03:19 +02:00
|
|
|
test.use({ storageState: { cookies: [], origins: [] } });
|
|
|
|
|
|
2024-10-23 11:11:29 +02:00
|
|
|
test('It checks a public doc in read only mode', async ({
|
2024-09-06 18:03:19 +02:00
|
|
|
page,
|
|
|
|
|
browserName,
|
|
|
|
|
}) => {
|
|
|
|
|
await page.goto('/');
|
|
|
|
|
await keyCloakSignIn(page, browserName);
|
|
|
|
|
|
|
|
|
|
const [docTitle] = await createDoc(
|
|
|
|
|
page,
|
2024-10-23 11:11:29 +02:00
|
|
|
'Public read only',
|
2024-09-06 18:03:19 +02:00
|
|
|
browserName,
|
|
|
|
|
1,
|
|
|
|
|
);
|
|
|
|
|
|
2024-11-25 12:10:16 +01:00
|
|
|
await verifyDocName(page, docTitle);
|
2024-10-23 11:11:29 +02:00
|
|
|
|
|
|
|
|
await page.getByRole('button', { name: 'Share' }).click();
|
2025-08-07 11:54:32 +02:00
|
|
|
const selectVisibility = page.getByTestId('doc-visibility');
|
2024-12-16 10:21:28 +01:00
|
|
|
await selectVisibility.click();
|
2024-10-23 11:11:29 +02:00
|
|
|
|
|
|
|
|
await page
|
2025-02-18 12:12:41 +01:00
|
|
|
.getByRole('menuitem', {
|
2024-10-23 11:11:29 +02:00
|
|
|
name: 'Public',
|
|
|
|
|
})
|
|
|
|
|
.click();
|
|
|
|
|
|
2024-09-06 18:03:19 +02:00
|
|
|
await expect(
|
2024-10-23 11:11:29 +02:00
|
|
|
page.getByText('The document visibility has been updated.'),
|
|
|
|
|
).toBeVisible();
|
|
|
|
|
|
2025-08-07 11:54:32 +02:00
|
|
|
await expect(page.getByTestId('doc-access-mode')).toBeVisible();
|
|
|
|
|
await page.getByTestId('doc-access-mode').click();
|
2024-12-16 10:21:28 +01:00
|
|
|
await page
|
2025-02-18 12:12:41 +01:00
|
|
|
.getByRole('menuitem', {
|
2024-12-16 10:21:28 +01:00
|
|
|
name: 'Reading',
|
|
|
|
|
})
|
|
|
|
|
.click();
|
2024-10-23 11:11:29 +02:00
|
|
|
|
|
|
|
|
await expect(
|
|
|
|
|
page.getByText('The document visibility has been updated.').first(),
|
|
|
|
|
).toBeVisible();
|
|
|
|
|
|
2024-12-16 10:21:28 +01:00
|
|
|
await page.getByRole('button', { name: 'close' }).click();
|
2024-10-23 11:11:29 +02:00
|
|
|
|
2024-11-25 12:10:16 +01:00
|
|
|
const cardContainer = page.getByLabel(
|
|
|
|
|
'It is the card information about the document.',
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await expect(cardContainer.getByTestId('public-icon')).toBeVisible();
|
|
|
|
|
|
2024-10-23 11:11:29 +02:00
|
|
|
await expect(
|
2024-11-25 12:10:16 +01:00
|
|
|
cardContainer.getByText('Public document', { exact: true }),
|
2024-09-06 18:03:19 +02:00
|
|
|
).toBeVisible();
|
|
|
|
|
|
2025-08-04 16:00:17 +02:00
|
|
|
await expect(page.getByTestId('search-docs-button')).toBeVisible();
|
|
|
|
|
await expect(page.getByTestId('new-doc-button')).toBeVisible();
|
2025-01-15 10:53:43 +01:00
|
|
|
|
2024-09-06 18:03:19 +02:00
|
|
|
const urlDoc = page.url();
|
|
|
|
|
|
|
|
|
|
await page
|
|
|
|
|
.getByRole('button', {
|
|
|
|
|
name: 'Logout',
|
|
|
|
|
})
|
|
|
|
|
.click();
|
|
|
|
|
|
2025-02-03 11:02:29 +01:00
|
|
|
await expectLoginPage(page);
|
2024-09-06 18:03:19 +02:00
|
|
|
|
|
|
|
|
await page.goto(urlDoc);
|
|
|
|
|
|
|
|
|
|
await expect(page.locator('h2').getByText(docTitle)).toBeVisible();
|
2025-08-04 16:00:17 +02:00
|
|
|
await expect(page.getByTestId('search-docs-button')).toBeHidden();
|
|
|
|
|
await expect(page.getByTestId('new-doc-button')).toBeHidden();
|
2025-03-17 15:13:02 +01:00
|
|
|
await expect(page.getByRole('button', { name: 'Share' })).toBeVisible();
|
2024-12-16 10:21:28 +01:00
|
|
|
const card = page.getByLabel('It is the card information');
|
|
|
|
|
await expect(card).toBeVisible();
|
|
|
|
|
await expect(card.getByText('Reader')).toBeVisible();
|
2025-06-25 11:21:32 +02:00
|
|
|
|
|
|
|
|
await page.getByRole('button', { name: 'Share' }).click();
|
|
|
|
|
await expect(
|
|
|
|
|
page.getByText(
|
2025-07-08 12:43:14 +02:00
|
|
|
'You can view this document but need additional access to see its members or modify settings.',
|
2025-06-25 11:21:32 +02:00
|
|
|
),
|
|
|
|
|
).toBeVisible();
|
|
|
|
|
|
|
|
|
|
await expect(
|
|
|
|
|
page.getByRole('button', { name: 'Request access' }),
|
|
|
|
|
).toBeHidden();
|
2024-09-06 18:03:19 +02:00
|
|
|
});
|
2024-09-27 15:52:43 +02:00
|
|
|
|
2024-10-23 11:11:29 +02:00
|
|
|
test('It checks a public doc in editable mode', async ({
|
2024-09-27 15:52:43 +02:00
|
|
|
page,
|
|
|
|
|
browserName,
|
|
|
|
|
}) => {
|
|
|
|
|
await page.goto('/');
|
|
|
|
|
await keyCloakSignIn(page, browserName);
|
|
|
|
|
|
2024-10-23 11:11:29 +02:00
|
|
|
const [docTitle] = await createDoc(page, 'Public editable', browserName, 1);
|
|
|
|
|
|
2024-11-25 12:10:16 +01:00
|
|
|
await verifyDocName(page, docTitle);
|
2024-10-23 11:11:29 +02:00
|
|
|
|
|
|
|
|
await page.getByRole('button', { name: 'Share' }).click();
|
2025-08-07 11:54:32 +02:00
|
|
|
const selectVisibility = page.getByTestId('doc-visibility');
|
2024-12-16 10:21:28 +01:00
|
|
|
await selectVisibility.click();
|
2024-10-23 11:11:29 +02:00
|
|
|
|
|
|
|
|
await page
|
2025-02-18 12:12:41 +01:00
|
|
|
.getByRole('menuitem', {
|
2024-10-23 11:11:29 +02:00
|
|
|
name: 'Public',
|
|
|
|
|
})
|
|
|
|
|
.click();
|
|
|
|
|
|
|
|
|
|
await expect(
|
|
|
|
|
page.getByText('The document visibility has been updated.'),
|
|
|
|
|
).toBeVisible();
|
|
|
|
|
|
2025-08-07 11:54:32 +02:00
|
|
|
await page.getByTestId('doc-access-mode').click();
|
2025-05-26 10:27:17 +02:00
|
|
|
await page.getByLabel('Editing').click();
|
2024-10-23 11:11:29 +02:00
|
|
|
|
|
|
|
|
await expect(
|
|
|
|
|
page.getByText('The document visibility has been updated.').first(),
|
|
|
|
|
).toBeVisible();
|
|
|
|
|
|
2024-12-16 10:21:28 +01:00
|
|
|
await page.getByRole('button', { name: 'close' }).click();
|
2024-10-23 11:11:29 +02:00
|
|
|
|
2024-11-25 12:10:16 +01:00
|
|
|
const cardContainer = page.getByLabel(
|
|
|
|
|
'It is the card information about the document.',
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await expect(cardContainer.getByTestId('public-icon')).toBeVisible();
|
|
|
|
|
|
2024-10-23 11:11:29 +02:00
|
|
|
await expect(
|
2024-11-25 12:10:16 +01:00
|
|
|
cardContainer.getByText('Public document', { exact: true }),
|
2024-10-23 11:11:29 +02:00
|
|
|
).toBeVisible();
|
|
|
|
|
|
|
|
|
|
const urlDoc = page.url();
|
|
|
|
|
|
|
|
|
|
await page
|
|
|
|
|
.getByRole('button', {
|
|
|
|
|
name: 'Logout',
|
|
|
|
|
})
|
|
|
|
|
.click();
|
|
|
|
|
|
2025-02-03 11:02:29 +01:00
|
|
|
await expectLoginPage(page);
|
2024-10-23 11:11:29 +02:00
|
|
|
|
|
|
|
|
await page.goto(urlDoc);
|
2024-09-27 15:52:43 +02:00
|
|
|
|
2024-11-25 12:10:16 +01:00
|
|
|
await verifyDocName(page, docTitle);
|
2025-01-27 11:38:59 +01:00
|
|
|
await expect(page.getByRole('button', { name: 'Share' })).toBeVisible();
|
2024-10-23 11:11:29 +02:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.describe('Doc Visibility: Authenticated', () => {
|
|
|
|
|
test.use({ storageState: { cookies: [], origins: [] } });
|
|
|
|
|
|
2025-05-26 10:27:17 +02:00
|
|
|
test('A doc is not accessible when unauthenticated.', async ({
|
2024-10-23 11:11:29 +02:00
|
|
|
page,
|
|
|
|
|
browserName,
|
|
|
|
|
}) => {
|
|
|
|
|
await page.goto('/');
|
|
|
|
|
await keyCloakSignIn(page, browserName);
|
|
|
|
|
|
|
|
|
|
const [docTitle] = await createDoc(
|
|
|
|
|
page,
|
|
|
|
|
'Authenticated unauthentified',
|
|
|
|
|
browserName,
|
|
|
|
|
1,
|
|
|
|
|
);
|
|
|
|
|
|
2024-11-25 12:10:16 +01:00
|
|
|
await verifyDocName(page, docTitle);
|
2024-09-27 15:52:43 +02:00
|
|
|
|
2024-10-25 14:16:29 +02:00
|
|
|
await page.getByRole('button', { name: 'Share' }).click();
|
2025-08-07 11:54:32 +02:00
|
|
|
const selectVisibility = page.getByTestId('doc-visibility');
|
2024-12-16 10:21:28 +01:00
|
|
|
await selectVisibility.click();
|
2024-10-25 14:16:29 +02:00
|
|
|
await page
|
2025-02-18 12:12:41 +01:00
|
|
|
.getByRole('menuitem', {
|
2024-12-16 10:21:28 +01:00
|
|
|
name: 'Connected',
|
2024-10-25 14:16:29 +02:00
|
|
|
})
|
|
|
|
|
.click();
|
|
|
|
|
|
|
|
|
|
await expect(
|
|
|
|
|
page.getByText('The document visibility has been updated.'),
|
|
|
|
|
).toBeVisible();
|
|
|
|
|
|
2024-12-16 10:21:28 +01:00
|
|
|
await page.getByRole('button', { name: 'close' }).click();
|
2024-10-25 14:16:29 +02:00
|
|
|
|
2024-09-27 15:52:43 +02:00
|
|
|
const urlDoc = page.url();
|
|
|
|
|
|
|
|
|
|
await page
|
|
|
|
|
.getByRole('button', {
|
|
|
|
|
name: 'Logout',
|
|
|
|
|
})
|
|
|
|
|
.click();
|
|
|
|
|
|
2025-02-03 11:02:29 +01:00
|
|
|
await expectLoginPage(page);
|
2024-09-27 15:52:43 +02:00
|
|
|
|
|
|
|
|
await page.goto(urlDoc);
|
|
|
|
|
|
2024-10-23 11:11:29 +02:00
|
|
|
await expect(page.locator('h2').getByText(docTitle)).toBeHidden();
|
2025-02-17 13:05:20 +01:00
|
|
|
|
|
|
|
|
await expect(
|
|
|
|
|
page.getByText('Log in to access the document.'),
|
|
|
|
|
).toBeVisible();
|
2024-09-27 15:52:43 +02:00
|
|
|
});
|
2024-10-23 11:11:29 +02:00
|
|
|
|
|
|
|
|
test('It checks a authenticated doc in read only mode', async ({
|
|
|
|
|
page,
|
|
|
|
|
browserName,
|
|
|
|
|
}) => {
|
2025-07-08 12:43:14 +02:00
|
|
|
test.slow();
|
|
|
|
|
|
2024-10-23 11:11:29 +02:00
|
|
|
await page.goto('/');
|
|
|
|
|
await keyCloakSignIn(page, browserName);
|
|
|
|
|
|
|
|
|
|
const [docTitle] = await createDoc(
|
|
|
|
|
page,
|
|
|
|
|
'Authenticated read only',
|
|
|
|
|
browserName,
|
|
|
|
|
1,
|
|
|
|
|
);
|
|
|
|
|
|
2024-11-25 12:10:16 +01:00
|
|
|
await verifyDocName(page, docTitle);
|
2024-10-23 11:11:29 +02:00
|
|
|
|
2024-10-25 14:16:29 +02:00
|
|
|
await page.getByRole('button', { name: 'Share' }).click();
|
2025-08-07 11:54:32 +02:00
|
|
|
const selectVisibility = page.getByTestId('doc-visibility');
|
2024-12-16 10:21:28 +01:00
|
|
|
await selectVisibility.click();
|
2024-10-25 14:16:29 +02:00
|
|
|
await page
|
2025-02-18 12:12:41 +01:00
|
|
|
.getByRole('menuitem', {
|
2024-12-16 10:21:28 +01:00
|
|
|
name: 'Connected',
|
2024-10-25 14:16:29 +02:00
|
|
|
})
|
|
|
|
|
.click();
|
|
|
|
|
|
|
|
|
|
await expect(
|
|
|
|
|
page.getByText('The document visibility has been updated.'),
|
|
|
|
|
).toBeVisible();
|
|
|
|
|
|
2025-02-24 10:24:06 +01:00
|
|
|
await expect(
|
|
|
|
|
page
|
|
|
|
|
.getByLabel('It is the card information about the document.')
|
|
|
|
|
.getByText('Document accessible to any connected person', {
|
|
|
|
|
exact: true,
|
|
|
|
|
}),
|
|
|
|
|
).toBeVisible();
|
|
|
|
|
|
2024-12-16 10:21:28 +01:00
|
|
|
await page.getByRole('button', { name: 'close' }).click();
|
2024-10-25 14:16:29 +02:00
|
|
|
|
2024-10-23 11:11:29 +02:00
|
|
|
const urlDoc = page.url();
|
|
|
|
|
|
2025-07-08 12:43:14 +02:00
|
|
|
const { name: childTitle } = await createRootSubPage(
|
|
|
|
|
page,
|
|
|
|
|
browserName,
|
2025-07-09 12:41:10 +02:00
|
|
|
'Authenticated read only - child',
|
2025-07-08 12:43:14 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const urlChildDoc = page.url();
|
|
|
|
|
|
2024-10-23 11:11:29 +02:00
|
|
|
await page
|
|
|
|
|
.getByRole('button', {
|
|
|
|
|
name: 'Logout',
|
|
|
|
|
})
|
|
|
|
|
.click();
|
|
|
|
|
|
2025-06-25 11:21:32 +02:00
|
|
|
const otherBrowser = BROWSERS.find((b) => b !== browserName);
|
2025-08-07 16:59:08 +02:00
|
|
|
if (!otherBrowser) {
|
|
|
|
|
throw new Error('No alternative browser found');
|
|
|
|
|
}
|
|
|
|
|
await keyCloakSignIn(page, otherBrowser);
|
2024-10-23 11:11:29 +02:00
|
|
|
|
2025-08-01 10:12:16 +02:00
|
|
|
await expect(page.getByTestId('header-logo-link')).toBeVisible({
|
2025-07-08 12:43:14 +02:00
|
|
|
timeout: 10000,
|
|
|
|
|
});
|
2025-02-03 11:02:29 +01:00
|
|
|
|
2024-10-23 11:11:29 +02:00
|
|
|
await page.goto(urlDoc);
|
|
|
|
|
|
|
|
|
|
await expect(page.locator('h2').getByText(docTitle)).toBeVisible();
|
2025-01-27 11:38:59 +01:00
|
|
|
await page.getByRole('button', { name: 'Share' }).click();
|
2025-01-15 16:03:34 +01:00
|
|
|
await page.getByRole('button', { name: 'Copy link' }).click();
|
|
|
|
|
await expect(page.getByText('Link Copied !')).toBeVisible();
|
2025-06-25 11:21:32 +02:00
|
|
|
|
|
|
|
|
await expect(
|
|
|
|
|
page.getByText(
|
2025-07-08 12:43:14 +02:00
|
|
|
'You can view this document but need additional access to see its members or modify settings.',
|
2025-06-25 11:21:32 +02:00
|
|
|
),
|
|
|
|
|
).toBeVisible();
|
|
|
|
|
|
|
|
|
|
await page.getByRole('button', { name: 'Request access' }).click();
|
|
|
|
|
|
|
|
|
|
await expect(
|
|
|
|
|
page.getByRole('button', { name: 'Request access' }),
|
|
|
|
|
).toBeDisabled();
|
2025-07-08 12:43:14 +02:00
|
|
|
|
|
|
|
|
await page.goto(urlChildDoc);
|
|
|
|
|
|
|
|
|
|
await expect(page.locator('h2').getByText(childTitle)).toBeVisible();
|
|
|
|
|
|
|
|
|
|
await page.getByRole('button', { name: 'Share' }).click();
|
|
|
|
|
|
|
|
|
|
await expect(
|
|
|
|
|
page.getByText(
|
|
|
|
|
'As this is a sub-document, please request access to the parent document to enable these features.',
|
|
|
|
|
),
|
|
|
|
|
).toBeVisible();
|
|
|
|
|
|
|
|
|
|
await expect(
|
|
|
|
|
page.getByRole('button', { name: 'Request access' }),
|
|
|
|
|
).toBeHidden();
|
2024-10-23 11:11:29 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('It checks a authenticated doc in editable mode', async ({
|
|
|
|
|
page,
|
|
|
|
|
browserName,
|
|
|
|
|
}) => {
|
2025-08-07 11:54:32 +02:00
|
|
|
test.slow();
|
2024-10-23 11:11:29 +02:00
|
|
|
await page.goto('/');
|
|
|
|
|
await keyCloakSignIn(page, browserName);
|
|
|
|
|
|
|
|
|
|
const [docTitle] = await createDoc(
|
|
|
|
|
page,
|
|
|
|
|
'Authenticated editable',
|
|
|
|
|
browserName,
|
|
|
|
|
1,
|
|
|
|
|
);
|
|
|
|
|
|
2024-11-25 12:10:16 +01:00
|
|
|
await verifyDocName(page, docTitle);
|
2024-10-23 11:11:29 +02:00
|
|
|
|
2024-10-25 14:16:29 +02:00
|
|
|
await page.getByRole('button', { name: 'Share' }).click();
|
2025-08-07 11:54:32 +02:00
|
|
|
const selectVisibility = page.getByTestId('doc-visibility');
|
2024-12-16 10:21:28 +01:00
|
|
|
await selectVisibility.click();
|
2024-10-25 14:16:29 +02:00
|
|
|
await page
|
2025-02-18 12:12:41 +01:00
|
|
|
.getByRole('menuitem', {
|
2024-12-16 10:21:28 +01:00
|
|
|
name: 'Connected',
|
2024-10-25 14:16:29 +02:00
|
|
|
})
|
|
|
|
|
.click();
|
|
|
|
|
|
|
|
|
|
await expect(
|
|
|
|
|
page.getByText('The document visibility has been updated.'),
|
|
|
|
|
).toBeVisible();
|
|
|
|
|
|
2024-10-23 11:11:29 +02:00
|
|
|
const urlDoc = page.url();
|
2025-08-07 11:54:32 +02:00
|
|
|
await page.getByTestId('doc-access-mode').click();
|
2025-05-26 10:27:17 +02:00
|
|
|
await page.getByLabel('Editing').click();
|
2024-10-23 11:11:29 +02:00
|
|
|
|
|
|
|
|
await expect(
|
|
|
|
|
page.getByText('The document visibility has been updated.').first(),
|
|
|
|
|
).toBeVisible();
|
|
|
|
|
|
2024-12-16 10:21:28 +01:00
|
|
|
await page.getByRole('button', { name: 'close' }).click();
|
2024-10-23 11:11:29 +02:00
|
|
|
|
|
|
|
|
await page
|
|
|
|
|
.getByRole('button', {
|
|
|
|
|
name: 'Logout',
|
|
|
|
|
})
|
|
|
|
|
.click();
|
|
|
|
|
|
2025-06-25 11:21:32 +02:00
|
|
|
const otherBrowser = BROWSERS.find((b) => b !== browserName);
|
2025-08-07 16:59:08 +02:00
|
|
|
if (!otherBrowser) {
|
|
|
|
|
throw new Error('No alternative browser found');
|
|
|
|
|
}
|
|
|
|
|
await keyCloakSignIn(page, otherBrowser);
|
2024-10-23 11:11:29 +02:00
|
|
|
|
2025-08-07 11:54:32 +02:00
|
|
|
await expect(page.getByTestId('header-logo-link')).toBeVisible({
|
|
|
|
|
timeout: 10000,
|
|
|
|
|
});
|
2025-02-03 11:02:29 +01:00
|
|
|
|
2024-10-23 11:11:29 +02:00
|
|
|
await page.goto(urlDoc);
|
|
|
|
|
|
2024-11-25 12:10:16 +01:00
|
|
|
await verifyDocName(page, docTitle);
|
2025-01-27 11:38:59 +01:00
|
|
|
await page.getByRole('button', { name: 'Share' }).click();
|
2025-01-15 16:03:34 +01:00
|
|
|
await page.getByRole('button', { name: 'Copy link' }).click();
|
2025-08-07 11:54:32 +02:00
|
|
|
await expect(page.getByText('Link Copied !')).toBeVisible({
|
|
|
|
|
timeout: 10000,
|
|
|
|
|
});
|
2024-10-23 11:11:29 +02:00
|
|
|
});
|
2024-09-06 18:03:19 +02:00
|
|
|
});
|