diff --git a/frontend/tests/e2e/user/settings/data-export.spec.ts b/frontend/tests/e2e/user/settings/data-export.spec.ts new file mode 100644 index 000000000..31fda6c4f --- /dev/null +++ b/frontend/tests/e2e/user/settings/data-export.spec.ts @@ -0,0 +1,27 @@ +import {test, expect} from '../../../support/fixtures' +import {gotoUserSettings} from '../../../support/userSettings' +import {TEST_PASSWORD} from '../../../support/constants' + +test.describe('Data export', () => { + test('requests an export with correct password', async ({authenticatedPage: page}) => { + await gotoUserSettings(page, 'data-export') + await page.locator('#currentPasswordDataExport').fill(TEST_PASSWORD) + + const resp = page.waitForResponse(r => r.url().includes('/user/export/request')) + await page.getByRole('button', {name: /request/i}).click() + const r = await resp + expect(r.ok()).toBe(true) + await expect(page.locator('.global-notification .vue-notification.success')).toBeVisible() + }) + + test('rejects export with wrong password', async ({authenticatedPage: page}) => { + await gotoUserSettings(page, 'data-export') + await page.locator('#currentPasswordDataExport').fill('WRONG') + + const resp = page.waitForResponse(r => r.url().includes('/user/export/request')) + await page.getByRole('button', {name: /request/i}).click() + const r = await resp + expect(r.ok()).toBe(false) + await expect(page.locator('.global-notification .vue-notification.error')).toBeVisible() + }) +})