mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-02-04 11:36:46 +00:00
feat: user application dashboard (#727)
Co-authored-by: Elias Schneider <login@eliasschneider.com>
This commit is contained in:
@@ -27,7 +27,8 @@ export const oidcClients = {
|
||||
name: 'Nextcloud',
|
||||
callbackUrl: 'http://nextcloud/auth/callback',
|
||||
logoutCallbackUrl: 'http://nextcloud/auth/logout/callback',
|
||||
secret: 'w2mUeZISmEvIDMEDvpY0PnxQIpj1m3zY'
|
||||
secret: 'w2mUeZISmEvIDMEDvpY0PnxQIpj1m3zY',
|
||||
launchURL: 'https://nextcloud.local'
|
||||
},
|
||||
immich: {
|
||||
id: '606c7782-f2b1-49e5-8ea9-26eb1b06d018',
|
||||
@@ -35,6 +36,12 @@ export const oidcClients = {
|
||||
callbackUrl: 'http://immich/auth/callback',
|
||||
secret: 'PYjrE9u4v9GVqXKi52eur0eb2Ci4kc0x'
|
||||
},
|
||||
tailscale: {
|
||||
id: '7c21a609-96b5-4011-9900-272b8d31a9d1',
|
||||
name: 'Tailscale',
|
||||
callbackUrl: 'http://tailscale/auth/callback',
|
||||
secret: 'n4VfQeXlTzA6yKpWbR9uJcMdSx2qH0Lo',
|
||||
},
|
||||
federated: {
|
||||
id: 'c48232ff-ff65-45ed-ae96-7afa8a9b443b',
|
||||
name: 'Federated',
|
||||
@@ -49,7 +56,8 @@ export const oidcClients = {
|
||||
pingvinShare: {
|
||||
name: 'Pingvin Share',
|
||||
callbackUrl: 'http://pingvin.share/auth/callback',
|
||||
secondCallbackUrl: 'http://pingvin.share/auth/callback2'
|
||||
secondCallbackUrl: 'http://pingvin.share/auth/callback2',
|
||||
launchURL: 'https://pingvin-share.local'
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
59
tests/specs/apps-dashboard.spec.ts
Normal file
59
tests/specs/apps-dashboard.spec.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import test, { expect } from '@playwright/test';
|
||||
import { oidcClients } from '../data';
|
||||
import { cleanupBackend } from '../utils/cleanup.util';
|
||||
|
||||
test.beforeEach(() => cleanupBackend());
|
||||
|
||||
test('Dashboard shows all authorized clients in the correct order', async ({ page }) => {
|
||||
const client1 = oidcClients.tailscale;
|
||||
const client2 = oidcClients.nextcloud;
|
||||
|
||||
await page.goto('/settings/apps');
|
||||
|
||||
await expect(page.getByTestId('authorized-oidc-client-card')).toHaveCount(2);
|
||||
|
||||
// Should be first
|
||||
const card1 = page.getByTestId('authorized-oidc-client-card').first();
|
||||
|
||||
await expect(card1.getByRole('heading')).toHaveText(client1.name);
|
||||
|
||||
const card2 = page.getByTestId('authorized-oidc-client-card').nth(1);
|
||||
await expect(card2.getByRole('heading', { name: client2.name })).toBeVisible();
|
||||
await expect(card2.getByText(new URL(client2.launchURL).hostname)).toBeVisible();
|
||||
});
|
||||
|
||||
test('Revoke authorized client', async ({ page }) => {
|
||||
const client = oidcClients.tailscale;
|
||||
|
||||
await page.goto('/settings/apps');
|
||||
|
||||
page
|
||||
.getByTestId('authorized-oidc-client-card')
|
||||
.first()
|
||||
.getByRole('button', { name: 'Toggle menu' })
|
||||
.click();
|
||||
|
||||
await page.getByRole('menuitem', { name: 'Revoke' }).click();
|
||||
await page.getByRole('button', { name: 'Revoke' }).click();
|
||||
|
||||
await expect(page.locator('[data-type="success"]')).toHaveText(
|
||||
`The access to ${client.name} has been successfully revoked.`
|
||||
);
|
||||
|
||||
await expect(page.getByTestId('authorized-oidc-client-card')).toHaveCount(1);
|
||||
});
|
||||
|
||||
test('Launch authorized client', async ({ page }) => {
|
||||
const client = oidcClients.nextcloud;
|
||||
|
||||
await page.goto('/settings/apps');
|
||||
|
||||
const card1 = page.getByTestId('authorized-oidc-client-card').first();
|
||||
await expect(card1.getByRole('button', { name: 'Launch' })).toBeDisabled();
|
||||
|
||||
const card2 = page.getByTestId('authorized-oidc-client-card').nth(1);
|
||||
await expect(card2.getByRole('link', { name: 'Launch' })).toHaveAttribute(
|
||||
'href',
|
||||
client.launchURL
|
||||
);
|
||||
});
|
||||
@@ -11,6 +11,8 @@ test('Create OIDC client', async ({ page }) => {
|
||||
await page.getByRole('button', { name: 'Add OIDC Client' }).click();
|
||||
await page.getByLabel('Name').fill(oidcClient.name);
|
||||
|
||||
await page.getByLabel('Client Launch URL').fill(oidcClient.launchURL);
|
||||
|
||||
await page.getByRole('button', { name: 'Add' }).nth(1).click();
|
||||
await page.getByTestId('callback-url-1').fill(oidcClient.callbackUrl);
|
||||
await page.getByRole('button', { name: 'Add another' }).click();
|
||||
@@ -42,6 +44,7 @@ test('Edit OIDC client', async ({ page }) => {
|
||||
await page.getByLabel('Name').fill('Nextcloud updated');
|
||||
await page.getByTestId('callback-url-1').first().fill('http://nextcloud-updated/auth/callback');
|
||||
await page.getByLabel('logo').setInputFiles('assets/nextcloud-logo.png');
|
||||
await page.getByLabel('Client Launch URL').fill(oidcClient.launchURL);
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
|
||||
await expect(page.locator('[data-type="success"]')).toHaveText(
|
||||
|
||||
Reference in New Issue
Block a user