I'm having an issue getting Intern 2 to wait for elements to be present. In Intern 1 I was using wait()
to set express time periods for the page to wait for an element to be present after some user action. With Intern 2 there seems to be setFindTimeout()
which should always tell a find()
method to wait a bit for the element to be present. I've set setFindTimeout()
and tried using pollUntil
to handle these waits but the tests are still failing with the error "element not visible".
Here is a sample test that is using the same requirements as my real tests and is looking for an element Id which appears 5 seconds after this page loads.
define([
'intern!object',
'intern/chai!assert',
'require',
'tests/util',
'intern/dojo/node!leadfoot/Command',
'intern/dojo/node!leadfoot/Session',
'intern/dojo/node!leadfoot/helpers/pollUntil'
], function (registerSuite, assert, require, util, Command, Session, pollUntil) {
registerSuite([
{
name: 'testing_find_by_wait',
test_create_form_on_web: function() {
console.log('Create a form with account, number, number and formula fields')
return this.remote
.setFindTimeout(10000)
.setWindowSize(1280, 960)
.get("http://www.kgstew.com/waittest.html")
.then(pollUntil('return document.getElementById("demo")', 10000))
.findById('demo')
.click()
.end()
}
}
]);
});