Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor E2E tests initialization #270

Merged
merged 6 commits into from
Jun 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove deprecated launchApp E2E helper function
  • Loading branch information
fluiddot committed Jun 18, 2024
commit 3f7758f84a235fc60a82faf87ea50ed96768b647
28 changes: 1 addition & 27 deletions e2e/e2e-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class E2ESession {
},
timeout: 60_000,
} );
this.mainWindow = await this.electronApp.firstWindow();
this.mainWindow = await this.electronApp.firstWindow( { timeout: 60_000 } );
}

async cleanup() {
Expand All @@ -55,29 +55,3 @@ export class E2ESession {
fs.rmSync( this.sessionPath, { recursive: true, force: true } );
}
}

export async function launchApp( testEnv: NodeJS.ProcessEnv = {} ) {
// find the latest build in the out directory
const latestBuild = findLatestBuild();

// parse the packaged Electron app and find paths and other info
const appInfo = parseElectronApp( latestBuild );
let executablePath = appInfo.executable;
if ( appInfo.platform === 'win32' ) {
// `parseElectronApp` function obtains the executable path by finding the first executable from the build folder.
// We need to ensure that the executable is the Studio app.
executablePath = executablePath.replace( 'Squirrel.exe', 'Studio.exe' );
}
const electronApp = await electron.launch( {
args: [ appInfo.main ], // main file from package.json
executablePath, // path to the Electron executable
env: {
...process.env,
...testEnv,
E2E: 'true', // allow app to determine whether it's running as an end-to-end test
},
} );
const mainWindow = await electronApp.firstWindow( { timeout: 60_000 } );

return [ electronApp, mainWindow ] as const;
}
Loading