<commit_before>module PageModels
  class BlinkboxbooksPage < SitePrism::Page
    include RSpec::Matchers

    def navigation_timeout
      Capybara.default_wait_time
    end

    section :footer, Footer, "div#footer"
    section :header, Header, "header#outer-header"
    section :search_form, SearchForm, "div#searchbox-input"

    def wait_until_displayed(timeout = navigation_timeout)
      r0 = Time.now
      Timeout.timeout timeout, PageModelHelpers::TimeOutWaitingForPageToAppear do
        SitePrism::Waiter.wait_until_true(timeout) { displayed? }
      end
      ensure
        puts "Load time of #{self.class.name.demodulize}: #{Time.now - r0} sec"
    end

    def wait_until_not_displayed(timeout = navigation_timeout)
      r0 = Time.now
      Timeout.timeout timeout, PageModelHelpers::TimeOutWaitingForPageToAppear do
        SitePrism::Waiter.wait_until_true(timeout) { not displayed? }
      end
      ensure
        puts "Processing time of #{self.class.name.demodulize}: #{Time.now - r0} sec"
    end<commit_msg>Raising TimeOutWaitingForPageToAppear safely<commit_after>module PageModels
  class BlinkboxbooksPage < SitePrism::Page
    include RSpec::Matchers

    def navigation_timeout
      Capybara.default_wait_time
    end

    section :footer, Footer, "div#footer"
    section :header, Header, "header#outer-header"
    section :search_form, SearchForm, "div#searchbox-input"

    def wait_until_displayed(timeout = navigation_timeout)
      r0 = Time.now
      begin
        SitePrism::Waiter.wait_until_true(timeout) { displayed? }
      rescue SitePrism::TimeoutException => e
        raise PageModelHelpers::TimeOutWaitingForPageToAppear.new, 'Timed out waiting for page to be displayed'
      end
      ensure
        puts "Load time of #{self.class.name.demodulize}: #{Time.now - r0} sec"
    end

    def wait_until_not_displayed(timeout = navigation_timeout)
      r0 = Time.now
      begin
        SitePrism::Waiter.wait_until_true(timeout) { not displayed? }
      rescue SitePrism::TimeoutException => e
        raise PageModelHelpers::TimeOutWaitingForPageToAppear.new, 'Timed out waiting for page not to be displayed'
      end
      ensure
        puts "Processing time of #{self.class.name.demodulize}: #{Time.now - r0} sec"
    end
{'fraction_non_alphanumeric': 0.08534975802903652, 'fraction_numerical': 0.0035195776506819184, 'mean_word_length': 3.44140625, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5213845', 'n_tokens_mistral': 694, 'n_tokens_neox': 692, 'n_words': 158}