Sha256: b7f60b36d6c85f4c7270ca3e017b15ee2fb2b6e661d8b8511c5d9675ee2c1454

Contents?: true

Size: 1.49 KB

Versions: 8

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
      fail "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

8 entries across 8 versions & 1 rubygems

Version Path
appium_lib-9.0.0 android_tests/lib/android/specs/common/web_context.rb
appium_lib-8.2.1 android_tests/lib/android/specs/common/web_context.rb
appium_lib-8.2.0 android_tests/lib/android/specs/common/web_context.rb
appium_lib-8.1.0 android_tests/lib/android/specs/common/web_context.rb
appium_lib-8.0.2 android_tests/lib/android/specs/common/web_context.rb
appium_lib-8.0.1 android_tests/lib/android/specs/common/web_context.rb
appium_lib-8.0.0 android_tests/lib/android/specs/common/web_context.rb
appium_lib-7.0.0 android_tests/lib/android/specs/common/web_context.rb