Has anybody figured out how to how to run the dash testing framework using github actions?
I would like to make it part of the CI/CD flow of my explainerdashboard package, and got the integration tests to work offline, but not sure how to make it run with github actions. Anybody managed to get this to work and willing to share an example?
If not, I’ll see if I can figure it out and report back here…
So it seems that selenium and chromedriver are already installed on the github actions instances, so it is actually quite straightforward to get this to work. To only tricky thing is to make sure the tests run in headless mode (makes sense given that the tests are running on remote servers).
So this seems to be the trick: add a file called
conftest.py to the same directory where your tests are located and include the following code:
from selenium.webdriver.chrome.options import Options
options = Options()
These options should then be automatically added to the commandline when selenium starts the chromedriver, through pytest fixtures.
And then your tests should run like they do locally!
nice, thanks for looping back here!
Would maybe also be nice to rewrite https://dash.plotly.com/testing to be a bit more beginner friendly as well: Now it mostly reads as if its target audience is web developers that already know how to set up selenium integration tests with pytest, and so only need to learn how to do it in the specific dash case.
However given that a lot of dash developers are data scientists that started dabbling in web design because dash is so easy to learn (me included), we could use a bit more handholding and tips on how to set this stuff up, when to do it, how to do it, etc.
If you have any free time, we’d appreciate a pull request (this page is here: https://github.com/plotly/dash-docs/blob/master/dash_docs/chapters/testing/index.py) or even just a write up in this forum that we could fold into the docs.