tl;dr – Ext Js Pathfinder now can query elements using built-in ComponentQuery and emulate clicking buttons. Only Ext 4 is supported at the moment, though.
What I’ve made
I have put some work into the project. Main consideration was to choose convenient testing framework, that would actually help develop Ext Js Pathfinder. Finally I have chosen Casper JS due to nice integration with PhantomJS – headless browser. What is more, its github repo is alive – that’s a major advantage. Last but not least – actual tests are written in JavaScript, so I don’t have to worry about writing extra glue code between Pathfinder and testing framework – at least for now.
Having CasperJS, I could finally write some code. Before using library, one has to initialize it:
var pathfinder = require('extjs-pathfinder'); // ... omited lines pathfinderObj = pathfinder.brief(this, function () { return Ext; });
pathfinder.brief function has two arguments – first is a reference to casper object. It was given, because library extensively uses evaluate method to run its code in context of a web browser. I definitely don’t want to see anyone passing it everytime they need to ask pathfinder to do something.
Second argument is a function that called in a context of a browser will return Ext root object. Why not just leave it to a library itself? Well, there are some scenarios when this is not enough. Our Ext Js library may be put under different namespace or simply using sandboxing technique to allow use newer versions of Ext Js at the same time. Example of such sandbox here – official docs show using Ext Js 4 alongside older Ext Js 3.
I’ve written simple test showing that actual querying works.
What’s next?
Next week I will be writing custom page with various Ext Js components for sole purpose of getting better and faster feedback from my tests. For now I use kitchensink, that is Ext Js showcase with various components.
I will also write some code for handling simple inputs.
0