mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-05-01 08:48:28 -05:00
feat: migrate cypress e2e tests to playwright (#1739)
This commit is contained in:
23
frontend/tests/support/updateUserSettings.ts
Normal file
23
frontend/tests/support/updateUserSettings.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import type {APIRequestContext} from '@playwright/test'
|
||||
|
||||
export async function updateUserSettings(apiContext: APIRequestContext, token: string, settings: any) {
|
||||
const apiUrl = process.env.API_URL || 'http://localhost:3456/api/v1'
|
||||
|
||||
const userResponse = await apiContext.get(`${apiUrl}/user`, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${token}`,
|
||||
},
|
||||
})
|
||||
|
||||
const oldSettings = await userResponse.json()
|
||||
|
||||
await apiContext.post(`${apiUrl}/user/settings/general`, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${token}`,
|
||||
},
|
||||
data: {
|
||||
...oldSettings,
|
||||
...settings,
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user