Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow changing viewport in browser mode #5776

Closed
4 tasks done
sheremet-va opened this issue May 25, 2024 · 1 comment
Closed
4 tasks done

Allow changing viewport in browser mode #5776

sheremet-va opened this issue May 25, 2024 · 1 comment
Labels
feat: browser Issues and PRs related to the browser runner p2-nice-to-have Not breaking anything but nice to have (priority)

Comments

@sheremet-va
Copy link
Member

Clear and concise description of the problem

Currently it is not possible to set a viewport in browser mode, it is set to the default iframe height and width.

Suggested solution

Add an option in the config and a public API to change the viewport:

export default defineConfig({
  test: {
    browser: {
      viewport: { height: 100, width: 100 },
    },
  },
})
import { page } from '@vitest/browser/context'

test('works in a viewport', async () => {
  await page.viewport(100, 100)
  await page.viewport('iphone-6')
})

Alternative

No response

Additional context

No response

Validations

@sheremet-va sheremet-va added feat: browser Issues and PRs related to the browser runner p2-nice-to-have Not breaking anything but nice to have (priority) labels May 25, 2024
@sheremet-va
Copy link
Member Author

Fixed by #5811

@github-actions github-actions bot locked and limited conversation to collaborators Jun 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat: browser Issues and PRs related to the browser runner p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
None yet
Development

No branches or pull requests

1 participant