I had a problem with Intertern 2 waiting for the elements to appear. In Intern 1, I used wait() to set urgent time periods so that the page would wait for an element to appear after some user action. With Internet 2, there seems to be setFindTimeout() , which should always say that the find() method should wait a bit while the element is present. I set setFindTimeout() and tried to use pollUntil to handle these expectations, but the tests still do not work with the absence of an error element.
Here is an example test that uses the same requirements as my real tests and looks for the identifier of the element that appears 5 seconds after this page load.
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() } } ]); });
source share