(To the tune of “Are you sure Hank done it this way”, with apologies to Waylon Jennings.)

It’s the same old scheme, code and PR.
Where do we take it from here?
Razor scoots and in-house coffee bars.
It’s been the same way for years.
We need to change.

They told me, when I got to the Valley:
“Son, you’ve finally got it made.
Zuckerberg made it here, and we’re all sure that you will.”
But I don’t think Zuck’ done it this way.
I don’t think that Zuck’ done it this way.

Ten years in the code,
making midnight deploys.
Pitching my young life away.
Tweet me one time just so I understand,
Are you sure that Zuck’ done it this way?
Did Zuckerberg really do it this way?

I’ve seen the world with my bootstrapped team
looking at my fudged balance sheets.
Hackin’ on my ideas (and one of his, now and then)
But I don’t think Zuck’ wrote ‘em this way.
No, Zuck’ didn’t code ‘em this way.

Suppose you’re using the following command to interact with an iframe within capybara:

page.driver.browser.switch_to.frame(‘iframe’)

Sometimes it works, but often you get en error like:

Element is not currently visible and so may not be interacted with

You may be falling prey the retry methods built in to capybara. See, capybara is waiting for something to appear in the dom and keeps retrying failing code until it does.

But what you did, by changing scope with “#swich_to” is made it so a previous passing command is now failing. Technically, you’ve made only what is in the iframe visible to capybara, so when the retry happens, things that were previously there are now not visible; they are still in the DOM, but not in current scope, hence “not visible”.

Try this. In a “background” or “before(:each)” before the test in question:

background { @window_handle = page.driver.browser.window_handle }

..and then, before your assertions:

page.driver.browser.switch_to.window(@window_handle)

That will ensure proper DOM scope on the retries.

Apologies to Jim Weirich, creator of the original Pair Programming Bot. I copied him to make this.

The command list fot the Twitter Pair Programming Bot:

  • hello : Say hello you dolt, it’s good manners.
  • start FEATURE_NAME : start a new feature.
  • yes, /^yes/ : answer in the affirmative. (any response starting with the word “yes” is accepted.)
  • no, /^no/ : answer in the negative. (any response starting with the word “no” is accepted.)
  • list : show what features you’ve worked on together.
  • where : where were you in the current feature?
  • what : what feature were you working on?
  • finish : prematurely mark feature as finished.
  • spoon : asking the bot to spoon with you will have it follow you. You can then talk to it via direct message. You MUST follow it back so it can DM replies.