I have several test files in Siesta for my ExtJS application. Some of those tests must be ran and pass before others should begin. Is there a way to execute tests only after a previous test has passed?
Asked
Active
Viewed 555 times
1 Answers
1
In Siesta you can use tests to run both asynchronous code and can do chaining and waiting. For more information you can see the Get Started Guide but I've included an example here for completeness as well.
Using wait, one of the async methods:
t.wait('xhrSample');
Ext.Ajax.request({
url : 'ajax_demo/sample.json',
success : function (response, opts) {
t.is(response, 'foobar', 'Response is correct');
t.endWait('xhrSample');
},
failure : function (response, opts) {
t.fail("request failed");
t.endWait('xhrSample');
}
});
Using chain in Siesta:
t.chain(
function (next) {
t.type(userNameField, 'username', next)
},
function (next) {
t.type(passwordField, 'secret', next)
},
function (next) {
t.click(loginButton, next)
},
function () {
// done
}
});
And lasting using waitFor:
this.waitFor(
// The condition to check for, this line will mean waiting until the presence of #foo element
function() { return document.getElementById('foo'); },
// The callback, after the condition has been fulfilled
function(el) { /* DO COOL STUFF */ }
);
If you have other questions, I'd likely need more information strictly about what you are waiting for Siesta to finish.

ars265
- 1,949
- 3
- 21
- 37