stevegrossi
I’m using Wallaby (0.17.0) for acceptance tests with phantomjs (2.1.1), and the latest Elixir (1.4.5) and Erlang (20). I’ve written a few acceptance tests, each of which passes when run individually, but when I run them together (via mix test test/acceptance) they fail because things that should be on the page aren’t. It’s as if all the tests are running in the same browser, even though Wallaby should “manage multiple browsers for you.”
I believe I’ve set everything up according to the setup section of the README, although I’m not running the tests with async: true because my app uses sockets and Phoenix.Ecto.SQL.Sandbox doesn’t play well with async. To be clear, the tests also fail with async: true, I just also get DBConnection.OwnershipErrors in each when attempting to connect to the socket.
Is there anything else necessary to ensure each test is run in its own phantomjs browser, or to clear out sessions between test runs?
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 5- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
stevegrossi
I’ve posted this to StackOverflow as well in someone would prefer to answer there for the points
josevalim
Can you reproduce it in a sample application? As long as you call
Wallaby.start_sessionper setup and haveasync: false, you should be covered.stevegrossi
I’ll try to reproduce it in a sample application, but in the meantime will note that I was able to resolve the issue (and get all Wallaby tests passing when run together with
mix test test/acceptance) by manually logging out (click(link("Log Out"))) at the end of each test case.I store an authentication token in LocalStorage, and when I print it to the page (and take a screenshot in each test case), I can see that the token is the same for all of my test cases, even though I’m calling
Wallaby.start_sessionbefore each test case. I would assume that, as a result of this PR, Wallaby sessions should not be sharing LocalStorage:https://github.com/keathley/wallaby/pull/93
I’ll continue investigating…
stevegrossi
I believe this may be a bug with Wallaby. When I
IO.putsboth thesession.idand result ofexecute_script("return localStorage.getItem('token')"at the start of each test, it’s clear that each test is run in a differens phantomjs session (the ids differ) but that thetokenI’m setting withlocalStorage.setItemis persisting across sessions.I’ve reproduced this behavior in a minimal sample app: GitHub - stevegrossi/wallaby_test: A test of how Wallaby handles localstorage across sessions · GitHub and have submitted an issue to Wallaby: localStorage persisting across sessions · Issue #274 · elixir-wallaby/wallaby · GitHub
ZaeemM.Yaseen
@stevegrossi I am encountering the same error where if i run the E2E feature test alone they pass but fail if run in bulk (all together). After seeing all of the links you shared on differen platform i came to conclusion that it can be resolved by adding logout in each of the feature test case. But i have tried that and still getting the error. Also read in github that it was resolved but where i am doing wrong that it is failing for me.
below is the feature test case being run in a docker container
And its failing with the message
Below is the setup