Last active
July 6, 2017 14:53
-
-
Save joelwatson/c425e41682820ed3b60ea3b67247b65a to your computer and use it in GitHub Desktop.
Selecting grid row based on column name and value with Page Object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://examples.sencha.com/extjs/6.5.0/examples/kitchensink/?classic#array-grid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var PO = { | |
grid: function () { | |
return ST.grid('grid'); | |
}, | |
selectByColumnText: function (text, value) { | |
return this.grid() | |
.execute(function (cmp) { | |
var columns = cmp.getVisibleColumns(), | |
dataIndex = null, | |
column; | |
for (var i=0; i<columns.length; i++) { | |
column = columns[i]; | |
// here "text" is the argument for selectByColumnText() | |
if (column.text === text) { | |
dataIndex = column.dataIndex; | |
break; | |
} | |
} | |
return dataIndex; | |
}) | |
.and(function () { | |
var future = this.future, | |
dataIndex = future.data.executeResult; | |
// here "value" is the argument for selectByColumnText() | |
future.selectWith(dataIndex, value); | |
}); | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('should select row from column "text" and value', function () { | |
PO.selectByColumnText('Company', 'Twitterbeat'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment