capy_time 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/.gitignore +9 -0
 - data/.travis.yml +4 -0
 - data/CODE_OF_CONDUCT.md +13 -0
 - data/Gemfile +4 -0
 - data/LICENSE.txt +21 -0
 - data/README.md +109 -0
 - data/Rakefile +1 -0
 - data/bin/console +14 -0
 - data/bin/setup +7 -0
 - data/capy_time.gemspec +23 -0
 - data/lib/capy_time/version.rb +3 -0
 - data/lib/capy_time.rb +348 -0
 - metadata +85 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 6b9ad1333c6c57cda02af89e1163bf30d3669e8d
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: a4c561a1bd78b85f391015f257bfd777dd8eb578
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 745c3b2fe7266d408926a57d49b5938fbd94a22f82e8d4082f2d117b068818610334bb1dacd64f73baa60d4247f019ddc9fd0c17d6812ce4d54008e885d71832
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 9984d9e718bb8af77ad1de0b4b8ed061eb1b5040a9e48e8d419f54f376945af18f471b21c663ff202bd66dcbd4379aecfd956b611c375d688253c1b53f497e88
         
     | 
    
        data/.gitignore
    ADDED
    
    
    
        data/.travis.yml
    ADDED
    
    
    
        data/CODE_OF_CONDUCT.md
    ADDED
    
    | 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Contributor Code of Conduct
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
         
     | 
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.txt
    ADDED
    
    | 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            The MIT License (MIT)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Copyright (c) 2015 bem29
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
      
 6 
     | 
    
         
            +
            of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
      
 7 
     | 
    
         
            +
            in the Software without restriction, including without limitation the rights
         
     | 
| 
      
 8 
     | 
    
         
            +
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
      
 9 
     | 
    
         
            +
            copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
      
 10 
     | 
    
         
            +
            furnished to do so, subject to the following conditions:
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be included in
         
     | 
| 
      
 13 
     | 
    
         
            +
            all copies or substantial portions of the Software.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
      
 16 
     | 
    
         
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
      
 17 
     | 
    
         
            +
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
      
 18 
     | 
    
         
            +
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
      
 19 
     | 
    
         
            +
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
      
 20 
     | 
    
         
            +
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         
     | 
| 
      
 21 
     | 
    
         
            +
            THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,109 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # CapyTime
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            CapyTime is a tool that allows you to use Capybara without having to worry about the timing issues.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Add this line to your application's Gemfile:
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 10 
     | 
    
         
            +
            gem 'capy_time'
         
     | 
| 
      
 11 
     | 
    
         
            +
            ```
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            And then execute:
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                $ bundle
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            Or install it yourself as:
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                $ gem install capy_time
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 22 
     | 
    
         
            +
            Add the lines: require 'capy_time' and World(CapyTime) to your env file.
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            Method : load_element(statement,*options)
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            Description : This takes the css for an element and then makes sure the element is loaded or fails after timeout is reached if method doesn't load
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            Options :  
         
     | 
| 
      
 29 
     | 
    
         
            +
                
         
     | 
| 
      
 30 
     | 
    
         
            +
                :text  this allows you to select an element based on it's text 
         
     | 
| 
      
 31 
     | 
    
         
            +
                
         
     | 
| 
      
 32 
     | 
    
         
            +
                example: load_element('a', :text =>/welcome/)
         
     | 
| 
      
 33 
     | 
    
         
            +
                
         
     | 
| 
      
 34 
     | 
    
         
            +
                :time this allows you to set an explicit timeout for just this call
         
     | 
| 
      
 35 
     | 
    
         
            +
                
         
     | 
| 
      
 36 
     | 
    
         
            +
                example: load_element('a', :text =>/welcome/,:time =>60)
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            Method : load_true(statement,*options) 
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            Description : This takes a statement that evaluates to a boolean and waits for it to evaluate to true or fails after timeout is reached if still false
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            Options:
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                :time this allows you to set an explicit timeout for just this call
         
     | 
| 
      
 45 
     | 
    
         
            +
                
         
     | 
| 
      
 46 
     | 
    
         
            +
                example: load_true(all('div.result').length==0, :time =>60)
         
     | 
| 
      
 47 
     | 
    
         
            +
                
         
     | 
| 
      
 48 
     | 
    
         
            +
                :refresh this allows you to tell the page to refresh before it attempts to evaluate the statement
         
     | 
| 
      
 49 
     | 
    
         
            +
                
         
     | 
| 
      
 50 
     | 
    
         
            +
                example: load_true(all('div.result').length==0, :refresh =>true)
         
     | 
| 
      
 51 
     | 
    
         
            +
               
         
     | 
| 
      
 52 
     | 
    
         
            +
            Method: should_have_content(statement,*options)
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
            Description : This takes a string that is expected to be in the page (or a given parent) and waits for it to load or fails after timeout is reached and the content wasn't loaded within the parent
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            Options:
         
     | 
| 
      
 57 
     | 
    
         
            +
                
         
     | 
| 
      
 58 
     | 
    
         
            +
                :time this allows you to set an explicit timeout for just this call
         
     | 
| 
      
 59 
     | 
    
         
            +
                
         
     | 
| 
      
 60 
     | 
    
         
            +
                example: should_have_content('welcome', :time => 60)
         
     | 
| 
      
 61 
     | 
    
         
            +
                
         
     | 
| 
      
 62 
     | 
    
         
            +
                :refresh this allows you to tell the page to refresh before it attempts to evaluate the statement
         
     | 
| 
      
 63 
     | 
    
         
            +
                
         
     | 
| 
      
 64 
     | 
    
         
            +
                example: should_have_content('welcome', :refresh => true)
         
     | 
| 
      
 65 
     | 
    
         
            +
                
         
     | 
| 
      
 66 
     | 
    
         
            +
                :parent this allows you to make sure that the content is inside a given element
         
     | 
| 
      
 67 
     | 
    
         
            +
                
         
     | 
| 
      
 68 
     | 
    
         
            +
                example: should_have_content('welcome', :parent =>"div#welcomeMsg")
         
     | 
| 
      
 69 
     | 
    
         
            +
                
         
     | 
| 
      
 70 
     | 
    
         
            +
            Method: should_have_css(statement,*options)
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
            Description : This takes the css for an element and then makes sure the element is loaded within the parent element or fails after timeout is reached and the css wasn't loaded within the parent
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
            Options:
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
                :time this allows you to set an explicit timeout for just this call
         
     | 
| 
      
 77 
     | 
    
         
            +
                
         
     | 
| 
      
 78 
     | 
    
         
            +
                example: should_have_css('p', :time => 60)
         
     | 
| 
      
 79 
     | 
    
         
            +
                
         
     | 
| 
      
 80 
     | 
    
         
            +
                :refresh this allows you to tell the page to refresh before it attempts to evaluate the statement
         
     | 
| 
      
 81 
     | 
    
         
            +
                
         
     | 
| 
      
 82 
     | 
    
         
            +
                example: should_have_css('p', :refresh => true)
         
     | 
| 
      
 83 
     | 
    
         
            +
                
         
     | 
| 
      
 84 
     | 
    
         
            +
                :parent this allows you to make sure that the content is inside a given element NOTE:if not used it will default to page
         
     | 
| 
      
 85 
     | 
    
         
            +
                
         
     | 
| 
      
 86 
     | 
    
         
            +
                example: should_have_css('p', :parent =>"div#welcomeMsg")
         
     | 
| 
      
 87 
     | 
    
         
            +
               
         
     | 
| 
      
 88 
     | 
    
         
            +
            Method: should_open_tab(url,prevTabTotal,*options)
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
            Description: This takes a partial or full url and waits for the browser to open the url in a new tab or fails if the timeout is reached and the url wasn't opened in a new tab
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
            Options:
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
                :time this allows you to set an explicit timeout for just this call
         
     | 
| 
      
 95 
     | 
    
         
            +
                
         
     | 
| 
      
 96 
     | 
    
         
            +
                example: should_open_tab('rubygems.org',4,:time =>60)
         
     | 
| 
      
 97 
     | 
    
         
            +
                
         
     | 
| 
      
 98 
     | 
    
         
            +
                :close this allows you to specify that after opening the tab it should close the tab and go back to the first tab
         
     | 
| 
      
 99 
     | 
    
         
            +
                
         
     | 
| 
      
 100 
     | 
    
         
            +
                example: should_open_tab('rubygems.org',3,:close =>true)
         
     | 
| 
      
 101 
     | 
    
         
            +
                
         
     | 
| 
      
 102 
     | 
    
         
            +
            Method: wait_for_page_change(prevUrl)
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
            Description: This takes the url of a page before an action occurred and then makes sure that the url changes before continuing or fails if timeout is reached and url never changed
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
            ## License
         
     | 
| 
      
 107 
     | 
    
         
            +
             
     | 
| 
      
 108 
     | 
    
         
            +
            The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
    
        data/Rakefile
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "bundler/gem_tasks"
         
     | 
    
        data/bin/console
    ADDED
    
    | 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "bundler/setup"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "capy_time"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            # You can add fixtures and/or initialization code here to make experimenting
         
     | 
| 
      
 7 
     | 
    
         
            +
            # with your gem easier. You can also use a different console, if you like.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            # (If you use this, don't forget to add pry to your Gemfile!)
         
     | 
| 
      
 10 
     | 
    
         
            +
            # require "pry"
         
     | 
| 
      
 11 
     | 
    
         
            +
            # Pry.start
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            require "irb"
         
     | 
| 
      
 14 
     | 
    
         
            +
            IRB.start
         
     | 
    
        data/bin/setup
    ADDED
    
    
    
        data/capy_time.gemspec
    ADDED
    
    | 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # coding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'capy_time/version'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Gem::Specification.new do |spec|
         
     | 
| 
      
 7 
     | 
    
         
            +
              spec.name          = "capy_time"
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.version       = CapyTime::VERSION
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.authors       = ["Bradley Maynard"]
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.email         = ["maynard_bradley@yahoo.com"]
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              spec.summary       = %q{Tool for handling timing issues in capybara.}
         
     | 
| 
      
 13 
     | 
    
         
            +
              spec.description   = %q{capy_time is a tool that allows you to use Capybara without having to worry about the timing issues.}
         
     | 
| 
      
 14 
     | 
    
         
            +
              spec.license       = "MIT"
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              spec.files         = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
         
     | 
| 
      
 17 
     | 
    
         
            +
              spec.bindir        = "exe"
         
     | 
| 
      
 18 
     | 
    
         
            +
              spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         
     | 
| 
      
 19 
     | 
    
         
            +
              spec.require_paths = ["lib"]
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              spec.add_development_dependency "bundler", "~> 1.10"
         
     | 
| 
      
 22 
     | 
    
         
            +
              spec.add_development_dependency "rake", "~> 10.0"
         
     | 
| 
      
 23 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/capy_time.rb
    ADDED
    
    | 
         @@ -0,0 +1,348 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "capy_time/version"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module CapyTime
         
     | 
| 
      
 4 
     | 
    
         
            +
                def load_element(statement,*options)
         
     | 
| 
      
 5 
     | 
    
         
            +
                    #initialize
         
     | 
| 
      
 6 
     | 
    
         
            +
                    loaded=false
         
     | 
| 
      
 7 
     | 
    
         
            +
                    
         
     | 
| 
      
 8 
     | 
    
         
            +
                    #retrieve options (if any)
         
     | 
| 
      
 9 
     | 
    
         
            +
                    if(options!=[] && ((x=options.pop)!=nil))then
         
     | 
| 
      
 10 
     | 
    
         
            +
                        @options = []
         
     | 
| 
      
 11 
     | 
    
         
            +
                        @options.push(x.dup)
         
     | 
| 
      
 12 
     | 
    
         
            +
                        for o in options do
         
     | 
| 
      
 13 
     | 
    
         
            +
                            @options.push(options[o])
         
     | 
| 
      
 14 
     | 
    
         
            +
                        end
         
     | 
| 
      
 15 
     | 
    
         
            +
                    else
         
     | 
| 
      
 16 
     | 
    
         
            +
                        @options=[]
         
     | 
| 
      
 17 
     | 
    
         
            +
                    end
         
     | 
| 
      
 18 
     | 
    
         
            +
                    
         
     | 
| 
      
 19 
     | 
    
         
            +
                    #if option has known key put val for key in var
         
     | 
| 
      
 20 
     | 
    
         
            +
                    @t=nil
         
     | 
| 
      
 21 
     | 
    
         
            +
                    @r=nil
         
     | 
| 
      
 22 
     | 
    
         
            +
                    @te=nil
         
     | 
| 
      
 23 
     | 
    
         
            +
                    for o in @options do
         
     | 
| 
      
 24 
     | 
    
         
            +
                        val = @options.pop.dup
         
     | 
| 
      
 25 
     | 
    
         
            +
                        if(val.has_key?(:time))then
         
     | 
| 
      
 26 
     | 
    
         
            +
                            @t = val[:time]
         
     | 
| 
      
 27 
     | 
    
         
            +
                        elsif(val.has_key?(:refresh))then
         
     | 
| 
      
 28 
     | 
    
         
            +
                            @r = val[:refresh]
         
     | 
| 
      
 29 
     | 
    
         
            +
                        elsif(val.has_key?(:text))then
         
     | 
| 
      
 30 
     | 
    
         
            +
                            @te = val[:text]
         
     | 
| 
      
 31 
     | 
    
         
            +
                        end
         
     | 
| 
      
 32 
     | 
    
         
            +
                    end
         
     | 
| 
      
 33 
     | 
    
         
            +
                    
         
     | 
| 
      
 34 
     | 
    
         
            +
                    #set vars or default if option not provided
         
     | 
| 
      
 35 
     | 
    
         
            +
                    @time=nil
         
     | 
| 
      
 36 
     | 
    
         
            +
                    @time=@t ||=ENV['STIME'].to_i
         
     | 
| 
      
 37 
     | 
    
         
            +
                    @refresh=nil
         
     | 
| 
      
 38 
     | 
    
         
            +
                    @refresh=@r ||=false
         
     | 
| 
      
 39 
     | 
    
         
            +
                    @text=@te ||=nil
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                    Timeout.timeout(@time)do
         
     | 
| 
      
 42 
     | 
    
         
            +
                      begin
         
     | 
| 
      
 43 
     | 
    
         
            +
                        urlPopulated= false
         
     | 
| 
      
 44 
     | 
    
         
            +
                        while(!urlPopulated)
         
     | 
| 
      
 45 
     | 
    
         
            +
                        urlPopulated= current_url.length>0
         
     | 
| 
      
 46 
     | 
    
         
            +
                        end
         
     | 
| 
      
 47 
     | 
    
         
            +
                        if(@refresh)then
         
     | 
| 
      
 48 
     | 
    
         
            +
                            page.evaluate_script('window.history.go()')
         
     | 
| 
      
 49 
     | 
    
         
            +
                            found=false
         
     | 
| 
      
 50 
     | 
    
         
            +
                            while(!found)
         
     | 
| 
      
 51 
     | 
    
         
            +
                                begin
         
     | 
| 
      
 52 
     | 
    
         
            +
                                    if(@text==nil)then
         
     | 
| 
      
 53 
     | 
    
         
            +
                                        found = (all(statement)!=nil && all(statement).length>0)
         
     | 
| 
      
 54 
     | 
    
         
            +
                                    else
         
     | 
| 
      
 55 
     | 
    
         
            +
                                        found = (all(statement,:text =>@text)!=nil && all(statement,:text =>@text).length>0)
         
     | 
| 
      
 56 
     | 
    
         
            +
                                    end
         
     | 
| 
      
 57 
     | 
    
         
            +
                                rescue
         
     | 
| 
      
 58 
     | 
    
         
            +
                                    retry
         
     | 
| 
      
 59 
     | 
    
         
            +
                                end
         
     | 
| 
      
 60 
     | 
    
         
            +
                            end
         
     | 
| 
      
 61 
     | 
    
         
            +
                            if(@text==nil)then
         
     | 
| 
      
 62 
     | 
    
         
            +
                                return all(statement)
         
     | 
| 
      
 63 
     | 
    
         
            +
                            else
         
     | 
| 
      
 64 
     | 
    
         
            +
                                return all(statement,:text =>@text)
         
     | 
| 
      
 65 
     | 
    
         
            +
                            end
         
     | 
| 
      
 66 
     | 
    
         
            +
                        end
         
     | 
| 
      
 67 
     | 
    
         
            +
                        found=false
         
     | 
| 
      
 68 
     | 
    
         
            +
                            while(!found)
         
     | 
| 
      
 69 
     | 
    
         
            +
                                begin
         
     | 
| 
      
 70 
     | 
    
         
            +
                                    if(@text==nil)then
         
     | 
| 
      
 71 
     | 
    
         
            +
                                        found = (all(statement)!=nil && all(statement).length>0)
         
     | 
| 
      
 72 
     | 
    
         
            +
                                    else
         
     | 
| 
      
 73 
     | 
    
         
            +
                                        found = (all(statement,:text =>@text)!=nil && all(statement,:text =>@text).length>0)
         
     | 
| 
      
 74 
     | 
    
         
            +
                                    end
         
     | 
| 
      
 75 
     | 
    
         
            +
                                rescue
         
     | 
| 
      
 76 
     | 
    
         
            +
                                    retry
         
     | 
| 
      
 77 
     | 
    
         
            +
                                end
         
     | 
| 
      
 78 
     | 
    
         
            +
                            end
         
     | 
| 
      
 79 
     | 
    
         
            +
                        if(@text==nil)then
         
     | 
| 
      
 80 
     | 
    
         
            +
                                return all(statement)
         
     | 
| 
      
 81 
     | 
    
         
            +
                            else
         
     | 
| 
      
 82 
     | 
    
         
            +
                                return all(statement,:text =>@text)
         
     | 
| 
      
 83 
     | 
    
         
            +
                            end
         
     | 
| 
      
 84 
     | 
    
         
            +
                      rescue
         
     | 
| 
      
 85 
     | 
    
         
            +
                        retry
         
     | 
| 
      
 86 
     | 
    
         
            +
                      end
         
     | 
| 
      
 87 
     | 
    
         
            +
                    end
         
     | 
| 
      
 88 
     | 
    
         
            +
                end
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
                def should_have_content(content,*options)
         
     | 
| 
      
 91 
     | 
    
         
            +
                    #retrieve options (if any)
         
     | 
| 
      
 92 
     | 
    
         
            +
                    if(options!=[] && ((x=options.pop)!=nil))then
         
     | 
| 
      
 93 
     | 
    
         
            +
                        @options = []
         
     | 
| 
      
 94 
     | 
    
         
            +
                        @options.push(x.dup)
         
     | 
| 
      
 95 
     | 
    
         
            +
                        for o in options do
         
     | 
| 
      
 96 
     | 
    
         
            +
                            @options.push(options[o])
         
     | 
| 
      
 97 
     | 
    
         
            +
                        end
         
     | 
| 
      
 98 
     | 
    
         
            +
                    else
         
     | 
| 
      
 99 
     | 
    
         
            +
                        @options=[]
         
     | 
| 
      
 100 
     | 
    
         
            +
                    end
         
     | 
| 
      
 101 
     | 
    
         
            +
                    
         
     | 
| 
      
 102 
     | 
    
         
            +
                    #if option has known key put val for key in var
         
     | 
| 
      
 103 
     | 
    
         
            +
                    @t=nil
         
     | 
| 
      
 104 
     | 
    
         
            +
                    @r=nil
         
     | 
| 
      
 105 
     | 
    
         
            +
                    @p=nil
         
     | 
| 
      
 106 
     | 
    
         
            +
                    for o in @options do
         
     | 
| 
      
 107 
     | 
    
         
            +
                        val = @options.pop.dup
         
     | 
| 
      
 108 
     | 
    
         
            +
                        if(val.has_key?(:time))then
         
     | 
| 
      
 109 
     | 
    
         
            +
                            @t = val[:time]
         
     | 
| 
      
 110 
     | 
    
         
            +
                        elsif(val.has_key?(:refresh))then
         
     | 
| 
      
 111 
     | 
    
         
            +
                            @r = val[:refresh]
         
     | 
| 
      
 112 
     | 
    
         
            +
                        elsif(val.has_key?(:parent))then
         
     | 
| 
      
 113 
     | 
    
         
            +
                            @p = val[:parent]
         
     | 
| 
      
 114 
     | 
    
         
            +
                        end
         
     | 
| 
      
 115 
     | 
    
         
            +
                    end
         
     | 
| 
      
 116 
     | 
    
         
            +
                    
         
     | 
| 
      
 117 
     | 
    
         
            +
                    #set vars or default if option not provided
         
     | 
| 
      
 118 
     | 
    
         
            +
                    @time=nil
         
     | 
| 
      
 119 
     | 
    
         
            +
                    @time=@t ||=ENV['STIME'].to_i
         
     | 
| 
      
 120 
     | 
    
         
            +
                    @refresh=nil
         
     | 
| 
      
 121 
     | 
    
         
            +
                    @refresh=@r ||=false
         
     | 
| 
      
 122 
     | 
    
         
            +
                    @parent=nil
         
     | 
| 
      
 123 
     | 
    
         
            +
                    @parent=@p ||=nil
         
     | 
| 
      
 124 
     | 
    
         
            +
                    
         
     | 
| 
      
 125 
     | 
    
         
            +
                    @content=content
         
     | 
| 
      
 126 
     | 
    
         
            +
                    Timeout.timeout(@time)do
         
     | 
| 
      
 127 
     | 
    
         
            +
                        urlPopulated= false
         
     | 
| 
      
 128 
     | 
    
         
            +
                        while(!urlPopulated)
         
     | 
| 
      
 129 
     | 
    
         
            +
                        urlPopulated= current_url.length>0
         
     | 
| 
      
 130 
     | 
    
         
            +
                        end
         
     | 
| 
      
 131 
     | 
    
         
            +
                        if(@refresh && (@content!=nil) && @parent!=nil)then
         
     | 
| 
      
 132 
     | 
    
         
            +
                            page.evaluate_script('window.history.go()')
         
     | 
| 
      
 133 
     | 
    
         
            +
                            load_element(@parent)
         
     | 
| 
      
 134 
     | 
    
         
            +
                            status=false
         
     | 
| 
      
 135 
     | 
    
         
            +
                            while(!status)
         
     | 
| 
      
 136 
     | 
    
         
            +
                                status=load_element(@parent)[0].has_content?(@content)
         
     | 
| 
      
 137 
     | 
    
         
            +
                            end
         
     | 
| 
      
 138 
     | 
    
         
            +
                        elsif(@refresh && (@content!=nil) && @parent==nil)then
         
     | 
| 
      
 139 
     | 
    
         
            +
                            page.evaluate_script('window.history.go()')
         
     | 
| 
      
 140 
     | 
    
         
            +
                            status=false
         
     | 
| 
      
 141 
     | 
    
         
            +
                            while(!status)
         
     | 
| 
      
 142 
     | 
    
         
            +
                                status=page.has_content?(@content)
         
     | 
| 
      
 143 
     | 
    
         
            +
                            end
         
     | 
| 
      
 144 
     | 
    
         
            +
                        elsif((!@refresh) && (@content!=nil) && @parent!=nil)then
         
     | 
| 
      
 145 
     | 
    
         
            +
                            load_element(@parent)
         
     | 
| 
      
 146 
     | 
    
         
            +
                            status=false
         
     | 
| 
      
 147 
     | 
    
         
            +
                            while(!status)
         
     | 
| 
      
 148 
     | 
    
         
            +
                                status=load_element(@parent)[0].has_content?(@content)
         
     | 
| 
      
 149 
     | 
    
         
            +
                            end
         
     | 
| 
      
 150 
     | 
    
         
            +
                        elsif((!@refresh) && (@content!=nil) && @parent==nil)then
         
     | 
| 
      
 151 
     | 
    
         
            +
                            status=false
         
     | 
| 
      
 152 
     | 
    
         
            +
                            while(!status)
         
     | 
| 
      
 153 
     | 
    
         
            +
                                status=page.has_content?(@content)
         
     | 
| 
      
 154 
     | 
    
         
            +
                            end
         
     | 
| 
      
 155 
     | 
    
         
            +
                        else
         
     | 
| 
      
 156 
     | 
    
         
            +
                            raise 'Error: Invalid options passed to method- should_have_content'
         
     | 
| 
      
 157 
     | 
    
         
            +
                        end 
         
     | 
| 
      
 158 
     | 
    
         
            +
                    end
         
     | 
| 
      
 159 
     | 
    
         
            +
                end
         
     | 
| 
      
 160 
     | 
    
         
            +
                
         
     | 
| 
      
 161 
     | 
    
         
            +
                def should_have_css(content,*options)
         
     | 
| 
      
 162 
     | 
    
         
            +
                    #retrieve options (if any)
         
     | 
| 
      
 163 
     | 
    
         
            +
                    if(options!=[] && ((x=options.pop)!=nil))then
         
     | 
| 
      
 164 
     | 
    
         
            +
                        @options = []
         
     | 
| 
      
 165 
     | 
    
         
            +
                        @options.push(x.dup)
         
     | 
| 
      
 166 
     | 
    
         
            +
                        for o in options do
         
     | 
| 
      
 167 
     | 
    
         
            +
                            @options.push(options[o])
         
     | 
| 
      
 168 
     | 
    
         
            +
                        end
         
     | 
| 
      
 169 
     | 
    
         
            +
                    else
         
     | 
| 
      
 170 
     | 
    
         
            +
                        @options=[]
         
     | 
| 
      
 171 
     | 
    
         
            +
                    end
         
     | 
| 
      
 172 
     | 
    
         
            +
                    
         
     | 
| 
      
 173 
     | 
    
         
            +
                    #if option has known key put val for key in var
         
     | 
| 
      
 174 
     | 
    
         
            +
                    @t=nil
         
     | 
| 
      
 175 
     | 
    
         
            +
                    @r=nil
         
     | 
| 
      
 176 
     | 
    
         
            +
                    @p=nil
         
     | 
| 
      
 177 
     | 
    
         
            +
                    for o in @options do
         
     | 
| 
      
 178 
     | 
    
         
            +
                        val = @options.pop.dup
         
     | 
| 
      
 179 
     | 
    
         
            +
                        if(val.has_key?(:time))then
         
     | 
| 
      
 180 
     | 
    
         
            +
                            @t = val[:time]
         
     | 
| 
      
 181 
     | 
    
         
            +
                        elsif(val.has_key?(:refresh))then
         
     | 
| 
      
 182 
     | 
    
         
            +
                            @r = val[:refresh]
         
     | 
| 
      
 183 
     | 
    
         
            +
                        elsif(val.has_key?(:parent))then
         
     | 
| 
      
 184 
     | 
    
         
            +
                            @p = val[:parent]
         
     | 
| 
      
 185 
     | 
    
         
            +
                        end
         
     | 
| 
      
 186 
     | 
    
         
            +
                    end
         
     | 
| 
      
 187 
     | 
    
         
            +
                    
         
     | 
| 
      
 188 
     | 
    
         
            +
                    #set vars or default if option not provided
         
     | 
| 
      
 189 
     | 
    
         
            +
                    @time=nil
         
     | 
| 
      
 190 
     | 
    
         
            +
                    @time=@t ||=ENV['STIME'].to_i
         
     | 
| 
      
 191 
     | 
    
         
            +
                    @refresh=nil
         
     | 
| 
      
 192 
     | 
    
         
            +
                    @refresh=@r ||=false
         
     | 
| 
      
 193 
     | 
    
         
            +
                    @parent=nil
         
     | 
| 
      
 194 
     | 
    
         
            +
                    @parent=@p ||=nil
         
     | 
| 
      
 195 
     | 
    
         
            +
                    
         
     | 
| 
      
 196 
     | 
    
         
            +
                    @content=content
         
     | 
| 
      
 197 
     | 
    
         
            +
                    Timeout.timeout(@time)do
         
     | 
| 
      
 198 
     | 
    
         
            +
                        urlPopulated= false
         
     | 
| 
      
 199 
     | 
    
         
            +
                        while(!urlPopulated)
         
     | 
| 
      
 200 
     | 
    
         
            +
                        urlPopulated= current_url.length>0
         
     | 
| 
      
 201 
     | 
    
         
            +
                        end
         
     | 
| 
      
 202 
     | 
    
         
            +
                        if(@refresh && (@content!=nil) && @parent!=nil)then
         
     | 
| 
      
 203 
     | 
    
         
            +
                            page.evaluate_script('window.history.go()')
         
     | 
| 
      
 204 
     | 
    
         
            +
                            load_element(@parent)
         
     | 
| 
      
 205 
     | 
    
         
            +
                            status=false
         
     | 
| 
      
 206 
     | 
    
         
            +
                            while(!status)
         
     | 
| 
      
 207 
     | 
    
         
            +
                                status=load_element(@parent+" "+@content)
         
     | 
| 
      
 208 
     | 
    
         
            +
                            end
         
     | 
| 
      
 209 
     | 
    
         
            +
                        elsif(@refresh && (@content!=nil) && @parent==nil)then
         
     | 
| 
      
 210 
     | 
    
         
            +
                            page.evaluate_script('window.history.go()')
         
     | 
| 
      
 211 
     | 
    
         
            +
                            status=false
         
     | 
| 
      
 212 
     | 
    
         
            +
                            while(!status)
         
     | 
| 
      
 213 
     | 
    
         
            +
                                status=load_element(@content)
         
     | 
| 
      
 214 
     | 
    
         
            +
                            end
         
     | 
| 
      
 215 
     | 
    
         
            +
                        elsif((!@refresh) && (@content!=nil) && @parent!=nil)then
         
     | 
| 
      
 216 
     | 
    
         
            +
                            load_element(@parent)
         
     | 
| 
      
 217 
     | 
    
         
            +
                            status=false
         
     | 
| 
      
 218 
     | 
    
         
            +
                            while(!status)
         
     | 
| 
      
 219 
     | 
    
         
            +
                                status=load_element(@parent+" "+@content)
         
     | 
| 
      
 220 
     | 
    
         
            +
                            end
         
     | 
| 
      
 221 
     | 
    
         
            +
                        elsif((!@refresh) && (@content!=nil) && @parent==nil)then
         
     | 
| 
      
 222 
     | 
    
         
            +
                            status=false
         
     | 
| 
      
 223 
     | 
    
         
            +
                            while(!status)
         
     | 
| 
      
 224 
     | 
    
         
            +
                                status=load_element(@content)
         
     | 
| 
      
 225 
     | 
    
         
            +
                            end
         
     | 
| 
      
 226 
     | 
    
         
            +
                        else
         
     | 
| 
      
 227 
     | 
    
         
            +
                            raise 'Error: Invalid options passed to method- should_have_css'
         
     | 
| 
      
 228 
     | 
    
         
            +
                        end 
         
     | 
| 
      
 229 
     | 
    
         
            +
                    end
         
     | 
| 
      
 230 
     | 
    
         
            +
                end
         
     | 
| 
      
 231 
     | 
    
         
            +
             
     | 
| 
      
 232 
     | 
    
         
            +
                def should_open_tab(url,numtabs,*options)
         
     | 
| 
      
 233 
     | 
    
         
            +
                    
         
     | 
| 
      
 234 
     | 
    
         
            +
                    #retrieve options (if any)
         
     | 
| 
      
 235 
     | 
    
         
            +
                if(options!=[] && ((x=options.pop)!=nil))then
         
     | 
| 
      
 236 
     | 
    
         
            +
                    @options = []
         
     | 
| 
      
 237 
     | 
    
         
            +
                    @options.push(x.dup)
         
     | 
| 
      
 238 
     | 
    
         
            +
                    for o in options do
         
     | 
| 
      
 239 
     | 
    
         
            +
                        @options.push(options[o])
         
     | 
| 
      
 240 
     | 
    
         
            +
                    end
         
     | 
| 
      
 241 
     | 
    
         
            +
                else
         
     | 
| 
      
 242 
     | 
    
         
            +
                    @options=[]
         
     | 
| 
      
 243 
     | 
    
         
            +
                end
         
     | 
| 
      
 244 
     | 
    
         
            +
                
         
     | 
| 
      
 245 
     | 
    
         
            +
                #if option has known key put val for key in var
         
     | 
| 
      
 246 
     | 
    
         
            +
                @c=nil
         
     | 
| 
      
 247 
     | 
    
         
            +
                @t=nil
         
     | 
| 
      
 248 
     | 
    
         
            +
                for o in @options do
         
     | 
| 
      
 249 
     | 
    
         
            +
                    val = @options.pop.dup
         
     | 
| 
      
 250 
     | 
    
         
            +
                    if(val.has_key?(:close))then
         
     | 
| 
      
 251 
     | 
    
         
            +
                        @c = val[:close]
         
     | 
| 
      
 252 
     | 
    
         
            +
                    elsif(val.has_key?(:time))then
         
     | 
| 
      
 253 
     | 
    
         
            +
                        @t = val[:time]
         
     | 
| 
      
 254 
     | 
    
         
            +
                    end
         
     | 
| 
      
 255 
     | 
    
         
            +
                end
         
     | 
| 
      
 256 
     | 
    
         
            +
                
         
     | 
| 
      
 257 
     | 
    
         
            +
                #set vars or default if option not provided
         
     | 
| 
      
 258 
     | 
    
         
            +
                @close=nil
         
     | 
| 
      
 259 
     | 
    
         
            +
                @close=@c ||=false
         
     | 
| 
      
 260 
     | 
    
         
            +
                @time=nil
         
     | 
| 
      
 261 
     | 
    
         
            +
                @time=@t  ||=ENV['STIME'].to_i
         
     | 
| 
      
 262 
     | 
    
         
            +
                    
         
     | 
| 
      
 263 
     | 
    
         
            +
                    Timeout::timeout(@time) {
         
     | 
| 
      
 264 
     | 
    
         
            +
                        status=false
         
     | 
| 
      
 265 
     | 
    
         
            +
                        while(!status)
         
     | 
| 
      
 266 
     | 
    
         
            +
                            status=page.driver.browser.window_handles.length > numtabs
         
     | 
| 
      
 267 
     | 
    
         
            +
                        end
         
     | 
| 
      
 268 
     | 
    
         
            +
                    }
         
     | 
| 
      
 269 
     | 
    
         
            +
                    
         
     | 
| 
      
 270 
     | 
    
         
            +
                    page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
         
     | 
| 
      
 271 
     | 
    
         
            +
                    Timeout::timeout(@time) {
         
     | 
| 
      
 272 
     | 
    
         
            +
                        status=false
         
     | 
| 
      
 273 
     | 
    
         
            +
                        while(!status)
         
     | 
| 
      
 274 
     | 
    
         
            +
                            status=current_url.length > 1
         
     | 
| 
      
 275 
     | 
    
         
            +
                        end
         
     | 
| 
      
 276 
     | 
    
         
            +
                    }
         
     | 
| 
      
 277 
     | 
    
         
            +
                        
         
     | 
| 
      
 278 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 279 
     | 
    
         
            +
                        load_true(current_url.include?(url))
         
     | 
| 
      
 280 
     | 
    
         
            +
                    rescue
         
     | 
| 
      
 281 
     | 
    
         
            +
                        raise 'Error: Failed to navigate to '+url
         
     | 
| 
      
 282 
     | 
    
         
            +
                    end
         
     | 
| 
      
 283 
     | 
    
         
            +
                    if(@close==true)then
         
     | 
| 
      
 284 
     | 
    
         
            +
                        current_window.close
         
     | 
| 
      
 285 
     | 
    
         
            +
              
         
     | 
| 
      
 286 
     | 
    
         
            +
              
         
     | 
| 
      
 287 
     | 
    
         
            +
                        Timeout::timeout(@time) {
         
     | 
| 
      
 288 
     | 
    
         
            +
                            status=false
         
     | 
| 
      
 289 
     | 
    
         
            +
                            while(!status)
         
     | 
| 
      
 290 
     | 
    
         
            +
                                status=(page.driver.browser.window_handles.length) == numtabs
         
     | 
| 
      
 291 
     | 
    
         
            +
                            end
         
     | 
| 
      
 292 
     | 
    
         
            +
                        }
         
     | 
| 
      
 293 
     | 
    
         
            +
              
         
     | 
| 
      
 294 
     | 
    
         
            +
                        page.driver.browser.switch_to.window(page.driver.browser.window_handles.first)
         
     | 
| 
      
 295 
     | 
    
         
            +
                    end
         
     | 
| 
      
 296 
     | 
    
         
            +
                end    
         
     | 
| 
      
 297 
     | 
    
         
            +
                
         
     | 
| 
      
 298 
     | 
    
         
            +
                def load_true(statement,*options)
         
     | 
| 
      
 299 
     | 
    
         
            +
                    loaded=false
         
     | 
| 
      
 300 
     | 
    
         
            +
                    
         
     | 
| 
      
 301 
     | 
    
         
            +
                    if(options!=[] && ((x=options.pop)!=nil))then
         
     | 
| 
      
 302 
     | 
    
         
            +
                        @options = []
         
     | 
| 
      
 303 
     | 
    
         
            +
                        @options.push(x.dup)
         
     | 
| 
      
 304 
     | 
    
         
            +
                        for o in options do
         
     | 
| 
      
 305 
     | 
    
         
            +
                            @options.push(options[o])
         
     | 
| 
      
 306 
     | 
    
         
            +
                        end
         
     | 
| 
      
 307 
     | 
    
         
            +
                    else
         
     | 
| 
      
 308 
     | 
    
         
            +
                        @options=[]
         
     | 
| 
      
 309 
     | 
    
         
            +
                    end
         
     | 
| 
      
 310 
     | 
    
         
            +
                    for o in @options do
         
     | 
| 
      
 311 
     | 
    
         
            +
                        val = @options.pop.dup
         
     | 
| 
      
 312 
     | 
    
         
            +
                        if(val.has_key?(:time))then
         
     | 
| 
      
 313 
     | 
    
         
            +
                            @t = val[:time]
         
     | 
| 
      
 314 
     | 
    
         
            +
                        elsif(val.has_key?(:refresh))then
         
     | 
| 
      
 315 
     | 
    
         
            +
                            @r = val[:refresh]
         
     | 
| 
      
 316 
     | 
    
         
            +
                        end
         
     | 
| 
      
 317 
     | 
    
         
            +
                    end
         
     | 
| 
      
 318 
     | 
    
         
            +
                    @time=@t ||=ENV['STIME'].to_i
         
     | 
| 
      
 319 
     | 
    
         
            +
                    @refresh=@r ||=false
         
     | 
| 
      
 320 
     | 
    
         
            +
                    Timeout.timeout(@time)do
         
     | 
| 
      
 321 
     | 
    
         
            +
                        while(!statement)
         
     | 
| 
      
 322 
     | 
    
         
            +
                            if(@refresh && !statement)then
         
     | 
| 
      
 323 
     | 
    
         
            +
                                page.evaluate_script('window.history.go()')
         
     | 
| 
      
 324 
     | 
    
         
            +
                                while(!statement)
         
     | 
| 
      
 325 
     | 
    
         
            +
                                end
         
     | 
| 
      
 326 
     | 
    
         
            +
                            end 
         
     | 
| 
      
 327 
     | 
    
         
            +
                        end
         
     | 
| 
      
 328 
     | 
    
         
            +
                        return statement
         
     | 
| 
      
 329 
     | 
    
         
            +
                    end
         
     | 
| 
      
 330 
     | 
    
         
            +
                end
         
     | 
| 
      
 331 
     | 
    
         
            +
                
         
     | 
| 
      
 332 
     | 
    
         
            +
                def wait_for_page_change(prevUrl)
         
     | 
| 
      
 333 
     | 
    
         
            +
                    $url = prevUrl
         
     | 
| 
      
 334 
     | 
    
         
            +
                    Timeout.timeout(ENV['STIME'].to_i)do
         
     | 
| 
      
 335 
     | 
    
         
            +
                        urlChanged=false
         
     | 
| 
      
 336 
     | 
    
         
            +
                        while(!urlChanged)
         
     | 
| 
      
 337 
     | 
    
         
            +
                            begin
         
     | 
| 
      
 338 
     | 
    
         
            +
                                if(current_url != prevUrl)then
         
     | 
| 
      
 339 
     | 
    
         
            +
                                    urlChanged=true
         
     | 
| 
      
 340 
     | 
    
         
            +
                                end
         
     | 
| 
      
 341 
     | 
    
         
            +
                            rescue
         
     | 
| 
      
 342 
     | 
    
         
            +
                                retry
         
     | 
| 
      
 343 
     | 
    
         
            +
                            end
         
     | 
| 
      
 344 
     | 
    
         
            +
                        end
         
     | 
| 
      
 345 
     | 
    
         
            +
                    end
         
     | 
| 
      
 346 
     | 
    
         
            +
                end
         
     | 
| 
      
 347 
     | 
    
         
            +
                
         
     | 
| 
      
 348 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,85 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: capy_time
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.0
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Bradley Maynard
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: exe
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-10-21 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '1.10'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '1.10'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 41 
     | 
    
         
            +
            description: capy_time is a tool that allows you to use Capybara without having to
         
     | 
| 
      
 42 
     | 
    
         
            +
              worry about the timing issues.
         
     | 
| 
      
 43 
     | 
    
         
            +
            email:
         
     | 
| 
      
 44 
     | 
    
         
            +
            - maynard_bradley@yahoo.com
         
     | 
| 
      
 45 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 46 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 47 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 48 
     | 
    
         
            +
            files:
         
     | 
| 
      
 49 
     | 
    
         
            +
            - .gitignore
         
     | 
| 
      
 50 
     | 
    
         
            +
            - .travis.yml
         
     | 
| 
      
 51 
     | 
    
         
            +
            - CODE_OF_CONDUCT.md
         
     | 
| 
      
 52 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 53 
     | 
    
         
            +
            - LICENSE.txt
         
     | 
| 
      
 54 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 55 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 56 
     | 
    
         
            +
            - bin/console
         
     | 
| 
      
 57 
     | 
    
         
            +
            - bin/setup
         
     | 
| 
      
 58 
     | 
    
         
            +
            - capy_time.gemspec
         
     | 
| 
      
 59 
     | 
    
         
            +
            - lib/capy_time.rb
         
     | 
| 
      
 60 
     | 
    
         
            +
            - lib/capy_time/version.rb
         
     | 
| 
      
 61 
     | 
    
         
            +
            homepage: 
         
     | 
| 
      
 62 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 63 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 64 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 65 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 66 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 67 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 68 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 69 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 70 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 71 
     | 
    
         
            +
              - - '>='
         
     | 
| 
      
 72 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 73 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 74 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 75 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 76 
     | 
    
         
            +
              - - '>='
         
     | 
| 
      
 77 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 78 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 79 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 80 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 81 
     | 
    
         
            +
            rubygems_version: 2.4.8
         
     | 
| 
      
 82 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 83 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 84 
     | 
    
         
            +
            summary: Tool for handling timing issues in capybara.
         
     | 
| 
      
 85 
     | 
    
         
            +
            test_files: []
         
     |