oppia: Unable to run e2e or Frontend Tests in Vagrant VM

The Vagrant VM is not able to run either e2e or frontend tests. This is due to a couple of issues:

  • For a restarted machine, CHROME_BIN is likely to be absent
  • Chromium is not installed
  • xvfb is not installed
  • a proper environment variable for the screen for xvfb is not exported

Steps to solve this: I advise using this guide as a starting point.

  • Install Chromium on Vagrant machine
  • Install Xvfb on Vagrant machine
  • Increase default memory on VM to 2048mb to allow frontend tests to run without crashing
  • Set and export proper screen type variable for Xvfb and Chromium
  • Refactor frontend tests to change the commands they use to invoke tests if the VAGRANT environment variable returns true
  • Refactor e2e tests to properly invoke Xfvb if VAGRANT environment variable returns true
  • Figure out why Chrome/Chromium breaks when invoked by Xvfb

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 32 (32 by maintainers)

Most upvoted comments

I was able to get headless testing running on Vagrant. Some issues I noticed while doing this:

  • The VAGRANT env variable has a tendency to disappear, causing the CHROME_BIN variable to get set to an incorrect value by setup.sh.
  • To run the karma tests, we just have to add xvfb-run to the beginning of the karma command.

Currently running into a problem with e2e tests where we’re missing the webdriver-manager and protractor, both of which can be install via NPM but it seems they’re getting missed somehow.

I’m also seeing the same problem binding to ports that @MAKOSCAFEE encountered.

We’re very close to being able to solve this once and for all, I think.