From 7f74fb05fc92adc93fe796cf26cfb108d0e84948 Mon Sep 17 00:00:00 2001 From: Pulse Monitor Date: Thu, 7 Aug 2025 11:16:11 +0000 Subject: [PATCH] chore: remove test files --- debug-page.js | 72 --------------------- find-settings.js | 100 ----------------------------- package-lock.json | 58 ----------------- package.json | 26 -------- test-408-update.js | 116 --------------------------------- test-settings.js | 78 ---------------------- test-update-button.js | 97 ---------------------------- test-update-debug.js | 94 --------------------------- test-update-ui.js | 78 ---------------------- test-update.js | 107 ------------------------------- test-update2.js | 107 ------------------------------- test-update3.js | 146 ------------------------------------------ test-update4.js | 134 -------------------------------------- 13 files changed, 1213 deletions(-) delete mode 100644 debug-page.js delete mode 100644 find-settings.js delete mode 100644 package-lock.json delete mode 100644 package.json delete mode 100644 test-408-update.js delete mode 100644 test-settings.js delete mode 100644 test-update-button.js delete mode 100644 test-update-debug.js delete mode 100644 test-update-ui.js delete mode 100644 test-update.js delete mode 100644 test-update2.js delete mode 100644 test-update3.js delete mode 100644 test-update4.js diff --git a/debug-page.js b/debug-page.js deleted file mode 100644 index 8ecd39473..000000000 --- a/debug-page.js +++ /dev/null @@ -1,72 +0,0 @@ -const { chromium } = require('playwright'); - -(async () => { - const browser = await chromium.launch({ - headless: true, - args: ['--no-sandbox', '--disable-setuid-sandbox'] - }); - - const context = await browser.newContext({ - ignoreHTTPSErrors: true, - viewport: { width: 1280, height: 720 } - }); - - const page = await context.newPage(); - - console.log('Opening Pulse at http://192.168.0.212:7655'); - await page.goto('http://192.168.0.212:7655', { waitUntil: 'networkidle' }); - await page.waitForTimeout(3000); - - // Debug page structure - console.log('\n=== Page Title ==='); - console.log(await page.title()); - - console.log('\n=== All Links ==='); - const allLinks = await page.locator('a').all(); - for (const link of allLinks) { - const text = await link.textContent(); - const href = await link.getAttribute('href'); - if (text) console.log(`Link: "${text}" -> ${href}`); - } - - console.log('\n=== All Buttons ==='); - const allButtons = await page.locator('button').all(); - for (let i = 0; i < Math.min(10, allButtons.length); i++) { - const text = await allButtons[i].textContent(); - if (text) console.log(`Button: "${text}"`); - } - - console.log('\n=== Navigation Elements ==='); - const navElements = await page.locator('nav, header, [class*="nav"], [class*="menu"]').all(); - console.log(`Found ${navElements.length} navigation-like elements`); - - console.log('\n=== Checking for Settings ==='); - // Try different ways to find Settings - const settingsSelectors = [ - 'text="Settings"', - 'a:has-text("Settings")', - 'button:has-text("Settings")', - '[href*="settings"]', - 'svg[class*="settings"], svg[class*="gear"], svg[class*="cog"]' - ]; - - for (const selector of settingsSelectors) { - const element = await page.locator(selector).first(); - if (await element.isVisible({ timeout: 500 }).catch(() => false)) { - console.log(`Found with selector: ${selector}`); - - // Try to get parent if it's an icon - if (selector.includes('svg')) { - const parent = await element.locator('..').first(); - const parentTag = await parent.evaluate(el => el.tagName); - console.log(`Parent element: ${parentTag}`); - } - } - } - - // Take screenshot - await page.screenshot({ path: '/tmp/debug-page.png', fullPage: true }); - console.log('\nScreenshot saved to /tmp/debug-page.png'); - - await browser.close(); -})(); \ No newline at end of file diff --git a/find-settings.js b/find-settings.js deleted file mode 100644 index fe2ec48fe..000000000 --- a/find-settings.js +++ /dev/null @@ -1,100 +0,0 @@ -const { chromium } = require('playwright'); - -(async () => { - const browser = await chromium.launch({ - headless: true, - args: ['--no-sandbox', '--disable-setuid-sandbox'] - }); - - const context = await browser.newContext({ - ignoreHTTPSErrors: true, - viewport: { width: 1280, height: 720 } - }); - - const page = await context.newPage(); - - console.log('Opening Pulse at http://192.168.0.212:7655'); - await page.goto('http://192.168.0.212:7655', { waitUntil: 'networkidle' }); - await page.waitForTimeout(3000); - - // Find Settings element - const settingsElement = await page.locator('text="Settings"').first(); - - if (await settingsElement.isVisible()) { - console.log('Settings element found!'); - - // Get bounding box - const box = await settingsElement.boundingBox(); - console.log('Position:', box); - - // Get parent elements - let current = settingsElement; - for (let i = 0; i < 5; i++) { - current = await current.locator('..').first(); - const tag = await current.evaluate(el => el.tagName); - const className = await current.evaluate(el => el.className); - const id = await current.evaluate(el => el.id); - console.log(`Parent ${i+1}: ${tag} class="${className}" id="${id}"`); - } - - // Check if it's clickable - const isClickable = await settingsElement.evaluate(el => { - const tag = el.tagName.toLowerCase(); - return tag === 'a' || tag === 'button' || el.onclick !== null || el.style.cursor === 'pointer'; - }); - console.log('Is clickable element:', isClickable); - - // Try to click it - console.log('Attempting to click Settings...'); - try { - await settingsElement.click(); - await page.waitForTimeout(2000); - - // Check if URL changed - console.log('New URL:', page.url()); - - // Check if we're on Settings page - const systemTab = await page.locator('button:has-text("System")').first(); - if (await systemTab.isVisible()) { - console.log('SUCCESS! Settings page loaded, System tab visible'); - - // Click System tab - await systemTab.click(); - await page.waitForTimeout(1000); - - // Look for update elements - const updateElements = await page.locator('text=/Update|Version/').all(); - console.log(`\nFound ${updateElements.length} update-related elements:`); - for (const el of updateElements) { - console.log(`- ${await el.textContent()}`); - } - - // Look for Check for Updates button - const checkButton = await page.locator('button:has-text("Check for Updates")').first(); - if (await checkButton.isVisible()) { - console.log('\nFound "Check for Updates" button!'); - } else { - console.log('\n"Check for Updates" button not found'); - - // List all buttons in System tab - const buttons = await page.locator('button').all(); - console.log(`\nAll buttons (${buttons.length}):`); - for (const btn of buttons) { - const text = await btn.textContent(); - if (text && text.trim()) console.log(`- "${text}"`); - } - } - } - } catch (error) { - console.log('Click failed:', error.message); - } - } else { - console.log('Settings element not visible'); - } - - // Take screenshot - await page.screenshot({ path: '/tmp/settings-page.png', fullPage: true }); - console.log('\nScreenshot saved to /tmp/settings-page.png'); - - await browser.close(); -})(); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index e4a8574ea..000000000 --- a/package-lock.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "pulse", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "pulse", - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "playwright": "^1.54.2" - }, - "devDependencies": {} - }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/playwright": { - "version": "1.54.2", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.54.2.tgz", - "integrity": "sha512-Hu/BMoA1NAdRUuulyvQC0pEqZ4vQbGfn8f7wPXcnqQmM+zct9UliKxsIkLNmz/ku7LElUNqmaiv1TG/aL5ACsw==", - "dependencies": { - "playwright-core": "1.54.2" - }, - "bin": { - "playwright": "cli.js" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "fsevents": "2.3.2" - } - }, - "node_modules/playwright-core": { - "version": "1.54.2", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.54.2.tgz", - "integrity": "sha512-n5r4HFbMmWsB4twG7tJLDN9gmBUeSPcsBZiWSE4DnYz9mJMAFqr2ID7+eGC9kpEnxExJ1epttwR59LEWCk8mtA==", - "bin": { - "playwright-core": "cli.js" - }, - "engines": { - "node": ">=18" - } - } - } -} diff --git a/package.json b/package.json deleted file mode 100644 index c7c3c6237..000000000 --- a/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "dependencies": { - "playwright": "^1.54.2" - }, - "name": "pulse", - "description": "Real-time monitoring for Proxmox VE and PBS with alerts and webhooks.", - "version": "1.0.0", - "main": "test-update.js", - "directories": { - "doc": "docs" - }, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/rcourtman/Pulse.git" - }, - "keywords": [], - "author": "", - "license": "ISC", - "bugs": { - "url": "https://github.com/rcourtman/Pulse/issues" - }, - "homepage": "https://github.com/rcourtman/Pulse#readme" -} diff --git a/test-408-update.js b/test-408-update.js deleted file mode 100644 index 54540c1da..000000000 --- a/test-408-update.js +++ /dev/null @@ -1,116 +0,0 @@ -const { chromium } = require('playwright'); - -(async () => { - const browser = await chromium.launch({ - headless: true, - args: ['--no-sandbox', '--disable-setuid-sandbox'] - }); - - const context = await browser.newContext({ - ignoreHTTPSErrors: true, - viewport: { width: 1280, height: 720 } - }); - - const page = await context.newPage(); - - // Enable console logging - page.on('console', msg => { - const text = msg.text(); - if (!text.includes('WebSocket')) { - console.log('Browser:', text); - } - }); - page.on('pageerror', err => console.log('Page error:', err.message)); - page.on('response', response => { - if (response.url().includes('/api/updates')) { - console.log(`API ${response.url()} -> ${response.status()}`); - } - }); - - console.log('Opening Pulse v4.0.8 at http://192.168.0.212:7655'); - await page.goto('http://192.168.0.212:7655', { waitUntil: 'domcontentloaded' }); - await page.waitForTimeout(2000); - - // Click Settings - console.log('\nNavigating to Settings...'); - await page.locator('text="Settings"').first().click(); - await page.waitForTimeout(1000); - - // Click System tab - console.log('Clicking System tab...'); - await page.locator('button:has-text("System")').first().click(); - await page.waitForTimeout(1000); - - // Check current version display - const versionText = await page.locator('text=/Current Version.*4\\.0\\.8/').first(); - if (await versionText.isVisible()) { - console.log('Current version:', await versionText.textContent()); - } - - // Take screenshot before update check - await page.screenshot({ path: '/tmp/before-check.png' }); - console.log('Screenshot saved: /tmp/before-check.png'); - - // Click Check for Updates - console.log('\nClicking "Check for Updates"...'); - const checkButton = await page.locator('button:has-text("Check for Updates")').first(); - await checkButton.click(); - - // Wait for update check to complete - await page.waitForTimeout(3000); - - // Take screenshot after check - await page.screenshot({ path: '/tmp/after-check.png' }); - console.log('Screenshot saved: /tmp/after-check.png'); - - // Check what happened - console.log('\n=== Update Check Results ==='); - - // Look for update available message - const updateAvailable = await page.locator('text=/Update available|4\\.0\\.9|new version/i').all(); - for (const elem of updateAvailable) { - if (await elem.isVisible()) { - console.log('Found:', await elem.textContent()); - } - } - - // Check if Update Now button appeared - const updateNowButton = await page.locator('button:has-text("Update Now")').first(); - if (await updateNowButton.isVisible()) { - console.log('\n"Update Now" button is visible!'); - console.log('Clicking "Update Now"...'); - - await updateNowButton.click(); - await page.waitForTimeout(5000); - - // Take screenshot after update attempt - await page.screenshot({ path: '/tmp/after-update.png' }); - console.log('Screenshot saved: /tmp/after-update.png'); - - // Check for any error or success messages - const messages = await page.locator('.alert, [role="alert"], text=/error|success|failed|complete/i').all(); - for (const msg of messages) { - if (await msg.isVisible()) { - console.log('Message:', await msg.textContent()); - } - } - - // Check update status - const statusResponse = await page.evaluate(() => - fetch('/api/updates/status').then(r => r.json()) - ); - console.log('\nUpdate status:', statusResponse); - } else { - console.log('\n"Update Now" button NOT visible'); - - // List all visible buttons - const buttons = await page.locator('button:visible').all(); - console.log(`\nAll visible buttons (${buttons.length}):`); - for (const btn of buttons) { - const text = await btn.textContent(); - if (text && text.trim()) console.log(`- "${text}"`); - } - } - - await browser.close(); -})(); \ No newline at end of file diff --git a/test-settings.js b/test-settings.js deleted file mode 100644 index 33c434ecf..000000000 --- a/test-settings.js +++ /dev/null @@ -1,78 +0,0 @@ -const { chromium } = require('playwright'); - -(async () => { - const browser = await chromium.launch({ - headless: true, - args: ['--no-sandbox', '--disable-setuid-sandbox'] - }); - - const context = await browser.newContext({ - ignoreHTTPSErrors: true, - viewport: { width: 1280, height: 720 } - }); - - const page = await context.newPage(); - - console.log('Opening Pulse at http://192.168.0.212:7655'); - await page.goto('http://192.168.0.212:7655', { waitUntil: 'networkidle' }); - await page.waitForTimeout(2000); - - // Click on Settings in the navigation - console.log('Looking for Settings link...'); - const settingsLink = await page.locator('nav a').filter({ hasText: 'Settings' }).first(); - - if (await settingsLink.isVisible()) { - console.log('Found Settings link, clicking...'); - await settingsLink.click(); - await page.waitForTimeout(2000); - - // Look for System tab - const systemTab = await page.locator('button').filter({ hasText: 'System' }).first(); - if (await systemTab.isVisible()) { - console.log('Found System tab, clicking...'); - await systemTab.click(); - await page.waitForTimeout(1000); - - // Look for update section - const updateSection = await page.locator('text=/Current Version|Updates/').first(); - if (await updateSection.isVisible()) { - console.log('Found update section'); - - // Check for update button - const checkButton = await page.locator('button').filter({ hasText: 'Check for Updates' }).first(); - if (await checkButton.isVisible()) { - console.log('Found Check for Updates button'); - await checkButton.click(); - await page.waitForTimeout(3000); - - // Check what happened - const updateStatus = await page.locator('text=/up to date|available|4\\.0\\.9/i').first(); - if (await updateStatus.isVisible()) { - console.log('Update status:', await updateStatus.textContent()); - } - } else { - console.log('Check for Updates button not found'); - } - } else { - console.log('Update section not found'); - } - } else { - console.log('System tab not found'); - } - } else { - console.log('Settings link not visible'); - - // List all nav links - const navLinks = await page.locator('nav a').all(); - console.log(`Found ${navLinks.length} nav links:`); - for (const link of navLinks) { - console.log(`- ${await link.textContent()}`); - } - } - - // Take screenshot - await page.screenshot({ path: '/tmp/settings-test.png', fullPage: true }); - console.log('Screenshot saved to /tmp/settings-test.png'); - - await browser.close(); -})(); \ No newline at end of file diff --git a/test-update-button.js b/test-update-button.js deleted file mode 100644 index 5b5c88b0e..000000000 --- a/test-update-button.js +++ /dev/null @@ -1,97 +0,0 @@ -const { chromium } = require('playwright'); - -(async () => { - const browser = await chromium.launch({ - headless: true, - args: ['--no-sandbox', '--disable-setuid-sandbox'] - }); - - const context = await browser.newContext({ - ignoreHTTPSErrors: true, - viewport: { width: 1280, height: 720 } - }); - - const page = await context.newPage(); - - // Enable console logging - page.on('console', msg => { - if (!msg.text().includes('WebSocket')) { - console.log('Browser console:', msg.text()); - } - }); - page.on('pageerror', err => console.log('Page error:', err.message)); - - console.log('Opening Pulse and navigating to Settings...'); - await page.goto('http://192.168.0.212:7655', { waitUntil: 'networkidle' }); - await page.waitForTimeout(2000); - - // Click Settings - await page.locator('text="Settings"').first().click(); - await page.waitForTimeout(1000); - - // Click System tab - await page.locator('button:has-text("System")').first().click(); - await page.waitForTimeout(1000); - - console.log('\n=== Current Update Status ==='); - - // Check current version display - const versionText = await page.locator('text=/Current Version.*4\\.0\\.9/').first(); - if (await versionText.isVisible()) { - console.log('Current version shown:', await versionText.textContent()); - } - - // Check for existing update status - const statusText = await page.locator('text=/You are running the latest version|Update available/').first(); - if (await statusText.isVisible({ timeout: 1000 }).catch(() => false)) { - console.log('Update status:', await statusText.textContent()); - } - - console.log('\n=== Clicking Check for Updates ==='); - - // Click Check for Updates button - const checkButton = await page.locator('button:has-text("Check for Updates")').first(); - await checkButton.click(); - - // Wait for response - await page.waitForTimeout(3000); - - // Check what happened - console.log('\n=== After Update Check ==='); - - // Look for any status messages - const messages = [ - 'text=/You are running the latest version/', - 'text=/Update available/', - 'text=/Checking for updates/', - 'text=/Failed to check/', - 'text=/Error/', - '.alert', - '[role="alert"]' - ]; - - for (const selector of messages) { - const element = await page.locator(selector).first(); - if (await element.isVisible({ timeout: 500 }).catch(() => false)) { - const text = await element.textContent(); - console.log(`Found: ${text}`); - } - } - - // Check if Update Now button appeared - const updateNowButton = await page.locator('button:has-text("Update Now")').first(); - if (await updateNowButton.isVisible({ timeout: 500 }).catch(() => false)) { - console.log('\n"Update Now" button appeared!'); - console.log('This means an update was detected but we are already on latest version'); - } - - // Check button state - const isButtonDisabled = await checkButton.isDisabled(); - console.log(`\nCheck button is ${isButtonDisabled ? 'disabled' : 'enabled'}`); - - // Take screenshot - await page.screenshot({ path: '/tmp/update-check-result.png', fullPage: true }); - console.log('\nScreenshot saved to /tmp/update-check-result.png'); - - await browser.close(); -})(); \ No newline at end of file diff --git a/test-update-debug.js b/test-update-debug.js deleted file mode 100644 index 36e4f8274..000000000 --- a/test-update-debug.js +++ /dev/null @@ -1,94 +0,0 @@ -const { chromium } = require('playwright'); - -(async () => { - const browser = await chromium.launch({ - headless: true, - args: ['--no-sandbox', '--disable-setuid-sandbox'] - }); - - const context = await browser.newContext({ - ignoreHTTPSErrors: true, - viewport: { width: 1280, height: 720 } - }); - - const page = await context.newPage(); - - // Log API responses - page.on('response', response => { - if (response.url().includes('/api/updates/check')) { - response.json().then(data => { - console.log('API Response:', JSON.stringify(data, null, 2)); - }).catch(() => {}); - } - }); - - // Log console messages - page.on('console', msg => { - if (msg.type() === 'error') { - console.log('Browser error:', msg.text()); - } - }); - - console.log('Opening Pulse UI at http://localhost:7655'); - await page.goto('http://localhost:7655', { waitUntil: 'networkidle' }); - await page.waitForTimeout(2000); - - // Click Settings - console.log('\nNavigating to Settings...'); - await page.locator('text="Settings"').first().click(); - await page.waitForTimeout(1000); - - // Click System tab - console.log('Clicking System tab...'); - await page.locator('button:has-text("System")').first().click(); - await page.waitForTimeout(1000); - - // Click Check for Updates - console.log('\nClicking Check for Updates...'); - const checkButton = await page.locator('button:has-text("Check for Updates")').first(); - await checkButton.click(); - await page.waitForTimeout(3000); - - // Look for all elements that might contain update info - console.log('\n=== Looking for update-related elements ==='); - - // Check for success message - const successMsg = await page.locator('.alert, text=/You are running the latest version/i').all(); - for (const msg of successMsg) { - if (await msg.isVisible()) { - console.log('Found message:', await msg.textContent()); - } - } - - // Check for update available message - const updateMsg = await page.locator('text=/Update available/i').all(); - for (const msg of updateMsg) { - if (await msg.isVisible()) { - console.log('Found update message:', await msg.textContent()); - } - } - - // Check for Apply Update button - const applyButton = await page.locator('button:has-text("Apply Update")').first(); - if (await applyButton.isVisible({ timeout: 500 }).catch(() => false)) { - console.log('✓ Apply Update button is visible!'); - } else { - console.log('✗ Apply Update button NOT visible'); - } - - // Check all visible buttons - const allButtons = await page.locator('button:visible').all(); - console.log(`\nAll visible buttons (${allButtons.length}):`); - for (const btn of allButtons) { - const text = await btn.textContent(); - if (text && text.trim()) { - console.log(`- "${text.trim()}"`); - } - } - - // Take screenshot - await page.screenshot({ path: '/tmp/update-debug.png', fullPage: true }); - console.log('\nScreenshot saved to /tmp/update-debug.png'); - - await browser.close(); -})(); \ No newline at end of file diff --git a/test-update-ui.js b/test-update-ui.js deleted file mode 100644 index d4c9784a6..000000000 --- a/test-update-ui.js +++ /dev/null @@ -1,78 +0,0 @@ -const { chromium } = require('playwright'); - -(async () => { - const browser = await chromium.launch({ - headless: true, - args: ['--no-sandbox', '--disable-setuid-sandbox'] - }); - - const context = await browser.newContext({ - ignoreHTTPSErrors: true, - viewport: { width: 1280, height: 720 } - }); - - const page = await context.newPage(); - - console.log('Opening Pulse UI at http://localhost:7655'); - await page.goto('http://localhost:7655', { waitUntil: 'networkidle' }); - await page.waitForTimeout(2000); - - // Click Settings - console.log('\nNavigating to Settings...'); - await page.locator('text="Settings"').first().click(); - await page.waitForTimeout(1000); - - // Click System tab - console.log('Clicking System tab...'); - await page.locator('button:has-text("System")').first().click(); - await page.waitForTimeout(1000); - - // Check current version - const versionText = await page.locator('text=/Current Version/').first(); - if (await versionText.isVisible()) { - console.log('Found:', await versionText.textContent()); - } - - // Test 1: Check with Stable channel - console.log('\n=== Test 1: Checking for updates (Stable channel) ==='); - const stableDropdown = await page.locator('select').filter({ hasText: 'Stable' }).first(); - await stableDropdown.selectOption('stable'); - await page.waitForTimeout(500); - - const checkButton = await page.locator('button:has-text("Check for Updates")').first(); - await checkButton.click(); - await page.waitForTimeout(3000); - - // Check if update button appears - const updateNowButton = await page.locator('button:has-text("Apply Update")').first(); - if (await updateNowButton.isVisible({ timeout: 1000 }).catch(() => false)) { - console.log('✓ Apply Update button appeared!'); - } else { - console.log('✗ Apply Update button NOT visible'); - // Check for any messages - const alertText = await page.locator('.alert, text=/latest version/i').first(); - if (await alertText.isVisible({ timeout: 500 }).catch(() => false)) { - console.log('Message:', await alertText.textContent()); - } - } - - // Test 2: Check with RC channel - console.log('\n=== Test 2: Switching to RC channel and checking ==='); - await stableDropdown.selectOption('rc'); - await page.waitForTimeout(500); - - await checkButton.click(); - await page.waitForTimeout(3000); - - const updateNowButton2 = await page.locator('button:has-text("Apply Update")').first(); - if (await updateNowButton2.isVisible({ timeout: 1000 }).catch(() => false)) { - console.log('✓ Apply Update button appeared for RC!'); - } else { - console.log('✗ Apply Update button NOT visible for RC'); - } - - console.log('\nTest complete! Browser will close in 5 seconds...'); - await page.waitForTimeout(5000); - - await browser.close(); -})(); \ No newline at end of file diff --git a/test-update.js b/test-update.js deleted file mode 100644 index bc2dd0e2c..000000000 --- a/test-update.js +++ /dev/null @@ -1,107 +0,0 @@ -const { chromium } = require('playwright'); - -(async () => { - const browser = await chromium.launch({ - headless: true, - args: ['--no-sandbox', '--disable-setuid-sandbox'] - }); - - const context = await browser.newContext({ - ignoreHTTPSErrors: true - }); - - const page = await context.newPage(); - - // Enable console logging - page.on('console', msg => console.log('Browser console:', msg.text())); - page.on('pageerror', err => console.log('Page error:', err.message)); - - console.log('Opening Pulse at http://192.168.0.212:7655'); - await page.goto('http://192.168.0.212:7655'); - - // Wait for the page to load - await page.waitForTimeout(2000); - - // Check current version - const versionElement = await page.locator('text=/v4\\.0\\.\\d+/').first(); - if (versionElement) { - const currentVersion = await versionElement.textContent(); - console.log('Current version displayed:', currentVersion); - } - - // Look for update notification - const updateNotification = await page.locator('text=/update available/i').first(); - if (await updateNotification.isVisible()) { - console.log('Update notification is visible'); - - // Click on the update notification or button - const updateButton = await page.locator('button:has-text("Update")').first(); - if (await updateButton.isVisible()) { - console.log('Found Update button, clicking...'); - await updateButton.click(); - - // Wait for update modal or process - await page.waitForTimeout(2000); - - // Check for any error messages - const errorMessages = await page.locator('.error, [class*="error"], text=/error/i').all(); - for (const error of errorMessages) { - if (await error.isVisible()) { - console.log('Error found:', await error.textContent()); - } - } - - // Check for confirmation dialog - const confirmButton = await page.locator('button:has-text("Confirm"), button:has-text("Yes"), button:has-text("Download")').first(); - if (await confirmButton.isVisible()) { - console.log('Found confirmation button, clicking...'); - await confirmButton.click(); - await page.waitForTimeout(3000); - } - - // Check final status - const successMessage = await page.locator('text=/success|complete|updated/i').first(); - if (await successMessage.isVisible()) { - console.log('Success message:', await successMessage.textContent()); - } - } else { - console.log('No Update button found'); - } - } else { - console.log('No update notification visible'); - - // Try to trigger update check manually - console.log('Opening Settings page...'); - const settingsLink = await page.locator('a[href*="settings"], button:has-text("Settings")').first(); - if (await settingsLink.isVisible()) { - await settingsLink.click(); - await page.waitForTimeout(2000); - - // Look for update section in settings - const updateSection = await page.locator('text=/update|version/i').first(); - if (await updateSection.isVisible()) { - console.log('Found update section in settings'); - - // Look for check updates button - const checkButton = await page.locator('button:has-text("Check"), button:has-text("Update")').first(); - if (await checkButton.isVisible()) { - console.log('Found check updates button, clicking...'); - await checkButton.click(); - await page.waitForTimeout(3000); - - // Check for update modal or message - const updateInfo = await page.locator('text=/4\\.0\\.9|new version|update available/i').first(); - if (await updateInfo.isVisible()) { - console.log('Update info:', await updateInfo.textContent()); - } - } - } - } - } - - // Take a screenshot for debugging - await page.screenshot({ path: '/tmp/pulse-update-test.png', fullPage: true }); - console.log('Screenshot saved to /tmp/pulse-update-test.png'); - - await browser.close(); -})(); \ No newline at end of file diff --git a/test-update2.js b/test-update2.js deleted file mode 100644 index 859a3f220..000000000 --- a/test-update2.js +++ /dev/null @@ -1,107 +0,0 @@ -const { chromium } = require('playwright'); - -(async () => { - const browser = await chromium.launch({ - headless: true, - args: ['--no-sandbox', '--disable-setuid-sandbox'] - }); - - const context = await browser.newContext({ - ignoreHTTPSErrors: true - }); - - const page = await context.newPage(); - - // Enable console logging - page.on('console', msg => { - if (!msg.text().includes('WebSocket')) { - console.log('Browser console:', msg.text()); - } - }); - page.on('pageerror', err => console.log('Page error:', err.message)); - - console.log('Opening Pulse at http://192.168.0.212:7655'); - await page.goto('http://192.168.0.212:7655'); - - // Wait for the page to load - await page.waitForTimeout(3000); - - // Take initial screenshot - await page.screenshot({ path: '/tmp/pulse-main.png', fullPage: true }); - console.log('Main page screenshot saved to /tmp/pulse-main.png'); - - // Check for version in header - console.log('Looking for version display...'); - const versionTexts = await page.locator('text=/4\\.0\\.8/').all(); - console.log(`Found ${versionTexts.length} elements with version 4.0.8`); - - // Look for update notification banner - console.log('Looking for update notification...'); - const updateBanner = await page.locator('.update-banner, [class*="update"], [class*="notification"]').all(); - for (const banner of updateBanner) { - if (await banner.isVisible()) { - const text = await banner.textContent(); - console.log('Found banner:', text); - } - } - - // Try clicking on Settings - console.log('Navigating to Settings...'); - const settingsButton = await page.locator('nav a:has-text("Settings"), button:has-text("Settings"), a[href*="settings"]').first(); - if (await settingsButton.isVisible()) { - await settingsButton.click(); - await page.waitForTimeout(2000); - - await page.screenshot({ path: '/tmp/pulse-settings.png', fullPage: true }); - console.log('Settings screenshot saved to /tmp/pulse-settings.png'); - - // Look for System tab - const systemTab = await page.locator('button:has-text("System"), [role="tab"]:has-text("System")').first(); - if (await systemTab.isVisible()) { - console.log('Clicking System tab...'); - await systemTab.click(); - await page.waitForTimeout(1000); - - // Look for update section - const updateSection = await page.locator('text=/Updates|Version|Current Version/').all(); - for (const section of updateSection) { - if (await section.isVisible()) { - console.log('Found text:', await section.textContent()); - } - } - - // Look for update button - const updateButtons = await page.locator('button').all(); - for (const button of updateButtons) { - const text = await button.textContent(); - if (text && (text.includes('Update') || text.includes('Check') || text.includes('Download'))) { - console.log('Found button:', text); - - // Click update-related button - if (text.includes('Check for Updates') || text.includes('Update Now')) { - console.log('Clicking button:', text); - await button.click(); - await page.waitForTimeout(3000); - - // Take screenshot after clicking - await page.screenshot({ path: '/tmp/pulse-after-update-click.png', fullPage: true }); - console.log('Screenshot after update click saved'); - - // Look for any modal or dialog - const modals = await page.locator('[role="dialog"], .modal, [class*="modal"]').all(); - for (const modal of modals) { - if (await modal.isVisible()) { - const modalText = await modal.textContent(); - console.log('Modal content:', modalText); - } - } - } - } - } - } - } else { - console.log('Settings button not found'); - } - - await browser.close(); -})(); \ No newline at end of file diff --git a/test-update3.js b/test-update3.js deleted file mode 100644 index afffa3f6e..000000000 --- a/test-update3.js +++ /dev/null @@ -1,146 +0,0 @@ -const { chromium } = require('playwright'); - -(async () => { - const browser = await chromium.launch({ - headless: true, - args: ['--no-sandbox', '--disable-setuid-sandbox'] - }); - - const context = await browser.newContext({ - ignoreHTTPSErrors: true, - viewport: { width: 1280, height: 720 } - }); - - const page = await context.newPage(); - - console.log('Opening Pulse at http://192.168.0.212:7655'); - await page.goto('http://192.168.0.212:7655', { waitUntil: 'networkidle' }); - - // Wait for content to load - await page.waitForTimeout(3000); - - console.log('Page loaded, checking for Settings link...'); - - // Debug: List all links and buttons - const links = await page.locator('a').all(); - console.log(`Found ${links.length} links`); - for (const link of links) { - const text = await link.textContent(); - const href = await link.getAttribute('href'); - if (text) console.log(`Link: "${text}" -> ${href}`); - } - - // Try different selectors for Settings - const settingsSelectors = [ - 'a:text("Settings")', - 'a[href="/settings"]', - 'a[href="#/settings"]', - 'nav a:nth-child(4)', // Often settings is the 4th nav item - '[data-testid="settings-link"]', - '.nav-link:has-text("Settings")' - ]; - - let settingsClicked = false; - for (const selector of settingsSelectors) { - try { - const element = await page.locator(selector).first(); - if (await element.isVisible({ timeout: 1000 })) { - console.log(`Found Settings with selector: ${selector}`); - await element.click(); - settingsClicked = true; - break; - } - } catch (e) { - // Continue to next selector - } - } - - if (!settingsClicked) { - // Try clicking by coordinates if we can see it - console.log('Could not find Settings link, trying navigation by URL'); - await page.goto('http://192.168.0.212:7655/settings', { waitUntil: 'networkidle' }); - } - - await page.waitForTimeout(2000); - - // Check if we're on Settings page - const pageTitle = await page.title(); - const pageUrl = page.url(); - console.log(`Current page title: ${pageTitle}`); - console.log(`Current URL: ${pageUrl}`); - - // Look for System tab - console.log('Looking for System tab...'); - const tabs = await page.locator('button[role="tab"], .tab-button, button.tab').all(); - console.log(`Found ${tabs.length} tabs`); - for (const tab of tabs) { - const text = await tab.textContent(); - console.log(`Tab: "${text}"`); - if (text && text.includes('System')) { - console.log('Clicking System tab...'); - await tab.click(); - await page.waitForTimeout(1000); - break; - } - } - - // Look for version info and update button - console.log('Looking for version and update info...'); - const versionInfo = await page.locator('text=/Current Version:|Version:/').first(); - if (await versionInfo.isVisible()) { - const versionText = await versionInfo.textContent(); - console.log('Version info:', versionText); - } - - // Find all buttons and look for update-related ones - const buttons = await page.locator('button').all(); - console.log(`Found ${buttons.length} buttons`); - for (const button of buttons) { - const text = await button.textContent(); - if (text) { - console.log(`Button: "${text}"`); - if (text.includes('Update') || text.includes('Check')) { - console.log(`>>> Found update button: "${text}"`); - - // Click it - await button.click(); - await page.waitForTimeout(3000); - - // Check for response - const alerts = await page.locator('.alert, [role="alert"], .error, .success').all(); - for (const alert of alerts) { - if (await alert.isVisible()) { - console.log('Alert:', await alert.textContent()); - } - } - - // Check for modal - const modal = await page.locator('[role="dialog"], .modal').first(); - if (await modal.isVisible()) { - console.log('Modal appeared:', await modal.textContent()); - - // Look for download/confirm button in modal - const modalButtons = await modal.locator('button').all(); - for (const modalBtn of modalButtons) { - const btnText = await modalBtn.textContent(); - console.log(`Modal button: "${btnText}"`); - if (btnText && (btnText.includes('Download') || btnText.includes('Update') || btnText.includes('Yes'))) { - console.log('Clicking modal button:', btnText); - await modalBtn.click(); - await page.waitForTimeout(5000); - break; - } - } - } - - break; - } - } - } - - // Take final screenshot - await page.screenshot({ path: '/tmp/pulse-final.png', fullPage: true }); - console.log('Final screenshot saved to /tmp/pulse-final.png'); - - await browser.close(); -})(); \ No newline at end of file diff --git a/test-update4.js b/test-update4.js deleted file mode 100644 index c18d83c6a..000000000 --- a/test-update4.js +++ /dev/null @@ -1,134 +0,0 @@ -const { chromium } = require('playwright'); - -(async () => { - const browser = await chromium.launch({ - headless: true, - args: ['--no-sandbox', '--disable-setuid-sandbox'] - }); - - const context = await browser.newContext({ - ignoreHTTPSErrors: true, - viewport: { width: 1280, height: 720 } - }); - - const page = await context.newPage(); - - console.log('Opening Pulse at http://192.168.0.212:7655'); - await page.goto('http://192.168.0.212:7655', { waitUntil: 'networkidle' }); - await page.waitForTimeout(3000); - - // Look for hamburger menu or settings icon - console.log('Looking for menu or settings icon...'); - const iconSelectors = [ - '[class*="hamburger"]', - '[class*="menu-icon"]', - '[class*="settings-icon"]', - 'button[aria-label*="menu"]', - 'button[aria-label*="settings"]', - 'svg', // Many icons are SVGs - '[class*="gear"]', - '[class*="cog"]' - ]; - - for (const selector of iconSelectors) { - const elements = await page.locator(selector).all(); - if (elements.length > 0) { - console.log(`Found ${elements.length} elements matching ${selector}`); - for (const el of elements.slice(0, 3)) { // Check first 3 - try { - const parent = await el.locator('..').first(); - if (await parent.evaluate(node => node.tagName) === 'BUTTON' || - await parent.evaluate(node => node.tagName) === 'A') { - console.log(`Found clickable icon with parent ${await parent.evaluate(node => node.tagName)}`); - await parent.click(); - await page.waitForTimeout(1000); - - // Check if menu appeared - const menuItems = await page.locator('a:visible, button:visible').all(); - for (const item of menuItems) { - const text = await item.textContent(); - if (text && text.includes('Settings')) { - console.log('Found Settings in menu!'); - await item.click(); - await page.waitForTimeout(2000); - break; - } - } - } - } catch (e) { - // Continue - } - } - } - } - - // Check if we're on a settings page now - const currentUrl = page.url(); - console.log('Current URL after navigation attempts:', currentUrl); - - // Force navigate to settings - console.log('Force navigating to settings page...'); - await page.goto('http://192.168.0.212:7655/#/settings', { waitUntil: 'networkidle' }); - await page.waitForTimeout(2000); - - // Now look for System tab - const systemTab = await page.locator('text="System"').first(); - if (await systemTab.isVisible()) { - console.log('Found System tab, clicking...'); - await systemTab.click(); - await page.waitForTimeout(1000); - } - - // Look for update information - const pageContent = await page.content(); - if (pageContent.includes('4.0.9')) { - console.log('>>> Found reference to version 4.0.9!'); - } - if (pageContent.includes('Update')) { - console.log('>>> Found Update text on page'); - } - - // Find Check for Updates button - const checkButton = await page.locator('button:has-text("Check for Updates")').first(); - if (await checkButton.isVisible()) { - console.log('>>> Found "Check for Updates" button, clicking...'); - await checkButton.click(); - await page.waitForTimeout(3000); - - // Check what happened - const updateInfo = await page.locator('text=/4\\.0\\.9|Update Available|New Version/i').first(); - if (await updateInfo.isVisible()) { - console.log('Update info appeared:', await updateInfo.textContent()); - - // Look for Update Now button - const updateNowButton = await page.locator('button:has-text("Update Now"), button:has-text("Download")').first(); - if (await updateNowButton.isVisible()) { - console.log('>>> Found Update Now button, clicking...'); - await updateNowButton.click(); - await page.waitForTimeout(5000); - - // Check result - const result = await page.locator('.alert, .error, .success, [role="alert"]').first(); - if (await result.isVisible()) { - console.log('Result:', await result.textContent()); - } - } - } - } else { - console.log('Check for Updates button not found'); - - // List all visible buttons - const allButtons = await page.locator('button:visible').all(); - console.log(`\nAll visible buttons (${allButtons.length}):`); - for (const btn of allButtons) { - const text = await btn.textContent(); - if (text) console.log(`- "${text}"`); - } - } - - // Take final screenshot - await page.screenshot({ path: '/tmp/pulse-settings-final.png', fullPage: true }); - console.log('\nFinal screenshot saved to /tmp/pulse-settings-final.png'); - - await browser.close(); -})(); \ No newline at end of file