Skip to content

bug: cannot override/set EmulateViewport width for e2e tests #4601

@jongirard

Description

@jongirard

Prerequisites

Stencil Version

4.0.1

Current Behavior

Currently, setting the height/width of the viewport object inside emulate within the stencil.config.ts testing object has no effect. According to the stencil config docs, this is a valid config object property.

This manifests itself within e2e tests that make use of differing viewport sizes style wise (ie; desktop specific content with min-width breakpoints larger than 800px which appears to be the default browser width in puppeteer/stencil config).

Expected Behavior

emulate object and viewport specific attributes should be set/overridden as expected.

Example:

testing: {
    browserHeadless: "new",
    emulate: [
      {
        viewport: {
          width: 1250,
          height: 600,
        },
      }
    ]
  },

System Info

System: node 18.16.0
    Platform: darwin (21.2.0)
   CPU Model: Apple M1 Max (10 cpus)
    Compiler: /Users/jongirard/bug-demo/node_modules/@stencil/core/compiler/stencil.js
       Build: 1687953951
     Stencil: 4.0.1 ⛹
  TypeScript: 5.0.4
      Rollup: 2.42.3
      Parse5: 7.1.2
      Sizzle: 2.42.3
      Terser: 5.18.1

Steps to Reproduce

Please clone demo/bug specific repository at: https://github.com/jongirard/stencil-emulate-viewport-bug.

  1. yarn install
  2. yarn test --e2e

Expect for the "can click the desktop content" test to fail erroneously due to viewport width settings not being respected/set correctly.

Code Reproduction URL

https://github.com/jongirard/stencil-emulate-viewport-bug

Additional Information

Screen Shot 2023-07-20 at 1 27 30 PM

No response

Metadata

Metadata

Assignees

Labels

Bug: ValidatedThis PR or Issue is verified to be a bug within Stencil

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions