Yuki Takei пре 1 година
родитељ
комит
55c7c86515
2 измењених фајлова са 7 додато и 2 уклоњено
  1. 4 1
      apps/app/playwright.config.ts
  2. 3 1
      apps/app/playwright/auth.setup.ts

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

@@ -1,7 +1,10 @@
 import fs from 'node:fs';
 import fs from 'node:fs';
+import path from 'node:path';
 
 
 import { defineConfig, devices } from '@playwright/test';
 import { defineConfig, devices } from '@playwright/test';
 
 
+const authFile = path.resolve(__dirname, './playwright/.auth/admin.json');
+
 /**
 /**
  * Read environment variables from file.
  * Read environment variables from file.
  * https://github.com/motdotla/dotenv
  * https://github.com/motdotla/dotenv
@@ -46,7 +49,7 @@ export default defineConfig({
     viewport: { width: 1400, height: 1024 },
     viewport: { width: 1400, height: 1024 },
 
 
     // Use prepared auth state.
     // Use prepared auth state.
-    storageState: fs.existsSync('playwright/.auth/admin.json') ? 'playwright/.auth/admin.json' : undefined,
+    storageState: fs.existsSync(authFile) ? authFile : undefined,
   },
   },
 
 
   /* Configure projects for major browsers */
   /* Configure projects for major browsers */

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

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