Skip to content

Commit ff364f8

Browse files
committed
✨(frontend) increase doc visibility options
We now have 3 visibility options for docs: - public - restricted - authenticated We also have 2 editability options: - readonly - editable The editability options are only available for public and authenticated docs.
1 parent c0cb12f commit ff364f8

File tree

13 files changed

+616
-124
lines changed

13 files changed

+616
-124
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to
1313

1414
- 📝Contributing.md #352
1515
- 🌐(frontend) add localization to editor #268
16+
- ✨Public and restricted doc editable #357
1617

1718
## Fixed
1819

src/frontend/apps/e2e/__tests__/app-impress/common.ts

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ export const keyCloakSignIn = async (page: Page, browserName: string) => {
44
const login = `user-e2e-${browserName}`;
55
const password = `password-e2e-${browserName}`;
66

7-
if (await page.getByLabel('Restart login').isVisible()) {
8-
await page.getByRole('textbox', { name: 'password' }).fill(password);
9-
10-
await page.click('input[type="submit"]', { force: true });
11-
} else {
12-
await page.getByRole('textbox', { name: 'username' }).fill(login);
13-
14-
await page.getByRole('textbox', { name: 'password' }).fill(password);
7+
await expect(
8+
page.locator('.login-pf-page-header').getByText('impress'),
9+
).toBeVisible();
1510

16-
await page.click('input[type="submit"]', { force: true });
11+
if (await page.getByLabel('Restart login').isVisible()) {
12+
await page.getByLabel('Restart login').click();
1713
}
14+
15+
await page.getByRole('textbox', { name: 'username' }).fill(login);
16+
await page.getByRole('textbox', { name: 'password' }).fill(password);
17+
await page.click('input[type="submit"]', { force: true });
1818
};
1919

2020
export const randomName = (name: string, browserName: string, length: number) =>
@@ -27,7 +27,6 @@ export const createDoc = async (
2727
docName: string,
2828
browserName: string,
2929
length: number,
30-
isPublic: boolean = false,
3130
) => {
3231
const randomDocs = randomName(docName, browserName, length);
3332

@@ -44,22 +43,6 @@ export const createDoc = async (
4443
await page.getByRole('heading', { name: 'Untitled document' }).click();
4544
await page.keyboard.type(randomDocs[i]);
4645
await page.getByText('Created at ').click();
47-
48-
if (isPublic) {
49-
await page.getByRole('button', { name: 'Share' }).click();
50-
await page.getByText('Doc private').click();
51-
52-
await page.locator('.c__modal__backdrop').click({
53-
position: { x: 0, y: 0 },
54-
force: true,
55-
});
56-
57-
await expect(
58-
page
59-
.getByLabel('It is the card information about the document.')
60-
.getByText('Public'),
61-
).toBeVisible();
62-
}
6346
}
6447

6548
return randomDocs;

src/frontend/apps/e2e/__tests__/app-impress/doc-header.spec.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,11 @@ test.describe('Doc Header', () => {
211211

212212
const shareModal = page.getByLabel('Share modal');
213213

214-
await expect(shareModal.getByLabel('Doc private')).toBeEnabled();
214+
await expect(
215+
shareModal.getByRole('combobox', {
216+
name: 'Visibility',
217+
}),
218+
).not.toHaveAttribute('disabled');
215219
await expect(shareModal.getByText('Search by email')).toBeVisible();
216220

217221
const invitationCard = shareModal.getByLabel('List invitation card');
@@ -284,7 +288,11 @@ test.describe('Doc Header', () => {
284288

285289
const shareModal = page.getByLabel('Share modal');
286290

287-
await expect(shareModal.getByLabel('Doc private')).toBeDisabled();
291+
await expect(
292+
shareModal.getByRole('combobox', {
293+
name: 'Visibility',
294+
}),
295+
).toHaveAttribute('disabled');
288296
await expect(shareModal.getByText('Search by email')).toBeHidden();
289297

290298
const invitationCard = shareModal.getByLabel('List invitation card');
@@ -357,7 +365,11 @@ test.describe('Doc Header', () => {
357365

358366
const shareModal = page.getByLabel('Share modal');
359367

360-
await expect(shareModal.getByLabel('Doc private')).toBeDisabled();
368+
await expect(
369+
shareModal.getByRole('combobox', {
370+
name: 'Visibility',
371+
}),
372+
).toHaveAttribute('disabled');
361373
await expect(shareModal.getByText('Search by email')).toBeHidden();
362374

363375
const invitationCard = shareModal.getByLabel('List invitation card');

src/frontend/apps/e2e/__tests__/app-impress/doc-member-list.spec.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,22 @@ test.describe('Document list members', () => {
164164
const shareModal = page.getByLabel('Share modal');
165165

166166
// Admin still have the right to share
167-
await expect(shareModal.getByLabel('Doc private')).toBeEnabled();
167+
await expect(
168+
shareModal.getByRole('combobox', {
169+
name: 'Visibility',
170+
}),
171+
).not.toHaveAttribute('disabled');
168172

169173
await SelectRoleCurrentUser.click();
170174
await page.getByRole('option', { name: 'Reader' }).click();
171175
await expect(page.getByText('The role has been updated')).toBeVisible();
172176

173177
// Reader does not have the right to share
174-
await expect(shareModal.getByLabel('Doc private')).toBeDisabled();
178+
await expect(
179+
shareModal.getByRole('combobox', {
180+
name: 'Visibility',
181+
}),
182+
).toHaveAttribute('disabled');
175183
});
176184

177185
test('it checks the delete members', async ({ page, browserName }) => {

0 commit comments

Comments
 (0)