These are chat archives for mojotech/pioneer

26th
Sep 2014
Ricardo Machado
@mAiNiNfEcTiOn
Sep 26 2014 06:02
Well, let me share our (my team’s) thoughts. We’re considering Pioneer as our functional/behavioral testing framework, specially because it supports the Gherkin language - which helps the Business to know what we’re testing and (in some cases) write tests - has the Widget as a core concept, which is nice.
However, the question at the moment is synchronous vs asynchronous… I understand pretty well the Promise-based structure, which allows us to escape the callback hell, but if we’re writing tests that are, in fact, being executed synchronously - because the actions/behaviors reproduced by the browser are (AFAIK) one at a time - the question my team asks me is … Why asynchronous?
Any hints? :)
Ricardo Machado
@mAiNiNfEcTiOn
Sep 26 2014 06:13

Oh and I have one more question, but that can be solved by trying some stuff… But anyways, let me take the chance: The selenium-driver (WebDriverJS) has a smart behavior of detecting that when you’re doing this:

driver.wait(function(){ /* checks if element is visible */ },{timeout: 5000});
driver.click();
driver.findElement(/* … */);

he actually executes it like this:

driver.wait(function(){
  /* checks if element is visible */
},{timeout: 5000})
.then(function(){
  return driver.click();
});
.then(function(){
  driver.findElement(/* … */);
});

So, my question is, does the Widget object (which in my understanding extends the WebElement object) does the same?

Ricardo Machado
@mAiNiNfEcTiOn
Sep 26 2014 07:15

Well, let me … refactor my initial code (sorry):

driver.wait(function(){ /* checks if element is visible */ },{timeout: 5000});
driver.findElement(/* … */).click();

he actually executes it like this:

driver.wait(function(){
  /* checks if element is visible */
},{timeout: 5000})
.then(function(){
  return driver.findElement(/* … */);
});
.then(function(el){
  return el.click();
});

(It was early, was still sleepy, sorry :P)

Sam Saccone
@samccone
Sep 26 2014 13:20
hi @mAiNiNfEcTiOn thanks for the interest
so, the question at hand is "Why asynchronous?"
interestingly enough webDriver actually allows you to write in the style that you want, however in development of pioneer it was rapidly evident that the internal scheduler that webdriver uses is finicky and non deterministic in many many cases
for that reason we force you to be explicit about promise resolutions
Doing this also allows us to implement a layer of retry logic that is baked into Pioneer to harden your tests even further...
another reason is that why you are handing a non webdriver aync task… like posting to a server.. not being explicit about your flow ends up just not working.
soooo that is the basic reasons :)
let me know @mAiNiNfEcTiOn
Ricardo Machado
@mAiNiNfEcTiOn
Sep 26 2014 19:01
Hi @samccone thanks for your input.
Yeah, I can tell you that for me, async seems more natural to me. Today our team decided for the async implementation versus a sync version where it would use the webdriver-sync.
This would bring a JAVA dependency (because it uses the JAVA WebDriver), so … denied :)
Sam Saccone
@samccone
Sep 26 2014 19:02
awesome :+1:
Ricardo Machado
@mAiNiNfEcTiOn
Sep 26 2014 19:03
@samccone I am planning on enhancing the docs whenever possible, via PRs… Is that ok?
Sam Saccone
@samccone
Sep 26 2014 19:03
oh that is amazing!
all VERY VERY welcome
I have tried to be very strict about adding good docs everywhere
but they can always be better
Ricardo Machado
@mAiNiNfEcTiOn
Sep 26 2014 19:06
yeah, not complaining… I know for a FACT that doing awesome code and documenting, takes a lot of time :) ;-) And with the existing docs I already managed to do cool stuff ;-)
Sam Saccone
@samccone
Sep 26 2014 19:07
awesome, well I am always around so just ping me if you have questions / ideas / or whatever
Ricardo Machado
@mAiNiNfEcTiOn
Sep 26 2014 19:07
ok :) I will ;-) Although I’m a JS dev, I came from a PHP background, so I have some experience in Behat which applies Gherkin on PHP :)
(Specially with Mink)
So let’s see what I come up with :) But I’m really interested on the Sauce Labs integration :)