1
0
mirror of https://github.com/pocket-id/pocket-id.git synced 2026-02-04 11:36:46 +00:00

feat: add email logo customization (#1150)

This commit is contained in:
Melvin Snijders
2025-12-17 16:20:22 +01:00
committed by GitHub
parent 3eaf36aae7
commit f5da11b99b
14 changed files with 131 additions and 29 deletions

BIN
tests/assets/cloud-logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

View File

@@ -116,30 +116,49 @@ test('Update email configuration', async ({ page }) => {
await expect(page.getByLabel('API Key Expiration')).toBeChecked();
});
test('Update application images', async ({ page }) => {
await page.getByRole('button', { name: 'Expand card' }).nth(4).click();
test.describe('Update application images', () => {
test.beforeEach(async ({ page }) => {
await page.getByRole('button', { name: 'Expand card' }).nth(4).click();
});
await page.getByLabel('Favicon').setInputFiles('assets/w3-schools-favicon.ico');
await page.getByLabel('Light Mode Logo').setInputFiles('assets/pingvin-share-logo.png');
await page.getByLabel('Dark Mode Logo').setInputFiles('assets/nextcloud-logo.png');
await page.getByLabel('Default Profile Picture').setInputFiles('assets/pingvin-share-logo.png');
await page.getByLabel('Background Image').setInputFiles('assets/clouds.jpg');
await page.getByRole('button', { name: 'Save' }).last().click();
test('should upload images', async ({ page }) => {
await page.getByLabel('Favicon').setInputFiles('assets/w3-schools-favicon.ico');
await page.getByLabel('Light Mode Logo').setInputFiles('assets/pingvin-share-logo.png');
await page.getByLabel('Dark Mode Logo').setInputFiles('assets/cloud-logo.png');
await page.getByLabel('Email Logo').setInputFiles('assets/pingvin-share-logo.png');
await page.getByLabel('Default Profile Picture').setInputFiles('assets/pingvin-share-logo.png');
await page.getByLabel('Background Image').setInputFiles('assets/clouds.jpg');
await page.getByRole('button', { name: 'Save' }).last().click();
await expect(page.locator('[data-type="success"]')).toHaveText(
'Images updated successfully. It may take a few minutes to update.'
);
await expect(page.locator('[data-type="success"]')).toHaveText(
'Images updated successfully. It may take a few minutes to update.'
);
await page.request
.get('/api/application-images/favicon')
.then((res) => expect.soft(res.status()).toBe(200));
await page.request
.get('/api/application-images/logo?light=true')
.then((res) => expect.soft(res.status()).toBe(200));
await page.request
.get('/api/application-images/logo?light=false')
.then((res) => expect.soft(res.status()).toBe(200));
await page.request
.get('/api/application-images/background')
.then((res) => expect.soft(res.status()).toBe(200));
});
await page.request
.get('/api/application-images/favicon')
.then((res) => expect.soft(res.status()).toBe(200));
await page.request
.get('/api/application-images/logo?light=true')
.then((res) => expect.soft(res.status()).toBe(200));
await page.request
.get('/api/application-images/logo?light=false')
.then((res) => expect.soft(res.status()).toBe(200));
await page.request
.get('/api/application-images/email')
.then((res) => expect.soft(res.status()).toBe(200));
await page.request
.get('/api/application-images/background')
.then((res) => expect.soft(res.status()).toBe(200));
});
test('should only allow png/jpeg for email logo', async ({ page }) => {
const emailLogoInput = page.getByLabel('Email Logo');
await emailLogoInput.setInputFiles('assets/cloud-logo.svg');
await page.getByRole('button', { name: 'Save' }).last().click();
await expect(page.locator('[data-type="error"]')).toHaveText(
'File must be of type .png or .jpg/jpeg'
);
});
});

View File

@@ -71,9 +71,9 @@ 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.locator('[role="tab"][data-value="light-logo"]').first().click();
await page.setInputFiles('#oidc-client-logo-light', 'assets/nextcloud-logo.png');
await page.setInputFiles('#oidc-client-logo-light', 'assets/cloud-logo.png');
await page.locator('[role="tab"][data-value="dark-logo"]').first().click();
await page.setInputFiles('#oidc-client-logo-dark', 'assets/nextcloud-logo.png');
await page.setInputFiles('#oidc-client-logo-dark', 'assets/cloud-logo.png');
await page.getByLabel('Client Launch URL').fill(oidcClient.launchURL);
await page.getByRole('button', { name: 'Save' }).click();