How do I enable "headful mode" when running E2Es?
I have Vitest set up and I can run tests, but I need to be able to see these tests run sometimes for debugging purposes. I cannot get headless mode enabled.
Browser Mode seems really cool, but it currently does not work (I can share screenshots and logs if that sounds incorrect, but considering it is an experimental feature I'm assuming that it just doesn't work yet).
How do I turn off headless mode?
3 Replies
Hi @elliott. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To run your end-to-end (E2E) tests in "headful mode" (i.e., with the browser UI visible) using Nuxt's testing utilities, you need to configure Playwright (which is used under the hood for browser-based E2E tests) to launch the browser in non-headless mode.
While the Nuxt documentation explains how to enable browser testing and configure browser options via the
setup
function in your test files, it does not explicitly mention how to set the headless
option. However, Playwright's standard configuration allows you to pass a launch
object with options, including headless: false
, to the browserOptions
property.
Here’s how you can do it in your Nuxt E2E test setup:
This configuration should launch the browser with its UI visible, allowing you to watch the tests run for debugging purposes. If you encounter issues with "Browser Mode" or experimental features, using the above approach with Playwright's standard options is the recommended way to enable headful mode in Nuxt E2E tests at this time.
For more details on available options, see the Nuxt Testing documentation and the Playwright API reference as linked in the docs<sup>Nuxt E2E Testing</sup>.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@385612261101666306> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
That suggestion is not correct in the slightest. I can't imagine you'd want to configure this for each file, either.
