From abc1f9c0badc8e9b3d8cfd5289b7b511285f1741 Mon Sep 17 00:00:00 2001 From: Aetherinox Date: Wed, 24 Jul 2024 10:18:40 -0700 Subject: [PATCH] tests: add test 2 --- tests/main.spec.js | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) 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() +} )