These are chat archives for mojotech/pioneer

Oct 2014
Jarid Margolin
Oct 09 2014 02:30
How do you handle making sure the app state is correct prior to running a specific test? In the app I am testing, the user is loggedin, and then immediately connects to a websocket... How in Pioneer, can I determine when the socket is connected? The only solution I can think of is exposing a var on the window object...
Sam Saccone
Oct 09 2014 02:32
i think i would do...
on the page
and check the return of it
and put it in a then step
so it retries
until it is true
Jarid Margolin
Oct 09 2014 02:38
All modules are encapsulated using AMD, so I would still need to expose a prop on the window... correct?
I don't love the idea of modifying my application code specifically for automation testing purposes
But I guess I would prefer it over setting a timeout and just hoping the socket is connected
Sam Saccone
Oct 09 2014 02:54
there is no state
that you can check
Jarid Margolin
Oct 09 2014 03:06
Nope. There is not :/ Potentially an argument could be made that there should be a visual update on connect, but...
Sam Saccone
Oct 09 2014 03:07
Ricardo Machado
Oct 09 2014 09:02
@jaridmargolin you can make pioneer (through the executeScript) to create a global variable and also to add a new eventListener to the websocket so that it changes the global variable.
Then you just need to do a driver.wait() until the variable has a specific value :)
I am doing that for things like JQuery UI Date Picker, when changing the month… Just to know if I am in the right month :)
Sam Saccone
Oct 09 2014 13:09
oh interesting @mAiNiNfEcTiOn great idea