mirror of
https://github.com/documenso/documenso.git
synced 2025-11-20 19:51:32 +10:00
fix: wip
This commit is contained in:
@ -21,12 +21,13 @@ export const apiSignin = async ({
|
||||
}: LoginOptions) => {
|
||||
const { request } = page.context();
|
||||
|
||||
// const csrfToken = await getCsrfToken(page);
|
||||
const csrfToken = await getCsrfToken(page);
|
||||
|
||||
await request.post(`${NEXT_PUBLIC_WEBAPP_URL()}/api/auth/email-password/authorize`, {
|
||||
data: {
|
||||
email,
|
||||
password,
|
||||
csrfToken,
|
||||
},
|
||||
});
|
||||
|
||||
@ -50,6 +51,7 @@ const getCsrfToken = async (page: Page) => {
|
||||
});
|
||||
|
||||
const { csrfToken } = await response.json();
|
||||
|
||||
if (!csrfToken) {
|
||||
throw new Error('Invalid session');
|
||||
}
|
||||
|
||||
@ -422,10 +422,13 @@ test('[TEAMS]: check document visibility based on team member role', async ({ pa
|
||||
},
|
||||
]);
|
||||
|
||||
const teamUrlRedirect = `/t/${team.url}/documents?status=COMPLETED`;
|
||||
|
||||
// Test cases for each role
|
||||
const testCases = [
|
||||
{
|
||||
user: adminUser,
|
||||
path: teamUrlRedirect,
|
||||
expectedDocuments: [
|
||||
'Document Visible to Everyone',
|
||||
'Document Visible to Manager and Above',
|
||||
@ -435,14 +438,17 @@ test('[TEAMS]: check document visibility based on team member role', async ({ pa
|
||||
},
|
||||
{
|
||||
user: managerUser,
|
||||
path: teamUrlRedirect,
|
||||
expectedDocuments: ['Document Visible to Everyone', 'Document Visible to Manager and Above'],
|
||||
},
|
||||
{
|
||||
user: memberUser,
|
||||
path: teamUrlRedirect,
|
||||
expectedDocuments: ['Document Visible to Everyone'],
|
||||
},
|
||||
{
|
||||
user: outsideUser,
|
||||
path: '/documents',
|
||||
expectedDocuments: ['Document Visible to Admin with Recipient'],
|
||||
},
|
||||
];
|
||||
@ -451,7 +457,7 @@ test('[TEAMS]: check document visibility based on team member role', async ({ pa
|
||||
await apiSignin({
|
||||
page,
|
||||
email: testCase.user.email,
|
||||
redirectPath: `/t/${team.url}/documents?status=COMPLETED`,
|
||||
redirectPath: testCase.path,
|
||||
});
|
||||
|
||||
// Check that the user sees the expected documents
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
"scripts": {
|
||||
"test:dev": "NODE_OPTIONS=--experimental-require-module playwright test",
|
||||
"test-ui:dev": "NODE_OPTIONS=--experimental-require-module playwright test --ui",
|
||||
"test:e2e": "NODE_OPTIONS=--experimental-require-module start-server-and-test \"npm run start -w @documenso/web\" http://localhost:3000 \"playwright test $E2E_TEST_PATH\""
|
||||
"test:e2e": "NODE_OPTIONS=--experimental-require-module start-server-and-test \"npm run start -w @documenso/remix\" http://localhost:3000 \"playwright test $E2E_TEST_PATH\""
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
||||
Reference in New Issue
Block a user