phx events are not being delivered to the server in wallaby tests while in CI. Everything is working fine in the local tests. What could be the issue?
Can you show an example of a wallaby test that fails?
@benwilson512, i’m working with @MidigoF on this . Here’s the test
session
|> login()
|> visit(Routes.live_path(conn, FarmerLive.Index))
|> click(Query.css("#delete-farmer-#{farmer.id}"))
|> fill_in(Query.text_field("vvid-confirm"), with: "#{farmer.id}")
|> click(Query.css("#delete-#{farmer.id}"))
|> fill_in(Query.text_field("q"), with: "#{farmer.id}")
|> refute_has(Query.text("#{farmer.phone_number}"))
|> refute_has(Query.text("#{farmer.first_name} #{farmer.last_name}"))
assert Repo.get_by(Accounts.Farmer, id: farmer.id) == nil
it works fine and everything passes locally but fails in CI on the last assertion. All the wallaby events pass by when we query for the record that was deleted on the first part from the database, it is still found. We can’t quite figure out why this is happening.
Hi @75pollet and @MidigoF, I had the same problem and eventually found out that Wallaby uses PhantomJS, our local machines has node thus we can install PhantomJS with the npm command without a problem, but the yml file cannot install the npm package because it doesn’t even have node. So, I added the node image in my CI, installed the PhantomJS package and my tests started pass on the CI.
Hope this makes you happier about finally getting it out of the way as it did to me!
@LindaKadz PhantomJS was deprecated leading to some errors. @MidigoF and @75pollet I hope you resolved this.If not I would like to see your .gitlab-ci.yml, the part where put docker image of chromedriver or install it, my assumption here is you are using chromedriver(default wallaby driver) for the test.If so the installation of chromedriver is alittle bit tricky as the version mismatch with chrome usually leads to an error when you run the test. I would install chromedriver in the .gitlab-ci.yml like so:
script:
- CHROME_DRIVER_VERSION=`curl -sS https://chromedriver.storage.googleapis.com/LATEST_RELEASE`
# Install Chrome.
- curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add
- echo "deb https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
- apt-get -y update
- apt-get -y install google-chrome-stable
# Install ChromeDriver.
- wget -N https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip
- rm chromedriver_linux64.zip
- mv -f chromedriver /usr/local/bin/chromedriver
- chown root:root /usr/local/bin/chromedriver
- chmod 0755 /usr/local/bin/chromedriver
This allow installation of specific chrome and chromedriver version.Though I have not specifically tried with phoenix live_view, I had similar problem with gitlabci that’s how i solved it I hope it helps.