Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

test(playwright): add desktop breakpoint and orientation screenshots

LearningCircuitaed5d65ca88c
diff --git a/tests/ui_tests/playwright/tests/desktop-layout.spec.js b/tests/ui_tests/playwright/tests/desktop-layout.spec.js
index b08ba091b0..b59e499910 100644
--- a/tests/ui_tests/playwright/tests/desktop-layout.spec.js
+++ b/tests/ui_tests/playwright/tests/desktop-layout.spec.js
@@ -489,4 +489,43 @@ test.describe('Desktop Screenshots - Responsive Breakpoints', () => {
maxDiffPixelRatio: 0.02,
});
});
+
+ // Collapsed sidebar screenshots for all main pages
+ const collapsedSidebarPages = [
+ { path: '/history/', name: 'history' },
+ { path: '/news/', name: 'news' },
+ { path: '/library/', name: 'library' },
+ { path: '/metrics/', name: 'metrics' },
+ { path: '/benchmark/', name: 'benchmark' },
+ ];
+
+ for (const { path, name } of collapsedSidebarPages) {
+ test(`${name} page at 900px - collapsed sidebar`, async ({ page, isMobile }) => {
+ if (isMobile) { test.skip(); return; }
+
+ await setupDesktopPage(page, path, 900, 700);
+ await expect(page).toHaveScreenshot(`desktop-${name}-900px-collapsed.png`, {
+ maxDiffPixelRatio: 0.02,
+ });
+ });
+ }
+
+ // Large desktop screenshots for remaining pages
+ const largeDesktopPages = [
+ { path: '/history/', name: 'history' },
+ { path: '/news/', name: 'news' },
+ { path: '/library/', name: 'library' },
+ { path: '/benchmark/', name: 'benchmark' },
+ ];
+
+ for (const { path, name } of largeDesktopPages) {
+ test(`${name} page at 1600px - large desktop`, async ({ page, isMobile }) => {
+ if (isMobile) { test.skip(); return; }
+
+ await setupDesktopPage(page, path, 1600, 900);
+ await expect(page).toHaveScreenshot(`desktop-${name}-1600px.png`, {
+ maxDiffPixelRatio: 0.02,
+ });
+ });
+ }
});
diff --git a/tests/ui_tests/playwright/tests/orientation-change.spec.js b/tests/ui_tests/playwright/tests/orientation-change.spec.js
index e7a266d45b..caba663c0a 100644
--- a/tests/ui_tests/playwright/tests/orientation-change.spec.js
+++ b/tests/ui_tests/playwright/tests/orientation-change.spec.js
@@ -51,7 +51,8 @@ test.describe('Orientation Change - Layout Adaptation', () => {
const page = await context.newPage();
await page.goto('/');
- await page.waitForLoadState('networkidle');
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
// Verify no overflow in portrait
let hasOverflow = await page.evaluate(() =>
@@ -81,7 +82,8 @@ test.describe('Orientation Change - Layout Adaptation', () => {
const page = await context.newPage();
await page.goto('/');
- await page.waitForLoadState('networkidle');
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
// Verify no overflow in landscape
let hasOverflow = await page.evaluate(() =>
@@ -113,7 +115,8 @@ test.describe('Orientation Change - Form State Preservation', () => {
const page = await context.newPage();
await page.goto('/');
- await page.waitForLoadState('networkidle');
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
const textarea = page.locator('#query');
await textarea.fill('Test query in portrait');
@@ -146,7 +149,7 @@ test.describe('Orientation Change - Form State Preservation', () => {
const page = await context.newPage();
await page.goto('/settings/');
- await page.waitForLoadState('networkidle');
+ await page.waitForLoadState('domcontentloaded');
await page.waitForSelector('.ldr-loading-spinner', { state: 'hidden', timeout: 10000 }).catch(() => {});
await page.waitForTimeout(500);
@@ -182,7 +185,8 @@ test.describe('Orientation Change - Navigation Visibility', () => {
const page = await context.newPage();
await page.goto('/');
- await page.waitForLoadState('networkidle');
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
const mobileNav = page.locator('.ldr-mobile-bottom-nav');
await expect(mobileNav, 'Mobile nav visible at 667px (iPhone SE landscape)').toBeVisible();
@@ -200,7 +204,8 @@ test.describe('Orientation Change - Navigation Visibility', () => {
const page = await context.newPage();
await page.goto('/');
- await page.waitForLoadState('networkidle');
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
// At 780px, should be tablet layout
const sidebar = page.locator('.ldr-sidebar');
@@ -228,7 +233,8 @@ test.describe('Orientation Change - Navigation Visibility', () => {
const page = await context.newPage();
await page.goto('/');
- await page.waitForLoadState('networkidle');
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
const mobileNav = page.locator('.ldr-mobile-bottom-nav');
await expect(mobileNav, 'Mobile nav hidden at 844px (iPhone 14 landscape)').not.toBeVisible();
@@ -247,7 +253,8 @@ test.describe('Orientation Change - Content Accessibility', () => {
const page = await context.newPage();
await page.goto('/');
- await page.waitForLoadState('networkidle');
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
// Check main content visible in portrait
const mainContent = page.locator('main, .ldr-main-content, .ldr-content, #content');
@@ -276,7 +283,8 @@ test.describe('Orientation Change - Content Accessibility', () => {
const page = await context.newPage();
await page.goto('/');
- await page.waitForLoadState('networkidle');
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
const startButton = page.locator('#start-research-btn, button:has-text("Start Research")');
if (await startButton.count() > 0) {
@@ -295,6 +303,50 @@ test.describe('Orientation Change - Content Accessibility', () => {
});
});
+// ============================================
+// ORIENTATION CHANGE SCREENSHOTS
+// ============================================
+
+test.describe('Orientation Change - Visual Regression', () => {
+ const screenshotPages = [
+ { path: '/', name: 'research' },
+ { path: '/history/', name: 'history' },
+ { path: '/settings/', name: 'settings' },
+ { path: '/news/', name: 'news' },
+ ];
+
+ for (const { path, name } of screenshotPages) {
+ test(`${name} - portrait vs landscape screenshots`, async ({ browser }) => {
+ const context = await browser.newContext({
+ viewport: DEVICES.IPHONE_14.portrait,
+ isMobile: true,
+ hasTouch: true,
+ });
+ const page = await context.newPage();
+
+ await page.goto(path);
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
+
+ // Portrait screenshot
+ await expect(page).toHaveScreenshot(`orientation-${name}-portrait.png`, {
+ maxDiffPixelRatio: 0.02,
+ });
+
+ // Rotate to landscape
+ await page.setViewportSize(DEVICES.IPHONE_14.landscape);
+ await page.waitForTimeout(500);
+
+ // Landscape screenshot
+ await expect(page).toHaveScreenshot(`orientation-${name}-landscape.png`, {
+ maxDiffPixelRatio: 0.02,
+ });
+
+ await context.close();
+ });
+ }
+});
+
test.describe('Orientation Change - Page-Specific Tests', () => {
test('History page adapts to orientation change', async ({ browser }) => {
const context = await browser.newContext({
@@ -305,7 +357,8 @@ test.describe('Orientation Change - Page-Specific Tests', () => {
const page = await context.newPage();
await page.goto('/history/');
- await page.waitForLoadState('networkidle');
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
// No overflow in portrait
let hasOverflow = await page.evaluate(() =>
@@ -335,8 +388,9 @@ test.describe('Orientation Change - Page-Specific Tests', () => {
const page = await context.newPage();
await page.goto('/settings/');
- await page.waitForLoadState('networkidle');
+ await page.waitForLoadState('domcontentloaded');
await page.waitForSelector('.ldr-loading-spinner', { state: 'hidden', timeout: 10000 }).catch(() => {});
+ await page.waitForTimeout(500);
// No overflow in portrait
let hasOverflow = await page.evaluate(() =>
@@ -366,7 +420,8 @@ test.describe('Orientation Change - Page-Specific Tests', () => {
const page = await context.newPage();
await page.goto('/metrics/');
- await page.waitForLoadState('networkidle');
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
// No overflow in portrait
let hasOverflow = await page.evaluate(() =>