🔧(e2e) improve e2e test debugging and db cleanup

Preserve django_site table during e2e db clearing to
avoid breaking site configuration. Add video recording
on first retry and screenshot capture on failure for
easier debugging of flaky tests.
This commit is contained in:
Nathan Vasse
2026-02-06 11:03:09 +01:00
committed by Manuel Raynaud
parent 2d67ecc8f4
commit d2ccd79e8c
2 changed files with 3 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
DO $$
DECLARE r RECORD;
BEGIN
FOR r IN (SELECT tablename FROM pg_tables WHERE schemaname = 'public' AND tablename != 'django_migrations')
FOR r IN (SELECT tablename FROM pg_tables WHERE schemaname = 'public' AND tablename != 'django_migrations' AND tablename != 'django_site')
LOOP
RAISE NOTICE 'Truncating table %', r.tablename;
EXECUTE 'TRUNCATE TABLE ' || quote_ident(r.tablename) || ' CASCADE';

View File

@@ -29,6 +29,8 @@ export default defineConfig({
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
video: 'on-first-retry',
screenshot: 'only-on-failure',
},
webServer: {