Can I just use a simple if to do that thou? Something simple such as

      if boolean = true
        puts 'Test Passed'
      else
        puts 'Test Failed'
      end
Is there documentation of Boolean anywhere in relation to tracker? The test
is very simple but gettingg the report from the div is driving me insane,
The problem is Loading... will be present for a few seconds regardless, the
issue only arises when it does not disappear after a few minutes.
2009/6/3 aidy lewis <aidy.le...@googlemail.com>

>
> The predicate '?' in Ruby indicates that the method returns a Boolean.
>
> The wait_for? method will 'yield' if that block is true.
>
> And then we are asserting whether that block is true or false.
>
> Aidy
>
> 2009/6/3 Jerry Lane <lane...@gmail.com>:
>  > I am confused as to how you assert the boolean. Is it simply a true or
> > false?
> >
> > 2009/6/3 aidy lewis <aidy.le...@googlemail.com>
> >>
> >>  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 <lane...@gmail.com>:
> >> >
> >> > 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
> >
> > >
> >
>
>
>
> --
>  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 watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to