🛂(frontend) invalidate doc query when lost connection
When the provider reports a lost connection, we invalidate the doc query to refetch the document data. This ensures that if a user has lost is rights to access a document, he will be redirected to a 403 page without needing to refresh the page.
This commit is contained in:
@@ -7,7 +7,7 @@ import {
|
||||
randomName,
|
||||
verifyDocName,
|
||||
} from './utils-common';
|
||||
import { connectOtherUserToDoc } from './utils-share';
|
||||
import { connectOtherUserToDoc, updateRoleUser } from './utils-share';
|
||||
import { createRootSubPage } from './utils-sub-pages';
|
||||
|
||||
test.describe('Document create member', () => {
|
||||
@@ -274,6 +274,12 @@ test.describe('Document create member', () => {
|
||||
await verifyDocName(otherPage, docTitle);
|
||||
await expect(otherPage.getByText('Hello World')).toBeVisible();
|
||||
|
||||
// Revoke access
|
||||
await updateRoleUser(page, 'Remove access', emailRequest);
|
||||
await expect(
|
||||
otherPage.getByText('Insufficient access rights to view the document.'),
|
||||
).toBeVisible();
|
||||
|
||||
// Cleanup: other user logout
|
||||
await cleanup();
|
||||
});
|
||||
|
||||
@@ -68,6 +68,20 @@ export const updateShareLink = async (
|
||||
}
|
||||
};
|
||||
|
||||
export const updateRoleUser = async (
|
||||
page: Page,
|
||||
role: Role | 'Remove access',
|
||||
email: string,
|
||||
) => {
|
||||
const list = page.getByTestId('doc-share-quick-search');
|
||||
|
||||
const currentUser = list.getByTestId(`doc-share-member-row-${email}`);
|
||||
const currentUserRole = currentUser.getByLabel('doc-role-dropdown');
|
||||
await currentUserRole.click();
|
||||
await page.getByLabel(role).click();
|
||||
await list.click();
|
||||
};
|
||||
|
||||
/**
|
||||
* Connects another user to a document.
|
||||
* Useful to test real-time collaboration features.
|
||||
|
||||
Reference in New Issue
Block a user