Using 2 windows/tabs simultaneously with Wallaby

Hi

I am writing user interaction tests for an application that has 2 different websites:

  1. a customer-facing site where they can place orders
  2. a business-facing site where customer orders appear (thanks to LiveView)

I was hoping Wallaby could help me with this but I am having great trouble just trying to write a test where I can interact with two pages simultaneously. It appears to not have the ability to just open a new window or tab?

I am able to test visiting the customer site, placing an order, then visiting the business site and seeing the order. But this doesn’t test the “Live View”, which is really the most important thing to test. I want to be able to keep the business site open in one window/tab and interact with the customer site in another window/tab. I thought this would be a first-class priority for a user-interaction testing framework but there is nothing in the docs about it.

Does anyone have any ideas for how I can solve this? Will I have to do some javascript hackery (https://hexdocs.pm/wallaby/Wallaby.Browser.html#execute_script/2)?

The readme seems to highlight that feature and with more documentation at https://hexdocs.pm/wallaby/Wallaby.Feature.html#feature/3-sessions

Is that something that was attempted and did not work?

Yes I attempted that. When I use 2 sessions, I encounter a problem.

To be more clear, I encounter that problem in multiple ways. When using 2 sessions in particular, I get this error any time I try using “the 2nd session”. That is to say, I can use either one just fine but when I then use the other one, I get this mysterious “invalid session id” error.

I would love to see an actual example repo using Wallaby for testing user interactions.

Further update on this. I get the invalid session id after I click a checkboxes with class="hidden" in the second session. I am vexed.

Note I am attempting to click the checkboxes by cliking on their label or the parent element, both sometimes work and sometimes cause this “invalid session id” error.

I’m marking this as the solution because it is how we are meant to use multiple windows with Wallaby. From the docs, it wasn’t clear to me that a new window would require a new “session” (especially since a single session has functions to switch windows using “window handles”). I still have issues with it (see my comments above) but this is, ostensibly, the solution.