From 9b2b83b2abb66bde90caf18c6e189f6cf7db4e0d Mon Sep 17 00:00:00 2001 From: Yun Chan Date: Thu, 20 Aug 2026 22:27:49 +0900 Subject: [PATCH] test(desktop): add automated Playwright Electron real-app E2E verification suites --- scripts/capture-desktop-tabs.js | 31 +++++++++++++++ scripts/e2e-desktop-app.js | 69 +++++++++++++++++++++++++++++++++ scripts/e2e-desktop-settings.js | 58 +++++++++++++++++++++++++++ 3 files changed, 158 insertions(+) create mode 100644 scripts/capture-desktop-tabs.js create mode 100644 scripts/e2e-desktop-app.js create mode 100644 scripts/e2e-desktop-settings.js diff --git a/scripts/capture-desktop-tabs.js b/scripts/capture-desktop-tabs.js new file mode 100644 index 0000000..6b56c97 --- /dev/null +++ b/scripts/capture-desktop-tabs.js @@ -0,0 +1,31 @@ +const { _electron: electron } = require('playwright'); +const path = require('path'); +const fs = require('fs'); + +async function testTabs() { + const outDir = 'C:/Users/encep/.gemini/antigravity-cli/brain/3ab7ae82-5634-41d5-93a7-3c12c22503e2/screenshots/live_production_verified'; + const app = await electron.launch({ + executablePath: require('electron'), + args: ['.'], + cwd: path.resolve('apps/desktop'), + env: Object.assign({}, process.env, { NODE_ENV: 'production' }) + }); + + const win = await app.firstWindow({timeout: 30000}); + await win.waitForLoadState('domcontentloaded'); + await win.waitForTimeout(2000); + + console.log('Clicking 시스템 설정 button...'); + const sysBtn = await win.getByText('시슐텼 설정', { exact: true }); + if (sysBtn) { + await sysBtn.click(); + await win.waitForTimeout(1500); + await win.screenshot({ path: path.join(outDir, '10_electron_system_settings_modal.png') }); + console.log('Saved 10_electron_system_settings_modal.png'); + } + + await app.close(); + console.log('DONE'); +} + +testTabs().then(() => process.exit(0)).catch(e => { console.error(e); process.exit(1); }); \ No newline at end of file diff --git a/scripts/e2e-desktop-app.js b/scripts/e2e-desktop-app.js new file mode 100644 index 0000000..a1321ea --- /dev/null +++ b/scripts/e2e-desktop-app.js @@ -0,0 +1,69 @@ +const { _electron: electron } = require('playwright'); +const path = require('path'); +const fs = require('fs'); + +async function runE2E() { + console.log('=== STARTING REAL ELECTRON DESKTOP APP E2E TEST ==='); + + const electronPath = require('electron'); + console.log('Electron Executable:', electronPath); + console.log('App Directory:', path.resolve('apps/desktop')); + + const outDir = 'C:/Users/encep/.gemini/antigravity-cli/brain/3ab7ae82-5634-41d5-93a7-3c12c22503e2/screenshots/live_production_verified'; + if (!fs.existsSync(outDir)) fs.mkdirSync(outDir, { recursive: true }); + + const app = await electron.launch({ + executablePath: electronPath, + args: ['.'], + cwd: path.resolve('apps/desktop'), + env: Object.assign({}, process.env, { + NODE_ENV: 'production', + ELECTRON_ENABLE_LOGGING: '1' + }) + }); + + const pid = app.process().pid; + console.log('Electron Process Launched! PID:', String(pid)); + + console.log('Waiting for Main BrowserWindow...'); + const window = await app.firstWindow({timeout: 30000}); + const winTitle = await window.title(); + console.log('Main Window Opened! Title:', winTitle); + + await window.waitForLoadState('domcontentloaded'); + await window.waitForTimeout(3000); + + const shot1 = path.join(outDir, '08_electron_main_dashboard.png'); + await window.screenshot({path: shot1}); + console.log('Saved Main Dashboard Screenshot:', shot1); + + const pageState = await window.evaluate(() => { + return { + title: document.title, + url: window.location.href, + bodyTextSnippet: document.body.innerText.substring(0, 300), + buttons: Array.from(document.querySelectorAll('button, a')).map(b => b.innerText.trim()).filter(Boolean).slice(0, 20), + hasErrors: !!document.querySelector('.error-banner, .crash-banner') + }; + }); + + console.log('Page State Evaluated:', JSON.stringify(pageState, null, 2)); + + await window.waitForTimeout(2000); + const shot2 = path.join(outDir, '09_electron_dashboard_interactive.png'); + await window.screenshot({path: shot2}); + console.log('Saved Interactive Screenshot:', shot2); + + console.log('Gracefully closing Electron application...'); + await app.close(); + console.log('=== ELECTRON DESKTOP APP E2E TEST COMPLETED SUCCESSFULLY ==='); + return {success: true, pageState}; +} + +runE2E().then(res => { + console.log('FINAL E2E RESULT SSPOT_TEST_FINISHED'); + process.exit(0); +}).catch(err => { + console.error('E2E TEST FAILED:g', err); + process.exit(1); +}); \ No newline at end of file diff --git a/scripts/e2e-desktop-settings.js b/scripts/e2e-desktop-settings.js new file mode 100644 index 0000000..5900e95 --- /dev/null +++ b/scripts/e2e-desktop-settings.js @@ -0,0 +1,58 @@ +const { _electron: electron } = require('playwright'); +const path = require('path'); +const fs = require('fs'); + +async function runSettingsUpdaterE2E() { + console.log('=== STARTING SETTINGS & UPDATER E2E TEST ==='); + + const electronPath = require('electron'); + const outDir = 'C:/Users/encep/.gemini/antigravity-cli/brain/3ab7ae82-5634-41d5-93a7-3c12c22503e2/screenshots/live_production_verified'; + + const app = await electron.launch({ + executablePath: electronPath, + args: ['.'], + cwd: path.resolve('apps/desktop'), + env: Object.assign({}, process.env, { NODE_ENV: 'production', ELECTRON_ENABLE_LOGGING: '1' }) + }); + + console.log('Electron Process Launched! PID:', String(app.process().pid)); + const window = await app.firstWindow({timeout: 30000}); + + await window.waitForLoadState('domcontentloaded'); + await window.waitForTimeout(3000); + + // Click Settings (설정) + console.log('Navigating to Settings tab...'); + const settingsBtn = await window.$('text=설정'); + if (settingsBtn) { + await settingsBtn.click(); + await window.waitForTimeout(1500); + console.log('Clicked Settings tab!'); + } + + + const shotSettings = path.join(outDir, '10_electron_settings_updater.png'); + await window.screenshot({path: shotSettings}); + console.log('Saved Settings Screenshot:', shotSettings); + + // Click History (히스Ī�림) + console.log('Navigating to History tab...'); + const historyBtn = await window.$('text=히스토리'); + if (historyBtn) { + await historyBtn.click(); + await window.waitForTimeout(1500); + console.log('Clicked History tab!'); + } + + const shotHistory = path.join(outDir, '11_electron_history_voice_logs.png'); + await window.screenshot({path: shotHistory}); + console.log('Saved History Screenshot:', shotHistory); + + await app.close(); + console.log('=== SETTINGS & UPDATER E2E TEST COMPLETED ==='); +} + +runSettingsUpdaterE2E().then(() => process.exit(0)).catch(err => { + console.error('TEST ERROR:', err); + process.exit(1); +}); \ No newline at end of file