3rd progress report is under way. So far Ext Js Pathfinder can interact in a limited way with textfields and buttons. But what is it good for, if it lacks a handy set of assertions?
Writing ‘classic’ assertions in testing websites usually amounts to few things:
- asserting site’s title is equal to some expected value
- asserting element is present
- asserting element is visible
- asserting element is enabled
- asserting on any element’s properties
First assertion is nothing specific to Ext Js, so I would not bother. One can easily check this one using CasperJs:
casper.test.assert(this.getTitle() == 'Ext JS Kitchen Sink - Basic Buttons', 'Unexpected page title');
Second is easy to already using functions that are already present in Ext Js Pathfinder:
var buttons = pathfinderObj.find('button'); casper.test.assert(buttons.length > 0, 'Buttons should be found');
Latter three are not so easy to check. I remind that we do not deal with HTML tags in Ext Js applications, only with components. Therefore, such assertions must refer to components.
Fortunately, they have rich API that will do most things for us. For now, I implemented simple wrappers for checking component’s visibility and whether it is enabled or not. Usage:
var buttons = pathfinderObj.find('button'); casper.test.assert(buttons.length > 0, 'Buttons should be found'); var firstButton = buttons[buttons.length - 1]; pathfinderObj.assert.assertVisible(firstButton); pathfinderObj.assert.assertEnabled(firstButton);
…and that’s it for now.
Probably there will be no new features next week due to expanding duplication in Pathfinder’s codebase and relying on Ext Js example pages instead of own implementations. Nonetheless, stay tuned.
0