1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2024-12-29 15:11:58 +00:00

chore: web e2e improvements (#7155)

This commit is contained in:
Jason Rasmussen 2024-02-16 16:31:22 -05:00 committed by GitHub
parent 67b1675850
commit a24f3805c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 19 additions and 17 deletions

View file

@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test';
import { app } from '../test-utils'; import { app } from '../test-utils';
test.describe('Registration', () => { test.describe('Registration', () => {
test.beforeAll(async () => { test.beforeEach(async () => {
await app.reset(); await app.reset();
}); });

View file

@ -63,17 +63,26 @@ export const app = {
return response; return response;
}, },
reset: async () => { reset: async () => {
if (!connected) { try {
await client.connect(); if (!connected) {
} await client.connect();
connected = true;
}
for (const table of ['users', 'system_metadata']) { for (const table of ['user_token', 'users', 'system_metadata']) {
await client.query(`DELETE FROM ${table} CASCADE;`); await client.query(`DELETE FROM ${table} CASCADE;`);
}
} catch (error) {
console.error('Failed to reset database', error);
} }
}, },
teardown: async () => { teardown: async () => {
if (connected) { try {
await client.end(); if (connected) {
await client.end();
}
} catch (error) {
console.error('Failed to teardown database', error);
} }
}, },
}; };

View file

@ -35,7 +35,6 @@ export enum AppRoute {
PARTNERS = '/partners', PARTNERS = '/partners',
AUTH_LOGIN = '/auth/login', AUTH_LOGIN = '/auth/login',
AUTH_LOGOUT = '/auth/logout',
AUTH_REGISTER = '/auth/register', AUTH_REGISTER = '/auth/register',
AUTH_CHANGE_PASSWORD = '/auth/change-password', AUTH_CHANGE_PASSWORD = '/auth/change-password',
AUTH_ONBOARDING = '/auth/onboarding', AUTH_ONBOARDING = '/auth/onboarding',

View file

@ -20,7 +20,7 @@ export async function handleError(error: unknown, message: string) {
return; return;
} }
console.error(`[handleError]: ${message}`, error); console.error(`[handleError]: ${message}`, error, (error as Error)?.stack);
let serverMessage = await getServerErrorMessage(error); let serverMessage = await getServerErrorMessage(error);
if (serverMessage) { if (serverMessage) {

View file

@ -7,12 +7,6 @@
import type { PageData } from './$types'; import type { PageData } from './$types';
export let data: PageData; export let data: PageData;
const onSuccessHandler = async () => {
await fetch(AppRoute.AUTH_LOGOUT, { method: 'POST' });
goto(AppRoute.AUTH_LOGIN);
};
</script> </script>
<FullscreenContainer title={data.meta.title}> <FullscreenContainer title={data.meta.title}>
@ -24,5 +18,5 @@
enter the new password below. enter the new password below.
</p> </p>
<ChangePasswordForm user={$user} on:success={onSuccessHandler} /> <ChangePasswordForm user={$user} on:success={() => goto(AppRoute.AUTH_LOGIN)} />
</FullscreenContainer> </FullscreenContainer>