mirror of
https://github.com/immich-app/immich.git
synced 2025-12-16 17:23:16 +03:00
* feat: timeline e2e tests * Fix flakiness, mock all apis, allow parallel tests * Upload playwright reports * wrong report path * Add CI=true, disable flaky/failing tests * Re-enable tests, fix worker thread config * fix maintance e2e test * increase retries
52 lines
1.9 KiB
TypeScript
52 lines
1.9 KiB
TypeScript
import { LoginResponseDto } from '@immich/sdk';
|
|
import { expect, test } from '@playwright/test';
|
|
import { utils } from 'src/utils';
|
|
|
|
test.describe.configure({ mode: 'serial' });
|
|
|
|
test.describe('Maintenance', () => {
|
|
let admin: LoginResponseDto;
|
|
|
|
test.beforeAll(async () => {
|
|
utils.initSdk();
|
|
await utils.resetDatabase();
|
|
admin = await utils.adminSetup();
|
|
});
|
|
|
|
test('enter and exit maintenance mode', async ({ context, page }) => {
|
|
await utils.setAuthCookies(context, admin.accessToken);
|
|
|
|
await page.goto('/admin/system-settings?isOpen=maintenance');
|
|
await page.getByRole('button', { name: 'Start maintenance mode' }).click();
|
|
|
|
await expect(page.getByText('Temporarily Unavailable')).toBeVisible({ timeout: 10_000 });
|
|
await page.getByRole('button', { name: 'End maintenance mode' }).click();
|
|
await page.waitForURL('**/admin/system-settings*', { timeout: 10_000 });
|
|
});
|
|
|
|
test('maintenance shows no options to users until they authenticate', async ({ page }) => {
|
|
const setCookie = await utils.enterMaintenance(admin.accessToken);
|
|
const cookie = setCookie
|
|
?.map((cookie) => cookie.split(';')[0].split('='))
|
|
?.find(([name]) => name === 'immich_maintenance_token');
|
|
|
|
expect(cookie).toBeTruthy();
|
|
|
|
await expect(async () => {
|
|
await page.goto('/');
|
|
await page.waitForURL('**/maintenance?**', {
|
|
timeout: 1000,
|
|
});
|
|
}).toPass({ timeout: 10_000 });
|
|
|
|
await expect(page.getByText('Temporarily Unavailable')).toBeVisible();
|
|
await expect(page.getByRole('button', { name: 'End maintenance mode' })).toHaveCount(0);
|
|
|
|
await page.goto(`/maintenance?${new URLSearchParams({ token: cookie![1] })}`);
|
|
await expect(page.getByText('Temporarily Unavailable')).toBeVisible();
|
|
await expect(page.getByRole('button', { name: 'End maintenance mode' })).toBeVisible();
|
|
await page.getByRole('button', { name: 'End maintenance mode' }).click();
|
|
await page.waitForURL('**/auth/login');
|
|
});
|
|
});
|