Skip to content
This repository has been archived by the owner on Jan 1, 2025. It is now read-only.

Commit

Permalink
test: more logging for beforeEach
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsSim committed Sep 1, 2024
1 parent cd2dbb5 commit 52b3b4c
Showing 1 changed file with 35 additions and 30 deletions.
65 changes: 35 additions & 30 deletions app/tests/e2e/util/setup-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,36 +52,41 @@ module.exports = () => {
} );

test.beforeEach( async () => {

Check failure on line 54 in app/tests/e2e/util/setup-test.js

View workflow job for this annotation

GitHub Actions / build-launcher (macos-latest)

tests/e2e/01-main.spec.js:8:3 › main › starts the app

1) tests/e2e/01-main.spec.js:8:3 › main › starts the app ───────────────────────────────────────── Test timeout of 30000ms exceeded while running "beforeEach" hook. at tests/e2e/util/setup-test.js:54 52 | } ); 53 | > 54 | test.beforeEach( async () => { | ^ 55 | try { 56 | console.info( '[beforeEach] starting beforeEach' ); 57 | // Reset console errors at the start of each test at /Users/runner/work/fsolauncher/fsolauncher/app/tests/e2e/util/setup-test.js:54:8
console.info( '[beforeEach] starting beforeEach' );
// Reset console errors at the start of each test
logs = [];

// Pass in --test-mode for headless testing
electronApp = await electron.launch( {
timeout: 60000,
cwd: exeDir,
args: [ appInfo.main, '--disable-http-cache', '--fl-test-mode' ],
executablePath: appInfo.executable // Path to the Electron executable
} );
console.info( '[beforeEach] launched electronApp' );

await electronApp.evaluate( async ( { session } ) => await session.defaultSession.clearCache() );

// Log main process
electronApp.process().stdout.on( 'data', data => console.info( `[main] ${data}` ) );
electronApp.process().stderr.on( 'data', error => console.info( `[main] ${error}` ) );
electronApp.process().stderr.on( 'data', error => logs.push( `[main] ${error}` ) );

page = await electronApp.firstWindow();
console.info( '[beforeEach] waited for firstWindow' );

// Log renderer process
page.on( 'console', log => console.info( `[renderer] ${log.text()}` ) );
page.on( 'console', log => {
if ( log.type() === 'error' ) {
logs.push( `[renderer] ${log.text()}` );
}
} );
try {
console.info( '[beforeEach] starting beforeEach' );
// Reset console errors at the start of each test
logs = [];

// Pass in --test-mode for headless testing
electronApp = await electron.launch( {
timeout: 120000,
cwd: exeDir,
args: [ appInfo.main, '--disable-http-cache', '--fl-test-mode' ],
executablePath: appInfo.executable // Path to the Electron executable
} );
console.info( '[beforeEach] launched electronApp' );

await electronApp.evaluate( async ( { session } ) => await session.defaultSession.clearCache() );

// Log main process
electronApp.process().stdout.on( 'data', data => console.info( `[main] ${data}` ) );
electronApp.process().stderr.on( 'data', error => console.info( `[main] ${error}` ) );
electronApp.process().stderr.on( 'data', error => logs.push( `[main] ${error}` ) );

page = await electronApp.firstWindow();
console.info( '[beforeEach] waited for firstWindow' );

// Log renderer process
page.on( 'console', log => console.info( `[renderer] ${log.text()}` ) );
page.on( 'console', log => {
if ( log.type() === 'error' ) {
logs.push( `[renderer] ${log.text()}` );
}
} );
} catch ( error ) {
console.error( '[beforeEach] failed to launch electronApp:', error );
throw error;
}
} );

test.afterEach( async () => {
Expand Down

0 comments on commit 52b3b4c

Please sign in to comment.