ExtJs - Triggering Column Header Sorting programmatically (e.g. with QTP)

905 Views Asked by At

Our team is setting up test scripts for automating interaction testing using QTP, for an ExtJS based application.

Many of our elements/objects are being detected as desired, with the exception of column header sorting triggers.

Our grid panel has remote sorting, however programatically triggering a column header "click" doesn't fire our sorting, although "click"ing manually on the column header does. I've tried mousedown and mouseup, on the column header Div, and it's children -titleEl and -textEl as well.

Any ideas?

Thanks in advance.

1

There are 1 best solutions below

0
On

The simplest way would be to tell QTP to generate mouse events, this way all the events that are fired when a real human clicks the header will be fired when QTP clicks it.

As seen here

origReplayType = Setting.WebPackage("ReplayType")
Setting.WebPackage("ReplayType") = 2

Browser("B").Page("P").WebElement("column header").Click ' your script line here

Setting.WebPackage("ReplayType") = origReplayType

If this is a common occurrence you can use RegisterUserFunc to define a new DeviceClick function to your test objects.

A slightly more complex way is to debug the application and see which event triggers sorting the column and then use FireEvent with the correct event.