Vlad
Vlad

Reputation: 2773

Testing extjs apps

How can I test extjs application when there are pregerated ids for components or compoent parts like in a grid.

I can add ids to each component but what if I miss one or more, and the application is big and complex?

Is there a function or some module in ExtJS/Siesta which allows you to locate components/elements in the application without beign dependent on predefined ids for each component

Upvotes: 1

Views: 1307

Answers (3)

TN.
TN.

Reputation: 611

You may want to look at the automated functional GUI testing tool RIATest.

RIATest knows how to ignore ids dynamically generated by ExtJS, yet if you manually assign ids to the components the tool will use them for identification (see e.g. #tree2 in the sample below).

The tests in RIATest operate in terms of ExtJS UI widgets.

Examples of RIATest scripts that work with ExtJS widgets:

The following clicks on an ExtJS button with label "Next Page":

ExtButton("Next Page")=>click();

And the following does drag-n-drop of a row from one ExtJS tree to another:

ExtRow("Controller.js")=>dragAndDropTo(
    ExtTreePanel("#tree2")->ExtRow("Custom Ext JS"));

And this collapses the header of an ExtJS box:

ExtBox("Feeds")->ExtHeader("FeedsВ")->ExtCollapser()=>click();

(All sample code above is from real test scripts that run on ExtJS sample applications).

(Disclaimer: I am a RIATest team member).

Upvotes: 1

Mats Bryntse
Mats Bryntse

Reputation: 564

With Siesta you have loads of options when targeting a place to click etc:

  • Dom node id (same as Ext Component id)
  • Any component query
  • Any CSS query
  • A coordinate
  • Real Ext Component JS instance
  • Real DOM node instance
  • Composite Query (combination of Component Query and CSS query, '.x-grid => .x-grid-cell'
  • A function, returning any of the above.

More info in my slides here: https://speakerdeck.com/mats/testing-sencha-touch

Upvotes: 1

dbrin
dbrin

Reputation: 15673

First of all be very careful using IDs on the components. I have seen my fair share of problems with them.

Second, ExtJS provides several ways of targeting Components and Elements. Don't mix the two.

For Components:

plus various find.. methods

For Elements:

more on DOM Query http://docs.sencha.com/core/manual/content/domquery.html

Upvotes: 6

Related Questions