Sha256: 559c8def5d2e87905dae6fe03929d7da1194d83d4c87adce88139148709ca297

Contents?: true

Size: 1.49 KB

Versions: 20

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

20 entries across 20 versions & 1 rubygems

Version Path
appium_lib-9.4.5 android_tests/lib/android/specs/common/web_context.rb
appium_lib-9.4.4 android_tests/lib/android/specs/common/web_context.rb
appium_lib-9.4.3 android_tests/lib/android/specs/common/web_context.rb
appium_lib-9.4.2 android_tests/lib/android/specs/common/web_context.rb
appium_lib-9.4.1 android_tests/lib/android/specs/common/web_context.rb
appium_lib-9.4.0 android_tests/lib/android/specs/common/web_context.rb
appium_lib-9.3.8 android_tests/lib/android/specs/common/web_context.rb
appium_lib-9.3.7 android_tests/lib/android/specs/common/web_context.rb
appium_lib-9.3.6 android_tests/lib/android/specs/common/web_context.rb
appium_lib-9.3.5 android_tests/lib/android/specs/common/web_context.rb
appium_lib-9.3.4 android_tests/lib/android/specs/common/web_context.rb
appium_lib-9.3.3 android_tests/lib/android/specs/common/web_context.rb
appium_lib-9.3.2 android_tests/lib/android/specs/common/web_context.rb
appium_lib-9.3.1 android_tests/lib/android/specs/common/web_context.rb
appium_lib-9.3.0 android_tests/lib/android/specs/common/web_context.rb
appium_lib-9.2.0 android_tests/lib/android/specs/common/web_context.rb
appium_lib-9.1.3 android_tests/lib/android/specs/common/web_context.rb
appium_lib-9.1.2 android_tests/lib/android/specs/common/web_context.rb
appium_lib-9.1.1 android_tests/lib/android/specs/common/web_context.rb
appium_lib-9.1.0 android_tests/lib/android/specs/common/web_context.rb