File tree Expand file tree Collapse file tree 3 files changed +28
-12
lines changed
Expand file tree Collapse file tree 3 files changed +28
-12
lines changed Original file line number Diff line number Diff line change @@ -2544,6 +2544,7 @@ class ProjectManager {
25442544 }
25452545
25462546 async updateHostsFile ( project ) {
2547+ if ( process . env . PLAYWRIGHT_TEST === 'true' ) return ;
25472548 // Add all project domains to hosts file
25482549 const domainsToAdd = [ ] ;
25492550
@@ -3088,6 +3089,7 @@ server {
30883089
30893090 // Add domain to hosts file (requires admin privileges)
30903091 async addToHostsFile ( domain ) {
3092+ if ( process . env . PLAYWRIGHT_TEST === 'true' ) return ;
30913093 if ( ! domain ) return ;
30923094
30933095 // Security: Validate domain before using in any commands
@@ -3186,6 +3188,7 @@ server {
31863188
31873189 // Remove domain from hosts file
31883190 async removeFromHostsFile ( domain ) {
3191+ if ( process . env . PLAYWRIGHT_TEST === 'true' ) return ;
31893192 if ( ! domain ) return ;
31903193
31913194 const hostsPath = process . platform === 'win32'
Original file line number Diff line number Diff line change @@ -6,9 +6,11 @@ const fs = require('fs-extra');
66class ConfigStore {
77 constructor ( ) {
88 try {
9+ const defaultData = this . getDefaults ( ) ;
910 this . store = new Store ( {
1011 name : 'devbox-pro-config' ,
11- defaults : this . getDefaults ( ) ,
12+ defaults : defaultData ,
13+ cwd : defaultData . dataPath
1214 } ) ;
1315
1416 // Ensure data directory exists
@@ -27,12 +29,19 @@ class ConfigStore {
2729 }
2830
2931 getDefaults ( ) {
30- const dataPath = path . join ( os . homedir ( ) , '.devbox-pro' ) ;
31-
32- // Platform-specific default projects path
33- const defaultProjectsPath = process . platform === 'win32'
34- ? 'C:/Projects'
35- : path . join ( os . homedir ( ) , 'Projects' ) ;
32+ let dataPath ;
33+ let defaultProjectsPath ;
34+
35+ if ( process . env . PLAYWRIGHT_TEST === 'true' ) {
36+ const baseDir = process . env . TEST_USER_DATA_DIR || os . tmpdir ( ) ;
37+ dataPath = path . join ( baseDir , '.devbox-pro-test' ) ;
38+ defaultProjectsPath = path . join ( dataPath , 'Projects' ) ;
39+ } else {
40+ dataPath = path . join ( os . homedir ( ) , '.devbox-pro' ) ;
41+ defaultProjectsPath = process . platform === 'win32'
42+ ? 'C:/Projects'
43+ : path . join ( os . homedir ( ) , 'Projects' ) ;
44+ }
3645
3746 return {
3847 dataPath,
Original file line number Diff line number Diff line change @@ -13,14 +13,18 @@ export const test = base.extend({
1313 // Create a temporary, random user data directory for true isolation
1414 const tempUserDataDir = path . join ( os . tmpdir ( ) , `devbox-e2e-${ crypto . randomUUID ( ) } ` ) ;
1515
16+ const envArgs = {
17+ ...process . env ,
18+ NODE_ENV : 'production' ,
19+ PLAYWRIGHT_TEST : 'true' , // Optional flag for internal mocking if needed
20+ TEST_USER_DATA_DIR : tempUserDataDir , // Explicitly pass to app
21+ } ;
22+ delete envArgs . ELECTRON_RUN_AS_NODE ;
23+
1624 // Launch Electron via Playwright
1725 const electronApp = await electron . launch ( {
1826 args : [ mainEntry , '--user-data-dir' , tempUserDataDir ] ,
19- env : {
20- ...process . env ,
21- NODE_ENV : 'production' ,
22- PLAYWRIGHT_TEST : 'true' , // Optional flag for internal mocking if needed
23- }
27+ env : envArgs
2428 } ) ;
2529
2630 // Pass control back to the test
You can’t perform that action at this time.
0 commit comments