mirror of
https://github.com/immich-app/immich.git
synced 2025-12-17 01:11:13 +03:00
chore: web e2e improvements (#7155)
This commit is contained in:
@@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test';
|
||||
import { app } from '../test-utils';
|
||||
|
||||
test.describe('Registration', () => {
|
||||
test.beforeAll(async () => {
|
||||
test.beforeEach(async () => {
|
||||
await app.reset();
|
||||
});
|
||||
|
||||
|
||||
@@ -63,17 +63,26 @@ export const app = {
|
||||
return response;
|
||||
},
|
||||
reset: async () => {
|
||||
if (!connected) {
|
||||
await client.connect();
|
||||
}
|
||||
try {
|
||||
if (!connected) {
|
||||
await client.connect();
|
||||
connected = true;
|
||||
}
|
||||
|
||||
for (const table of ['users', 'system_metadata']) {
|
||||
await client.query(`DELETE FROM ${table} CASCADE;`);
|
||||
for (const table of ['user_token', 'users', 'system_metadata']) {
|
||||
await client.query(`DELETE FROM ${table} CASCADE;`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to reset database', error);
|
||||
}
|
||||
},
|
||||
teardown: async () => {
|
||||
if (connected) {
|
||||
await client.end();
|
||||
try {
|
||||
if (connected) {
|
||||
await client.end();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to teardown database', error);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user