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

Executing feature specs non-headless #8

Open
hupf opened this issue Aug 25, 2020 · 2 comments
Open

Executing feature specs non-headless #8

hupf opened this issue Aug 25, 2020 · 2 comments

Comments

@hupf
Copy link
Member

hupf commented Aug 25, 2020

To debug or write feature specs, it is absolutely necessary to execute them in a non-headless browser. Generally, to do this, the HEADLESS=false environment variable can be set. With the current container setup it is not possible to execute the features specs in this mode – a solution has to be engineered and documented.

Work around:

  • Start database/rails server with Docker Compose.
  • On the local machine (not within a container!), from the core directory app/hitobito, use the following command to execute one or more feature specs in non-headless mode (Ruby/Bundler must be available, Gems installed):
RAILS_HOST_NAME=localhost:3000 RAILS_DB_ADAPTER=mysql2 RAILS_DB_HOST=127.0.0.1 RAILS_DB_PORT=33066 RAILS_DB_USERNAME=root RAILS_DB_PASSWORD=hitobito RAILS_DB_NAME=hitobito_test HEADLESS=false bundle exec rspec --tag type:feature spec/features/

See also #7

@carlobeltrame
Copy link
Member

I have previously had success with sharing the X socket with a container, such that the container can open windows on the host. On Linux and Mac OS, this can be done as follows:

  1. If you are on Mac, install the XQuartz X11 server (brew cask install xquartz) and restart your machine
  2. Run xhost local:root in order to allow the root user from the Docker container to send messages to the X server
  3. Configure the service that should open the windows as follows in docker-compose.yml:
    environment:
      - DISPLAY
    volumes:
      - /tmp/.X11-unix:/tmp/.X11-unix:rw
  1. docker-compose up

I have not tested this with the hitobito development repo yet, so far this is just for later reference when we take a look at solving this issue.

@mtnstar
Copy link
Contributor

mtnstar commented Sep 9, 2020

I added the DISPLAY var and the volume from @carlobeltrame post.
chromium now starts, but the opened window is just blank and I can't see any content.
also the specs are failing when running with HEADLESS=false

further engineering is required ...

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

3 participants