Sha256: 84079b7fbacee753557827edb0a4ec1ea6a964c9396b3a2e8b3a5468fa0760a6

Contents?: true

Size: 1.49 KB

Versions: 5

Compression:

Stored size: 1.49 KB

Contents

# Tests specifically for areas where the web_context differs in behaviour
# rake android[common/web_context]
describe 'the web context' do

  # appium's context support is broken on android

  t 'available_contexts' do
    wait_true { available_contexts.include? 'NATIVE_APP' }
  end

  t 'current_context' do
    wait { current_context.must_equal 'NATIVE_APP' }
  end

  t 'set_context' do
    wait { scroll_to('Views').click }
    wait { scroll_to('WebView').click }

    def undo_setcontext_nav
      back
      wait { find('WebView') }
      back
      wait { find 'Views' }
    end

    contexts        = available_contexts
    webview_context = contexts.detect { |e| e.start_with?('WEBVIEW') }

    if webview_context.nil?
      undo_setcontext_nav
      raise "No webview context found. contexts are: #{contexts}"
    end

    wait { set_context webview_context }
    wait { current_context.must_equal webview_context }

    # verify inspect within webview works
    get_android_inspect.split("\n").length.must_be :>=, 3

    wait { set_context 'NATIVE_APP' }
    wait { current_context.must_equal 'NATIVE_APP' }

    undo_setcontext_nav
  end

  t 'within_context' do
    $driver.within_context 'NATIVE_APP' do
      wait { current_context.must_equal 'NATIVE_APP' }
    end
  end

  t 'switch_to_default_context' do
    wait do
      switch_to_default_context
      current_context.must_equal 'NATIVE_APP'
    end

    wait { set_context 'NATIVE_APP' }
    wait { current_context.must_equal 'NATIVE_APP' }
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
appium_lib-6.0.0 android_tests/lib/android/specs/common/web_context.rb
appium_lib-5.0.1 android_tests/lib/android/specs/common/web_context.rb
appium_lib-5.0.0 android_tests/lib/android/specs/common/web_context.rb
appium_lib-4.1.0 android_tests/lib/android/specs/common/web_context.rb
appium_lib-4.0.0 android_tests/lib/android/specs/common/web_context.rb