Browse Source

tidy up .auth

Yuki Takei 1 year ago
parent
commit
35c7c279b7

+ 3 - 1
apps/app/playwright.config.ts

@@ -1,3 +1,5 @@
+import fs from 'node:fs';
+
 import { defineConfig, devices } from '@playwright/test';
 
 /**
@@ -44,7 +46,7 @@ export default defineConfig({
     viewport: { width: 1400, height: 1024 },
 
     // Use prepared auth state.
-    storageState: 'playwright/.auth/user.json',
+    storageState: fs.existsSync('playwright/.auth/admin.json') ? 'playwright/.auth/admin.json' : undefined,
   },
 
   /* Configure projects for major browsers */

+ 0 - 0
apps/app/playwright/.auth/.gitkeep


+ 0 - 1
apps/app/playwright/.auth/user.json

@@ -1 +0,0 @@
-{}

+ 1 - 1
apps/app/playwright/auth.setup.ts

@@ -1,6 +1,6 @@
 import { test as setup, expect } from '@playwright/test';
 
-const authFile = 'playwright/.auth/user.json';
+const authFile = 'playwright/.auth/admin.json';
 
 setup('Authenticate as the "admin" user', async({ page }) => {
   // Perform authentication steps. Replace these actions with your own.