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

Watching tests run via noVNC not working for me in a Drupal 10 ddev project without deleting --headless from config #23

Closed
agentolivia opened this issue Feb 24, 2023 · 10 comments

Comments

@agentolivia
Copy link

I can't see tests run using noVNC unless I edit .ddev/config-selenium-standalone-chrome.yaml and delete the --headless flag from the MINK_DRIVER_ARGS_WEBDRIVER configuration.

Here's my steps to reproduce:

  1. In a Drupal 10 ddev project, run ddev get ddev/ddev-selenium-standalone-chrome and then ddev restart
  2. Run ddev describe and copy the URL listed for selenium-chrome, paste it into a browser, and enter the secret password.
  3. Run ddev exec -d /var/www/html/web "../vendor/bin/phpunit -v -c ./core/phpunit.xml.dist ./core/modules/system/tests/src/FunctionalJavascript/FrameworkTest.php", (which is the example from the README).
  4. Expect to see tests running in the noVNC window at the selenium-chrome URL (https://my-site.ddev.site:7900/), but all I see is "Selenium Grid" graphic.

It's my understanding this is supposed to work out-of-the-box without any configuration changes. Yes, I understand that the tests run super fast in the browser. I noticed that when I got it working by editing the config file and removed the --headless flag.

@ptmkenny
Copy link
Contributor

Some info about your environment might be helpful.

I just tried this on Drupal 10 on macOS and I can see the tests as expected.

Make sure your browser window is maximized and you can see the whole VNC screen; it might be that the tests are being shown in a part of the screen that is hidden because the whole window isn't visible.

@eojthebrave
Copy link

What @agentolivia describes is also how this works for me. And I've used this feature quite a bit. If you want to see the Chrome browser open up, and be able to watch as the tests execute and drive the browser. Or to be able to pause and interact with the site under test via the Chrome browser, you need to remove the --headless option from the MINK_DRIVER_ARGS_WEBDRIVER variable.

This is true regardless of DDEV, or Docker, or any other environment. When you specify --headless in the MINK_DRIVER_ARGS_WEBDRIVER like this the options are used used when launching Chrome, and that argument is how you tell Chrome to effectively run with no UI. See https://developer.chrome.com/blog/headless-chrome/

If the goal is to be able to watch the tests run in Chrome via noVNC without having to change the default config. We should remove the --headless flag. Or, if we do leave it we could update the README so that it indicates you'll want to remove it if you expect to see the browser opening and tests running in it.

@agentolivia
Copy link
Author

I'm running:

  • ddev version 1.21.4
  • Colima
  • Apple M1 Pro
  • MacOS 12.4
  • Tried both Firefox and Chrome (same results, but different default graphics)

I'm using a fresh pull of this service and this is the config file saved in my project's .ddev directory: https://github.com/ddev/ddev-selenium-standalone-chrome/blob/main/config.selenium-standalone-chrome.yaml

Like @eojthebrave said, I should NOT expect to see the tests run visibly in a browser via noVNC over port 7900 because the configuration specifies --headless out-of-the-box. I think the README of this project should be updated to clarify that using noVNC does require an update to the configuration. (You do have to remove --headless from the MINK_DRIVER_ARGS_WEBDRIVER in your project's .ddev/config.selenium-standalone-chrome.yaml if you want to see the tests run using noVNC.)

@tyler36
Copy link
Collaborator

tyler36 commented Mar 9, 2023

Just installed on a new Drupal project.

I was unable to see the test run until I removed \"--headless\", from .ddev/config.selenium-standalone-chrome.yaml and restarted DDEV.

DDEV: 1.21.5
OS: Ubuntu WSL2 20.04 on Win10
Browser: Chrome 111 on Win10

@deviantintegral
Copy link

We should remove the --headless flag

I've been working with Playwright, but by default it runs tests headless. Instead, you have to specify --headed. There's a performance and memory impact by running headed that makes tests run a bit slower. As well, Chromium has been doing some significant work on headless at https://developer.chrome.com/articles/new-headless/. So +1 to updating the readme!

I would say when I last used DTT it was in ddev, but we configured MINK_DRIVER_ARGS_WEBDRIVER and company in phpunit.xml. So you should be able to override that there to unblock your local projects.

@smustgrave
Copy link

Currently using #27 and the change here to even be able to run the tests. But I can't watch them.

@bserem
Copy link

bserem commented Oct 31, 2023

The --headless option means that chrome is not opening the UI, that's why you don't see anything.

@tyler36
Copy link
Collaborator

tyler36 commented Nov 2, 2023

@bserem

On your host, browse to https://[DDEV SITE URL]:7900 (password: secret) to watch tests run with noVNC (neat!).
This is a no-configuration solution that enables you to quickly see what is going on with your tests.

The docs imply that there is not needed though.

@bserem
Copy link

bserem commented Dec 13, 2023

@tyler36 the docs point you to where you can see the tests run. That doesn't change the fact that chromium in headless mode won't render a window (more: https://developer.chrome.com/blog/headless-chrome)

The default Behat example, as well as the example in #27 all have --headless enabled:

- DRUPAL_TEST_WEBDRIVER_CHROME_ARGS=--disable-gpu --headless --no-sandbox --disable-dev-shm-usage

This is because tests will run faster this way, but I can see that it confuses people.

@gitressa
Copy link
Contributor

Thanks everyone, I can confirm that the Watching the tests steps in the README allowed me to see the tests running in Firefox.

Tip: After removing --headless and restarting DDEV, you need to close the original noVNC tab in your browser, and log in again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants