2024-08-12 11:00:25 +02:00
|
|
|
import test, { expect } from '@playwright/test';
|
|
|
|
|
import { cleanupBackend } from './utils/cleanup.util';
|
|
|
|
|
|
|
|
|
|
test.beforeEach(cleanupBackend);
|
|
|
|
|
|
|
|
|
|
test('Update general configuration', async ({ page }) => {
|
|
|
|
|
await page.goto('/settings/admin/application-configuration');
|
|
|
|
|
|
|
|
|
|
await page.getByLabel('Name').fill('Updated Name');
|
2024-08-13 20:51:10 +02:00
|
|
|
await page.getByLabel('Session Duration').fill('30');
|
2024-08-12 11:00:25 +02:00
|
|
|
await page.getByRole('button', { name: 'Save' }).first().click();
|
|
|
|
|
|
|
|
|
|
await expect(page.getByRole('status')).toHaveText(
|
|
|
|
|
'Application configuration updated successfully'
|
|
|
|
|
);
|
2024-08-19 23:15:19 +02:00
|
|
|
await expect(page.getByTestId('application-name')).toHaveText('Updated Name');
|
2024-08-19 23:10:14 +02:00
|
|
|
|
|
|
|
|
await page.reload();
|
|
|
|
|
|
2024-08-19 23:15:19 +02:00
|
|
|
await expect(page.getByLabel('Name')).toHaveValue('Updated Name');
|
|
|
|
|
await expect(page.getByLabel('Session Duration')).toHaveValue('30');
|
2024-08-12 11:00:25 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('Update application images', async ({ page }) => {
|
|
|
|
|
await page.goto('/settings/admin/application-configuration');
|
|
|
|
|
|
|
|
|
|
await page.getByLabel('Favicon').setInputFiles('tests/assets/w3-schools-favicon.ico');
|
|
|
|
|
await page.getByLabel('Logo').setInputFiles('tests/assets/pingvin-share-logo.png');
|
|
|
|
|
await page.getByLabel('Background Image').setInputFiles('tests/assets/clouds.jpg');
|
|
|
|
|
await page.getByRole('button', { name: 'Save' }).nth(1).click();
|
|
|
|
|
|
|
|
|
|
await expect(page.getByRole('status')).toHaveText('Images updated successfully');
|
|
|
|
|
|
|
|
|
|
await page.request
|
|
|
|
|
.get('/api/application-configuration/favicon')
|
|
|
|
|
.then((res) => expect.soft(res.status()).toBe(200));
|
|
|
|
|
await page.request
|
|
|
|
|
.get('/api/application-configuration/logo')
|
|
|
|
|
.then((res) => expect.soft(res.status()).toBe(200));
|
|
|
|
|
|
|
|
|
|
await page.request
|
|
|
|
|
.get('/api/application-configuration/background-image')
|
|
|
|
|
.then((res) => expect.soft(res.status()).toBe(200));
|
|
|
|
|
});
|