Sha256: 9c8b0abaed662e6c61a20fc698123f9bbefdd6723df4c5f2b479abc09d23ed95

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

require 'selenium-webdriver'
require 'rutl/interface/windows/windows_app'

module RUTL
  module Interface
    #
    # The hello world app with an exit button.
    #
    class Hello < WindowsApp
      def file_name
        File.expand_path('../../../../spec/hello.rb', __dir__)
      end

      def initialize
        @app = WindowsTestApp.new(name: "ruby #{file_name}",
                                  title: /hello world/i)
        @app.start
        driver_opts = base_opts
        # Have to start app then attach winappdriver because these both fail:
        # 1. passing hello.rb path as [:caps][:app]
        # 2. passing ruby.exe path as [:caps][:app] and passing hello.rb
        #    path as [:caps][:appArguments]
        driver_opts[:caps][:appTopLevelWindow] = @app.window_handle_string
        @driver = Appium::Driver.new(driver_opts, false)
        @driver.start
        super
      end

      def current_view
        # This only works because I only have one view.
        # Should I? What about dialogs?
        @views.first
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rutl-0.8.0 lib/rutl/interface/windows/hello.rb