Skip to content

Instantly share code, notes, and snippets.

@pschyska
Created October 25, 2010 11:49
Show Gist options
  • Save pschyska/644832 to your computer and use it in GitHub Desktop.
Save pschyska/644832 to your computer and use it in GitHub Desktop.
When /^(?:|I )should really see "([^"]*)"(?: within "([^"]*)")?$/ do |text, scope|
page.wait_until{ page.evaluate_script("!Ext.Ajax.isLoading()") }
found=page.driver.browser.execute_script <<-JS
var found=false;
Ext.ComponentMgr.all.each(function(cp) {
if(cp.el) {
if(cp.el.getAttribute('textContent').indexOf('#{text}')!= -1) {
if(cp.el.isVisible()) {
found=true;
} else {
console.info("Found "+cp.el+", but not visible");
}
}
}
}
);
return found;
JS
found.should == true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment