Skip to content

[Future] E2E: Mobile viewport detection incorrectly identifies Mobile Chrome/Safari as desktop #263

@frankbria

Description

@frankbria

Problem

The E2E test test_mobile_smoke.spec.ts:50 incorrectly detects Mobile Chrome and Mobile Safari browsers as desktop, causing viewport assertions to fail.

Failing Tests

  • [Mobile Chrome] › test_mobile_smoke.spec.ts:50:7 › should have correct mobile viewport @smoke
  • [Mobile Safari] › test_mobile_smoke.spec.ts:50:7 › should have correct mobile viewport @smoke

Error

Error: expect(received).toBeGreaterThan(expected)
Expected: > 800
Received:   393  (Mobile Chrome)
Received:   390  (Mobile Safari)

Root Cause

The test logs show:

Running mobile test on: chromium (mobile: false)
ℹ️ Desktop viewport: 1280x720 (not a mobile test)

When running on Mobile Chrome/Safari projects, the test incorrectly:

  1. Detects mobile: false
  2. Branches to desktop viewport assertion (width > 800)
  3. Fails because actual viewport is mobile-sized (~390px)

Location

  • tests/e2e/test_mobile_smoke.spec.ts:50-64
  • Possibly tests/e2e/playwright.config.ts (project configuration)

Expected Behavior

When running on "Mobile Chrome" or "Mobile Safari" projects:

  1. Test should detect mobile: true
  2. Assert mobile viewport width (< 500px)
  3. Pass with actual width of ~390px

Suggested Fix

Check the mobile detection logic in the test or playwright config:

// Current (broken)
const isMobile = page.context().isMobile; // Returns false incorrectly

// Fix option 1: Check project name
const isMobile = test.info().project.name.includes('Mobile');

// Fix option 2: Check viewport directly
const viewport = page.viewportSize();
const isMobile = viewport && viewport.width < 500;

Impact

  • 2 smoke test failures
  • Blocks mobile testing confidence

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    FutureDeferred - beyond v1/v2 scope, consider for future versionsbugSomething isn't workingtestingv1-legacyV1-specific issue, retained as reference for Phase 3 UI rebuild

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions