我有一个xtype的元素:'usersList' 我需要在测试中验证此元素目前不存在。我怎么能用Sencha Test(v.2.0.0)做到这一点? ST.component('usersList')会导致测试失败......
答案 0 :(得分:1)
ST.component()
期望该组件存在,因此您无法以这种方式使用它。
你可以用这个:
ST.play([{fn:function(){
expect(Ext.first('userList')).toBeDefined();
}}]);
和FYI - 如果你需要等待元素(动画或填充网格),你可以使用
ST.wait(function(){
//waiting for UserList
return Ext.first('userList');
});
这需要不同的方法。试试这段代码 -
describe("webDriver", function() {
it("should return true if userList is not present", function() {
ST.execute(function () {
return Ext.first('userList') < 0;
})
.and(function (future) {
expect(future.data.executeResult).toBe(true);
});
});
});
文档也应该对您有所帮助。对于此示例 - ST.execute()