Phoenix live_view events not reaching the server in wallaby tests in gitlab CI

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

    |> login()
    |> visit(Routes.live_path(conn, FarmerLive.Index))
    |> click(Query.css("#delete-farmer-#{}"))
    |> fill_in(Query.text_field("vvid-confirm"), with: "#{}")
    |> click(Query.css("#delete-#{}"))
    |> fill_in(Query.text_field("q"), with: "#{}")
    |> refute_has(Query.text("#{farmer.phone_number}"))
    |> refute_has(Query.text("#{farmer.first_name} #{farmer.last_name}"))

    assert Repo.get_by(Accounts.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. :smiley:

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:

    # Install Chrome.
    - curl -sS -o - | apt-key add
    - echo "deb stable main" >> /etc/apt/sources.list.d/google-chrome.list
    - apt-get -y update
    - apt-get -y install google-chrome-stable

    # Install ChromeDriver.
    - unzip
    - rm
    - 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.