mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-02-04 13:21:45 +00:00
feat: improve initial admin creation workflow
This commit is contained in:
@@ -4,7 +4,7 @@ import authUtil from '../utils/auth.util';
|
||||
import { cleanupBackend } from '../utils/cleanup.util';
|
||||
import passkeyUtil from '../utils/passkey.util';
|
||||
|
||||
test.beforeEach(cleanupBackend);
|
||||
test.beforeEach(() => cleanupBackend());
|
||||
|
||||
test('Update account details', async ({ page }) => {
|
||||
await page.goto('/settings/account');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import test, { expect } from '@playwright/test';
|
||||
import { cleanupBackend } from '../utils/cleanup.util';
|
||||
|
||||
test.beforeEach(cleanupBackend);
|
||||
test.beforeEach(() => cleanupBackend());
|
||||
|
||||
test('Update general configuration', async ({ page }) => {
|
||||
await page.goto('/settings/admin/application-configuration');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import test, { expect } from '@playwright/test';
|
||||
import { cleanupBackend } from '../utils/cleanup.util';
|
||||
|
||||
test.beforeEach(cleanupBackend);
|
||||
test.beforeEach(() => cleanupBackend());
|
||||
|
||||
test.describe('LDAP Integration', () => {
|
||||
test.skip(
|
||||
|
||||
@@ -2,7 +2,7 @@ import test, { expect } from '@playwright/test';
|
||||
import { oidcClients } from '../data';
|
||||
import { cleanupBackend } from '../utils/cleanup.util';
|
||||
|
||||
test.beforeEach(cleanupBackend);
|
||||
test.beforeEach(() => cleanupBackend());
|
||||
|
||||
test('Create OIDC client', async ({ page }) => {
|
||||
await page.goto('/settings/admin/oidc-clients');
|
||||
|
||||
@@ -5,7 +5,7 @@ import { generateIdToken, generateOauthAccessToken } from '../utils/jwt.util';
|
||||
import * as oidcUtil from '../utils/oidc.util';
|
||||
import passkeyUtil from '../utils/passkey.util';
|
||||
|
||||
test.beforeEach(cleanupBackend);
|
||||
test.beforeEach(() => cleanupBackend());
|
||||
|
||||
test('Authorize existing client', async ({ page }) => {
|
||||
const oidcClient = oidcClients.nextcloud;
|
||||
@@ -189,19 +189,6 @@ test('Refresh token fails when used for the wrong client', async ({ request }) =
|
||||
})
|
||||
.then((r) => r.text());
|
||||
|
||||
// Perform the exchange
|
||||
const refreshResponse = await request.post('/api/oidc/token', {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
form: {
|
||||
grant_type: 'refresh_token',
|
||||
client_id: clientId,
|
||||
refresh_token: refreshToken,
|
||||
client_secret: clientSecret
|
||||
}
|
||||
});
|
||||
|
||||
expect(refreshResponse.status()).toBe(400);
|
||||
});
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import test, { expect } from '@playwright/test';
|
||||
import { oneTimeAccessTokens } from '../data';
|
||||
import { cleanupBackend } from '../utils/cleanup.util';
|
||||
|
||||
test.beforeEach(cleanupBackend);
|
||||
test.beforeEach(() => cleanupBackend());
|
||||
|
||||
// Disable authentication for these tests
|
||||
test.use({ storageState: { cookies: [], origins: [] } });
|
||||
|
||||
@@ -2,7 +2,7 @@ import test, { expect } from '@playwright/test';
|
||||
import { userGroups, users } from '../data';
|
||||
import { cleanupBackend } from '../utils/cleanup.util';
|
||||
|
||||
test.beforeEach(cleanupBackend);
|
||||
test.beforeEach(() => cleanupBackend());
|
||||
|
||||
test('Create user group', async ({ page }) => {
|
||||
await page.goto('/settings/admin/user-groups');
|
||||
|
||||
@@ -2,7 +2,7 @@ import test, { expect } from '@playwright/test';
|
||||
import { userGroups, users } from '../data';
|
||||
import { cleanupBackend } from '../utils/cleanup.util';
|
||||
|
||||
test.beforeEach(cleanupBackend);
|
||||
test.beforeEach(() => cleanupBackend());
|
||||
|
||||
test('Create user', async ({ page }) => {
|
||||
const user = users.steve;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import test, { expect } from '@playwright/test';
|
||||
import { signupTokens, users } from 'data';
|
||||
import { cleanupBackend } from '../utils/cleanup.util';
|
||||
import passkeyUtil from '../utils/passkey.util';
|
||||
import { users, signupTokens } from 'data';
|
||||
|
||||
test.beforeEach(cleanupBackend);
|
||||
test.beforeEach(() => cleanupBackend());
|
||||
|
||||
test.describe('User Signup', () => {
|
||||
async function setSignupMode(page: any, mode: 'Disabled' | 'Signup with token' | 'Open Signup') {
|
||||
@@ -177,3 +177,36 @@ test.describe('User Signup', () => {
|
||||
await expect(page.getByText('Token is invalid or expired.')).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Initial User Signup', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.context().clearCookies();
|
||||
});
|
||||
test('Initial Signup - success flow', async ({ page }) => {
|
||||
await cleanupBackend(true);
|
||||
await page.goto('/setup');
|
||||
|
||||
await page.getByLabel('First name').fill('Jane');
|
||||
await page.getByLabel('Last name').fill('Smith');
|
||||
await page.getByLabel('Username').fill('janesmith');
|
||||
await page.getByLabel('Email').fill('jane.smith@test.com');
|
||||
|
||||
await page.getByRole('button', { name: 'Sign Up' }).click();
|
||||
|
||||
await page.waitForURL('/signup/add-passkey');
|
||||
await expect(page.getByText('Set up your passkey')).toBeVisible();
|
||||
});
|
||||
|
||||
test('Initial Signup - setup already completed', async ({ page }) => {
|
||||
await page.goto('/setup');
|
||||
|
||||
await page.getByLabel('First name').fill('Test');
|
||||
await page.getByLabel('Last name').fill('User');
|
||||
await page.getByLabel('Username').fill('testuser123');
|
||||
await page.getByLabel('Email').fill(users.tim.email);
|
||||
|
||||
await page.getByRole('button', { name: 'Sign Up' }).click();
|
||||
|
||||
await expect(page.getByText('Setup already completed')).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user