peck
End To End Testing With Hound and Github-Actions
Hi all,
Does anyone have a working setup to do end to end testing using hound with github-actions?
I’ve got it working locally
, and its a great way to sanity check the multi-step liveview features on this project but when running on the github-action I get a
** (RuntimeError) invalid element state for each of those tests.
When using hounds fill_field function.
I’ve tried several different combinations of things last night and this morning and seem to be at a deadend, and I’m unsure what else to try.
My workflow.yaml is below.
name: Master PR
on:
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-18.04
services:
postgres:
image: postgres:10.8
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: larder_test
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v1
- uses: actions/setup-elixir@v1.1.0
with:
otp-version: 22.x
elixir-version: 1.9.x
- name: Install Dependencies
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
- name: Setup Node
uses: actions/setup-node@v1
- name: Install ChromeDriver
run: |
CHROME_VERSION=$(google-chrome --version | cut -f 3 -d ' ' | cut -d '.' -f 1) \
&& CHROMEDRIVER_RELEASE=$(curl --location --fail --retry 3 http://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION}) \
&& curl --silent --show-error --location --fail --retry 3 --output /tmp/chromedriver_linux64.zip "http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_RELEASE/chromedriver_linux64.zip" \
&& cd /tmp \
&& unzip chromedriver_linux64.zip \
&& rm -rf chromedriver_linux64.zip \
&& sudo mv chromedriver /usr/local/bin/chromedriver \
&& sudo chmod +x /usr/local/bin/chromedriver \
&& /usr/local/bin/chromedriver --version
- name: Run Tests
run: |
export DISPLAY=:99
/usr/local/bin/chromedriver --port=9515 &
curl localhost:9515
sudo xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
mix compile
mix test
env:
# use postgres for the host here because we have specified a container for the job.
# If we were running the job on the VM this would be localhost
DB_USER: postgres
DB_PASS: postgres
DB_NAME: larder_test
My Hound config lines:
config :hound, driver: "chrome_driver", browser: "chrome_headless"
config :hound, app_host: "http://localhost", app_port: 4002
config :hound, retry_time: 500
Can anyone point me in the right direction?
Most Liked
PJUllrich
I’m using Wallaby together with GitHub Actions.
It’s a bit tricky to set up, but this elixir.yml GitHub Actions workflow should get you going ![]()
For setting up any Wallaby tests, I’m using this FeatureCase test helper:
For the rest, I simply followed the Setup Tutorial of Wallaby.
alanvardy
name: Phoenix - Cypress Acceptance Tests
on: push
jobs:
test:
runs-on: ubuntu-latest
services:
db:
image: postgres:11
ports: ['5432:5432']
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v1.0.0
- uses: actions/cache@v1
with:
path: deps
key: ${{ runner.os }}-mix-cypress-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-cypress-
- uses: actions/cache@v1
with:
path: _build
key: ${{ runner.os }}-build-cypress-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-build-cypress-
# - run: cp config/dev.secret.exs.example config/dev.secret.exs
- uses: actions/setup-elixir@v1.0.0
with:
otp-version: 22.1
elixir-version: 1.9.1
- run: mix deps.get
- run: npm install --prefix assets
- run: npm run deploy --prefix assets
- run: mix phx.digest
- run: mix cypress.ci
I am using Cypress for my acceptance tests, and had to run a few extra commands to get the JavaScript running properly on CI. I suggest trying
- run: npm install --prefix assets
- run: npm run deploy --prefix ./assets
- run: mix phx.digest
Right before your run your tests and see what happens. I have no idea what the internals of Hound look like, but hopefully this helps.
alanvardy
I have been really happy with Cypress, and recommend it as an option.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








