I've just started using Siesta and love it already! I've got some basic tests working that load up my (ExtJS v3.4) application and simulate logging in and logging out again - all works great.
Before I go much further, I want to separate out my tests and build a suite of re-usable functions - logging in and out are prime candidates as they would be called at the beginning and end of most of my tests!
I am struggling slightly and I think my problem is related to the scope passed to all functions called in e.g. t.waitFor etc - ideally I want to get hold of 't' again in a function defined elsewhere (rather than within the scope of the function passed as a parameter to StartTest itself as in all the examples I've found so far).
Conceptual example of what I'm attempting (partial):
StartTest(function (t) {
t.diag('Sanity');
t.ok(Ext, 'ExtJS found');
t.waitFor(xampe.Test.loginTest);
});
Ext.ns('xampe.Test');
xampe.Test = {
loginTest: function () {
var w = MyApp.loginWin, f,
nameField,
passwordField;
t.diag('Login');
t.ok(w, 'Login Form Found');
//etc (code that works fine when structured within the scope of the original function as per examples)
}
}
var test;
StartTest(function(t) {
test = t;
// etc
});
Another attempt was based on a look at some of the Siesta code - I thought that perhaps the 'global' variable of the scope in the function would contain the global variables of the original scope, so I tried replacing 'test' with 'this.global.test', but no joy.
Anyone have some suggestions on how to create and structure a set of re-usable test functions that can access the same Test object? I'd like to start as I mean to go on so would welcome any ideas.
Thanks
Nigel