Running multiple headless chrome sessions with docker - docker

Is it possible to have setup a multiple headless chrome in a docker, since the current version of headless chrome does not support multiple sessions. I need to run tests in a isolations between browser with their own session.
Can someone point me to the right documentations?

Related

Running tests in a visible Chrome window (headful Chrome?) with Jest and Puppeteer inside Docker inside WSL

I've got a pretty elaborate end-to-end test suite driven by Jest and Puppeteer.
Puppeteer can be started Chrome in headless or headful mode:
puppeteer.launch({ headless: false });
I've dockerized the app and the test suite. It's running perfectly in headless mode, but I've lost the ability to run it in headful mode: my headful Chrome is on the Windows host, and my Puppeteer is in Docker in WSL, where a headless Chrome is installed.
How do I use host OS Chrome in headful mode when running Puppeteer tests in Docker?
In a different project, I've had a test suite start a dev server, offer an URL. I could open that URL in the host OS Chrome, and tests would run there. But Puppeteer seems more elaborate than that.
PS Homework
This SO question links to this article that suggests starting a window manager inside the Docker container and connecting to it remotely in a VNC fashion. I don't like that, I want to use the actual Chrome app in my host OS (or any browser, for that matter).
Another SO question, answer suggests the same approach, and here are VNC instructions.
The solution is really simple.
Remote debugging
Add the "--remote-debugging-port=9222" to {args: []} that you pass into puppeteer.launch().
Launch.
Open chrome://inspect in Chrome on your host OS and wait for an entry to appear.
Use the Inspect button/link.
You'll see a normal Chrome window with devtools and a page, except the page will be rendered in VNC style (remote desktop style): the viewport will be sized according to Puppeteer settings and scaled to fit your screen.

Is there anyway to run selenium in Electron?

My test work is runing selenium job in background with special chrome version.
I want to create a windows app to ensure the chrome version and distribute to others.
It's there anyway to boxing an electron app (to do the job ) in another electron app (to control the job and others) ?

Running Docker containers on a chrome extension

I'm coding a chrome extensions (mostly HTML, CSS and JS) and I need an application (that runs on Linux) to connect to the internet and feed some data to the extension's JS scripts. On my machine I'm able to setup and run the app in a Docker container smoothly and I'm wondering whether it's possible to incorporate this container into the chrome extension.

GUI in docker application

I have a desktop application written completely in C with GUI written in Gtk. Currently, it works fine on my Ubuntu desktop.
Now, I want to use the application independent of the OS. Therefore, Docker seems to help with it but as far as I know, it only provides web based UI.
How can I use Docker to deploy standalone desktop applications?
Is there any other container which does the job?
P.S.: The application is written in Gtk 2 hence I cannot use broadway.
I haven't done it myself anytime but just suggesting what might seem obvious.
You can try this though:
Run XVNC server inside the container
Expose the port at which XVNC runs
Connect to the XVNC server from the host machine
Trigger your gui application from within the XVNC console

Rails system test with capybara and headless selenium browser in Docker

TL;DR: Any idea about how to properly configure capybara to be able to drive a remote selenium browser in a docker container with default Rails minitest system test?
I'm running Rails in a dockerized env..
Now I want to start some "system tests" but since I'm running inside Docker I come up with some issues.
I'm using the default test suite (minitest?) with capybara and selenium-webdriver gems.
I've already installed the chromedriver packet in the container using the following:
RUN apt-get install -y chromedriver \
&& ln -s /usr/lib/chromium-browser/chromedriver /usr/local/bin
But running rails test:system outputs the following error Selenium::WebDriver::Error::WebDriverError: Unable to find chromedriver.
In fact I don't know if chrome itself is installed or not?
which chrome outputs nothing.
which chromium outputs /usr/bin/chromium.
I also tried with xvfb without success.
So (since I had no clue) I tried to go further and actually go with a dockerized system test environment as well.
I found some Docker images from selenium. So I ran among my rails and database containers a selenium-standalone-chrome container (the actual docker-compose.yml I'm using is here)
Then I found some useful information about the configuration to be done to let capybara driver the remote selenium browser.
All the examples I found on internet use rspec, but since I'm using the default minispec I tried to adapt the capybara driver to minispec but I had some doubt about how to do it and where to put the configuration.
For system tests I guessed that the best location is the file application_system_test_case.rb. Also I found and I tried many different capybara configurations and I end up with the following which seems to be the most complete (available here)
At that moment the test seems to perform well since I have no error but it always fails.
It fails regardless of making a call to the driver configuration (the setup_remote method where I defined the server host and port) before the tests case.
With or without the call I got the "site can't be reached" error (here is the screenshot)
Here is the test file I used. (Testing some react dynamic display)
However I can access to the selenium container with the given URL from the browser from my host machine. And both containers sees each others. I did some ping from within the containers shell.
The following SO questions being helpful don't work for me:
Dockerized selenium browser cannot access Capybara test url
How can I run headless browser system tests in Rails 5.1?
Any idea about how to properly configure capybara to be able to drive a remote selenium browser in a docker container with default Rails minitest system test?
Thank you very much.
You have to override the host method so Capybara uses the container's IP address. Check out this post: https://medium.com/#pacuna/using-rails-5-1-system-tests-with-docker-a90c52ed0648

Resources