<commit_before>describe "ProMotion::Screen functional" do
  tests PM::Screen

  # Override controller to properly instantiate
  def controller
    rotate_device to: :portrait, button: :bottom
    @controller ||= FunctionalScreen.new(nav_bar: true)
    @controller.navigation_controller
  end

  after do
    @controller = nil
  end

  it "should have a navigation bar" do
    view("Functional").should.be.kind_of UINavigationItemView
  end

  it "should allow setting a left nav bar button" do
    @controller.set_nav_bar_button :left, title: "Cool", action: :triggered_button
    tap("Cool")
    @controller.button_was_triggered.should.be.true
  end

  it "should allow setting a right nav bar button" do
    @controller.set_nav_bar_button :right, title: "Cool2", action: :triggered_button
    tap("Cool2")
    @controller.button_was_triggered.should.be.true
  end

  it "should allow opening another screen in the same nav bar and have a back button that is operational" do
    @controller.open BasicScreen

    wait 0.5 do

      view("Basic").should.be.kind_of UINavigationItemView
      view("Functional").should.be.kind_of UINavigationItemButtonView

      tap("Functional")
      wait 0.5 do
        view("Functional").should.be.kind_of UINavigationItemView
      end

    end
  end

  it "should allow opening and closing a modal screen" do
    @basic = BasicScreen.new(nav_bar: true)
    wait 0.1 do
      @controller.open_modal @basic

      wait 0.6 do

        view("Basic").should.be.kind_of UINavigationItemView
        @basic.close

        wait 0.6 do
          @basic = nil
          view("Functional").should.be.kind_of UINavigationItemView
        end

      end
    end
  end

  it "should pop to the root view controller" do
    root_vc = @controller.navigation_controller.visibleViewController
    @controller.navigation_controller.viewControllers.count.should == 1
    @controller.open BasicScreen.new
    wait 0.6 do
      @controller.open BasicScreen.new
      wait 0.6 do
        @controller.open BasicScreen.new
        wait 0.6 do
          @controller.navigation_controller.viewControllers.count.should == 4
          @controller.pop_to_root true
          wait 0.6 do
            @controller.navigation_controller.viewControllers.count.should == 1
            @controller.navigation_controller.topViewController.should == root_vc
          end
        end
      end
    end
  end

end
<commit_msg>Scope test better so it actually passes.<commit_after>describe "ProMotion::Screen functional" do
  tests PM::Screen

  # Override controller to properly instantiate
  def controller
    rotate_device to: :portrait, button: :bottom
    @controller ||= FunctionalScreen.new(nav_bar: true)
    @controller.navigation_controller
  end

  after do
    @controller = nil
  end

  it "should have a navigation bar" do
    view("Functional").should.be.kind_of UINavigationItemView
  end

  it "should allow setting a left nav bar button" do
    @controller.set_nav_bar_button :left, title: "Cool", action: :triggered_button
    tap("Cool")
    @controller.button_was_triggered.should.be.true
  end

  it "should allow setting a right nav bar button" do
    @controller.set_nav_bar_button :right, title: "Cool2", action: :triggered_button
    tap("Cool2")
    @controller.button_was_triggered.should.be.true
  end

  it "should allow opening another screen in the same nav bar and have a back button that is operational" do
    @controller.open BasicScreen

    wait 0.5 do

      view("Basic").should.be.kind_of UINavigationItemView
      view("Functional").should.be.kind_of UINavigationItemButtonView

      tap("Functional")
      wait 0.5 do
        view("Functional").should.be.kind_of UINavigationItemView
      end

    end
  end

  it "should allow opening and closing a modal screen" do
    @basic = BasicScreen.new(nav_bar: true)
    wait 0.1 do
      @controller.open_modal @basic

      wait 0.6 do

        view("Basic").should.be.kind_of UINavigationItemView
        @basic.close

        wait 0.6 do
          @basic = nil
          view("Functional").should.be.kind_of UINavigationItemView
        end

      end
    end
  end

  it "should pop to the root view controller" do
    @root_vc = @controller.navigation_controller.visibleViewController
    @controller.navigation_controller.viewControllers.count.should == 1
    @controller.open BasicScreen.new
    wait 0.6 do
      @controller.open BasicScreen.new
      wait 0.6 do
        @controller.open BasicScreen.new
        wait 0.6 do
          @controller.navigation_controller.viewControllers.count.should == 4
          @controller.pop_to_root true
          wait 0.6 do
            @controller.navigation_controller.viewControllers.count.should == 1
            @controller.navigation_controller.topViewController.should == @root_vc
          end
        end
      end
    end
  end

end

{'fraction_non_alphanumeric': 0.07802580380913372, 'fraction_numerical': 0.009420438255171002, 'mean_word_length': 2.876190476190476, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1540163', 'n_tokens_mistral': 1479, 'n_tokens_neox': 1406, 'n_words': 394}