Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilize blocklayout.feature #26148

Merged
merged 1 commit into from
Nov 17, 2018
Merged

Conversation

islemaster
Copy link
Contributor

Elijah noticed significant flakiness in this test today. After a little investigation I decided the safest thing is to wait for Blockly.mainBlockSpace to be available on the client before we try to clear it.

Ran against IE11 three times in a row without any scenarios failing, and then ran against our whole set of browsers and everything passed on the first try.

image

I'll make some notes inline about my approach here (it's somewhat new-to-us) and I'd like to follow this with some more cleanup to our steps, but figured getting the initial stability fix in was important.

# Do our async wait on the JavaScript side instead of polling over the wire.
# See https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/JavascriptExecutor.html
# and https://www.rubydoc.info/gems/selenium-webdriver/3.8.0/Selenium/WebDriver/Driver#execute_async_script-instance_method
result = @browser.execute_async_script <<-JS
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't used execute_async_script before. It passes a callback as the last argument to your JavaScript, and blocks until the callback is called (or the selenium script timeout is reached).

The idea here is that we don't need our test runner to poll SauceLabs waiting for something to be available - we can do that in injected JavaScript on the client and call back when ready. More generally, I wish we used fewer over-the-wire commands per Cucumber step, and I think this is a step in the right direction.

}
}())
JS
expect(result).to be_nil
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, although there's a Selenium script timeout, it gives a spew of confusing output when you hit it. I'm implementing my own client-side timeout here (5 seconds seemed pretty good in this case where we weren't waiting at all before) that will result in a nice rspec assertion failures if it's reached.

@@ -58,6 +58,9 @@ def saucelabs_browser(test_run_name)
http_client: http_client
)

# Maximum time a single execute_script or execute_async_script command may take
browser.manage.timeouts.script_timeout = 30.seconds
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure where the default was coming from, but without this line I was getting

Timeout expired waiting for async script
Command duration or timeout: 98 milliseconds

Copy link
Member

@davidsbailey davidsbailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks great!

@islemaster islemaster merged commit 5b3cf86 into staging Nov 17, 2018
@islemaster islemaster deleted the stabilize-blocklayout-feature branch November 17, 2018 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants