I'm creating UI (GUI) test for my demo-app and doing lots of succession of actions. Therefore needs some idea!
I've created several methods in Test Class:
var formData = '#main-home #contentPanel #formData ';
Class('Siesta.Test.DataScreen', {
isa: Siesta.Test.ExtJS,
methods: {
clickAndType: function (fieldName, content, callback) {
var t = this;
t.chain(
{click: formData + fieldName +' => .x-form-text', desc: 'Clicks on '+fieldName+' field'},
{type: content, desc: 'Types '+ content +' field'},
callback
)
},
...
describe('UI Testing: Submodule Data Screen', function (t) {
t.it('Filling the form fields with dummy data', function (t) {
var next = t.next;
t.chain(
{clickAndType: ['descfld[name=description]', 'Siesta Test 123']},
...
The thing I'm using lots of clickAndType method for many different submodules and each time I had to change content (typed text) because of Database that I am using is protected for similar records.
Is there any way to tell Siesta read data from a JSON file? So I can easily change the data that will type to field on one file and implement for all other 29 test files?
Or any other idea for DRY?
Thanks in advice.