I am confused as to how you assert the boolean. Is it simply a true or false?
2009/6/3 aidy lewis <[email protected]> > > def wait_for?(seconds=0) > slept = 0 > until yield || slept == seconds > sleep 0.5 > slept += 0.5 > end > yield > end > > > boolean = wait_for?(35) { @@ie.div(:text, 'Loading...').exists? } > assert(boolean) > > #you may get more benefit from using Rspec or Cucumber > > Aidy > > 2009/6/3 Jer <[email protected]>: > > > > Hi all, > > Just wondering can anyone help me with this code. I just want to check > > my assert at the finish to see if the value "loading..." is present. > > If after 35 seconds it is present I want it to fail, if it is gone > > from the screen I want it to pass. My code is included. > > > > Thanks. > > > > require 'yaml' > > require 'test/unit' > > require 'watir' > > > > require 'myCompany' > > require 'utils' > > > > include COMPANY::Utils > > #load test parameters > > @@ddt = open('data.yml') {|f| YAML.load(f) } > > @@ie = getBrowser(@@ddt['url']) > > > > class DocumentTestScripts < Test::Unit::TestCase > > > > def setup > > > > > > @myCompany = COMPANY::MyCompany.new(@@ie) > > > > end > > > > def test_00009_Bug4986_error_on_dialog_close > > > > @myCompany.loginIssue @@ddt['username'], "aasda" #deliberately > > enter the wrong pwd > > > > if jsToEval = 'Ext.query("div.x-tool")[0].click()' #check for x > > and click if present > > @@ie.document.parentWindow.eval(jsToEval) > > else > > @@ie.button(:text, 'Close').click() #otherwise just click close > > end > > > > #sleep 1 until @@ie.text.!include? "Loading..." > > > > sleep 35 > > > > assert(@@ie.div(:text, 'Loading...').exists?) > > > > #Simple pusedo code representaion of what I want to do > > > > #if true > > #puts 'Loading present, test failed' > > #else > > #puts 'Test passed' > > #end > > > > end > > > > end > > > > > > > > > > > -- > Aidy > blog: www.agiletester.co.uk > twitter: http://twitter.com/aidy_lewis > > > > -- Jerry --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to [email protected] Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/watir-general -~----------~----~----~----~------~----~------~--~---
