import { test, expect } from '@playwright/test'; /** * Smoke tests for Synor Desktop Wallet * * These tests verify the development server is running and serving content. * Note: Full E2E testing of Tauri features requires running the complete * Tauri application with the Rust backend. * * For comprehensive E2E testing, use: * pnpm tauri:dev (to run full app) * * These smoke tests verify: * - Dev server responds * - HTML content is served * - React app bundles load */ test.describe('Smoke Tests', () => { test('dev server should respond', async ({ page }) => { const response = await page.goto('/'); expect(response?.status()).toBe(200); }); test('should serve HTML content', async ({ page }) => { await page.goto('/'); const html = await page.content(); // Should have basic HTML structure expect(html).toContain(''); expect(html).toContain(''); }); test('should have root element for React', async ({ page }) => { await page.goto('/'); const html = await page.content(); // Should have React root element expect(html).toContain('id="root"'); }); test('should load JavaScript bundles', async ({ page }) => { await page.goto('/'); const html = await page.content(); // Should include script tags expect(html).toContain(' { await page.goto('/'); const html = await page.content(); // Should include styles (either link stylesheet or style tag) const hasStylesheet = html.includes('stylesheet') || html.includes(' { await page.goto('/'); const title = await page.title(); // Should have a title set expect(title.length).toBeGreaterThan(0); }); test('all routes should return 200', async ({ page }) => { const routes = [ '/', '/setup', '/dashboard', '/send', '/receive', '/history', '/node', '/mining', '/staking', '/swap', '/market', '/contracts', '/tokens', '/nfts', '/settings', '/storage', '/hosting', '/compute', '/database', '/privacy', '/bridge', '/governance', '/zk', ]; for (const route of routes) { const response = await page.goto(route); expect(response?.status(), `Route ${route} should return 200`).toBe(200); } }); }); test.describe('Build Verification', () => { test('should load without unexpected JavaScript errors', async ({ page }) => { const errors: string[] = []; page.on('console', (msg) => { if (msg.type() === 'error') { const text = msg.text(); // Ignore expected errors when running outside Tauri context: // - Tauri API errors (__TAURI__, invoke, etc.) // - React error boundary messages (expected when components fail without Tauri) // - Window property checks const isExpectedError = text.includes('__TAURI__') || text.includes('tauri') || text.includes('invoke') || text.includes('window.') || text.includes('error boundary') || text.includes('Error occurred in') || text.includes('TitleBar') || text.includes('getCurrentWindow'); if (!isExpectedError) { errors.push(text); } } }); await page.goto('/'); await page.waitForTimeout(2000); // Wait for async operations // Log any errors found for debugging if (errors.length > 0) { console.log('Unexpected console errors found:', errors); } // Should have no unexpected errors expect(errors).toHaveLength(0); }); test('should not have network failures for static assets', async ({ page }) => { const failedRequests: string[] = []; page.on('requestfailed', (request) => { failedRequests.push(`${request.url()} - ${request.failure()?.errorText}`); }); await page.goto('/'); await page.waitForLoadState('networkidle'); // Should have no failed requests expect(failedRequests).toHaveLength(0); }); });