diff --git a/tests/main.spec.js b/tests/main.spec.js index 70c9317..e61220f 100644 --- a/tests/main.spec.js +++ b/tests/main.spec.js @@ -44,3 +44,58 @@ test( 'launch ntfy-desktop', async () => await app.close() } ) + +/* + Test > full loadup and screenshot +*/ + +test( 'full load', async () => +{ + + /* + Initialize + */ + + const app = await electron.launch( { + args: [ + 'index.js', + '--quit' + ], + env: { + ...process.env, + NODE_ENV: 'development' + } + } ) + + const timestamp = Date.now().toString() + + const appPath = await app.evaluate( async ( { app } ) => + { + return app.getAppPath() + } ) + + console.log( appPath ) + + const window = await app.firstWindow() + console.log( await window.title() ) + window.on( 'console', console.log ) + + /* + wait for #root div before taking screenshot + */ + + await window.waitForSelector( '#root', { state: 'visible' } ) + + /* + path: `e2e/screenshots/test-${timestamp}.png`, + */ + + const ss1 = await window.screenshot( { path: './test-results/1.png' } ) + + /* + Since the close button minimizes to tray, activate the menu and select quit + */ + + await eph.clickMenuItemById( app, 'quit' ) + await app.close() +} )