Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions .github/workflows/functional-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,20 @@ concurrency:

jobs:
ios_test:
name: ios_test (global_driver=${{ matrix.global_driver }})
strategy:
fail-fast: false
matrix:
global_driver: ['true', 'false']
runs-on: macos-15
timeout-minutes: 90
env:
XCODE_VERSION: 16.4
IOS_VERSION: 18.5
IOS_DEVICE_NAME: iPhone 16 Plus
APPIUM_TEST_GLOBAL_DRIVER: ${{ matrix.global_driver }}
XCODE_VERSION: 16.4
IOS_VERSION: 18.5
IOS_DEVICE_NAME: iPhone 16 Plus
# Allow WDA startup (up to 600s) and session creation to finish.
APPIUM_TEST_READ_TIMEOUT: 900

steps:
- uses: actions/checkout@v7
Expand All @@ -44,8 +52,6 @@ jobs:
- name: Preparing other environment
run: |
brew install ffmpeg
brew tap wix/brew
brew install applesimutils

# Start Appium
- name: Install appium and mjpeg-consumer
Expand Down Expand Up @@ -79,15 +85,21 @@ jobs:
if: ${{ always() }}
uses: actions/upload-artifact@master
with:
name: appium-ios_test_with_other_deps.log
name: appium-ios_test_with_other_deps-global-${{ matrix.global_driver }}.log
path: |
appium.log
test/report/

android_test:
name: android_test (global_driver=${{ matrix.global_driver }})
strategy:
fail-fast: false
matrix:
global_driver: ['true', 'false']
runs-on: ubuntu-latest
timeout-minutes: 90
env:
APPIUM_TEST_GLOBAL_DRIVER: ${{ matrix.global_driver }}
API_LEVEL: 35
ARCH: x86_64

Expand Down Expand Up @@ -164,7 +176,7 @@ jobs:
if: ${{ always() }}
uses: actions/upload-artifact@master
with:
name: appium-android_test_with_other_deps.log
name: appium-android_test_with_other_deps-global-${{ matrix.global_driver }}.log
path: |
appium.log
test/report/
17 changes: 17 additions & 0 deletions android_tests/lib/android/navigation.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

# Helpers for functional tests that need a fresh native ApiDemos screen.
module AndroidTestNavigation
def start_test_activity(component)
AppiumTestSession.driver.execute_script 'mobile: startActivity',
component: component,
action: 'android.intent.action.MAIN',
flags: '0x10200000',
wait: true,
stop: true
end

def reset_test_app
start_test_activity('io.appium.android.apis/.ApiDemos')
end
end
22 changes: 15 additions & 7 deletions android_tests/lib/android/specs/android/element/alert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,27 @@
class AndroidTest
class Element
class Alert < Minitest::Test
include AndroidTestNavigation

def setup
super
reset_test_app
wait { find('app').click }
wait { find('alert').click }
end

def teardown
reset_test_app
ensure
super
end

def open_alert
# trigger the alert
wait { button('OK Cancel dialog with a message').click }
end

def test_01_alert_click
# nav to alert activity
wait { find('app').click }
wait { find('alert').click }

# test
wait { open_alert }
wait { alert_click('OK') }
Expand Down Expand Up @@ -57,9 +68,6 @@ def test_05_alert_dismiss_text

wait { assert_equal alert_dismiss_text.downcase, 'cancel' }
wait { alert_dismiss }

# nav to start activity
2.times { back }
end
end
end
Expand Down
22 changes: 9 additions & 13 deletions android_tests/lib/android/specs/android/element/button.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@
class AndroidTest
class Element
class Button < Minitest::Test
def before_first
# nav to buttons activity
include AndroidTestNavigation

def setup
super
reset_test_app
wait { find('App').click }
wait { find('Activity').click }
wait { find('Animation').click }
end

def after_last
# nav back to home activity
3.times { back }
def teardown
reset_test_app
ensure
super
end

def fade_in
'Fade in'
end

def test_01_before_first
before_first
end

def test_02_button
# by index
2.times { wait { assert_equal button(1).text.upcase, fade_in.upcase } }
Expand Down Expand Up @@ -65,10 +65,6 @@ def test_06_button_exact
def test_07_buttons_exact
2.times { wait { assert_equal buttons_exact(fade_in).first.text.upcase, fade_in.upcase } }
end

def test_08_after_last
after_last
end
end
end
end
13 changes: 13 additions & 0 deletions android_tests/lib/android/specs/android/element/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@
class AndroidTest
class Element
class Text < Minitest::Test
include AndroidTestNavigation

def setup
super
reset_test_app
end

def teardown
reset_test_app
ensure
super
end

def must_raise_no_element
assert_raises Selenium::WebDriver::Error::NoSuchElementError do
yield
Expand Down
13 changes: 13 additions & 0 deletions android_tests/lib/android/specs/android/patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@
# rake "android[android/patch]"
class AndroidTest
class Patch < Minitest::Test
include AndroidTestNavigation

def setup
super
reset_test_app
end

def teardown
reset_test_app
ensure
super
end

def test_type
# nav to textfield
wait { find('app').click }
Expand Down
43 changes: 25 additions & 18 deletions android_tests/lib/android/specs/common/device.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,43 @@
class AndroidTest
class Common
class Device < Minitest::Test
include AndroidTestNavigation

def setup
super
reset_test_app
end

def teardown
reset_test_app
ensure
super
end

def test_01_get_performance_data_types
expected = %w(batteryinfo cpuinfo memoryinfo networkinfo)
assert_equal get_performance_data_types.sort, expected
assert_equal expected, get_performance_data_types.sort
end

assert_equal get_performance_data(
package_name: 'io.appium.android.apis', data_type: 'cpuinfo'
)[0], %w(user kernel)
def test_01_get_performance_data
# CPU samples may omit a newly started/idle app. Battery data exercises
# the same client endpoint without depending on a process sampling window.
data = get_performance_data(package_name: 'io.appium.android.apis', data_type: 'batteryinfo')
assert_equal ['power'], data.fetch(0)
assert_equal 1, data.fetch(1).length
assert_includes 0..100, Integer(data.fetch(1).fetch(0))
end

def test_02_start_activity
wait { assert_equal current_activity, '.ApiDemos' }
start_activity(
app_package: 'io.appium.android.apis',
app_activity: '.accessibility.AccessibilityNodeProviderActivity'
)
start_test_activity('io.appium.android.apis/.accessibility.AccessibilityNodeProviderActivity')
wait { assert_equal current_activity.include?('Node'), true }
start_activity(
app_package: 'com.android.settings',
app_activity: '.Settings',
app_wait_package: 'com.android.settings',
app_wait_activity: '.Settings'
)
start_test_activity('com.android.settings/.Settings')
wait { assert_equal current_activity.include?('Settings'), true }
end

def test_03_current_package
start_activity(
app_package: 'io.appium.android.apis',
app_activity: '.accessibility.AccessibilityNodeProviderActivity'
)
start_test_activity('io.appium.android.apis/.accessibility.AccessibilityNodeProviderActivity')
wait { assert_equal current_package, 'io.appium.android.apis' }
end

Expand Down
15 changes: 14 additions & 1 deletion android_tests/lib/android/specs/common/device_touchaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@
class AndroidTest
class Common
class DeviceTouchAction < Minitest::Test
include AndroidTestNavigation

def setup
super
reset_test_app
end

def teardown
reset_test_app
ensure
super
end

def test_01_before_test
wait { text('Accessibility') }
end
Expand Down Expand Up @@ -78,7 +91,7 @@ def test_05_pinch_zoom
origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT
)
f2.create_pointer_down(:left)
f1.create_pause(0.5)
f2.create_pause(0.5)
f2.create_pointer_move(
duration: 3, x: 500, y: 900,
origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT
Expand Down
5 changes: 3 additions & 2 deletions android_tests/lib/android/specs/common/patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_01_element_method_name

def test_02_element_method_location_rel
wait do
loc = first_text.location_rel($driver)
loc = first_text.location_rel(AppiumTestSession.driver)
assert_equal loc.x.class, String
assert_equal loc.y.class, String
end
Expand All @@ -45,13 +45,14 @@ def test_02_element_method_location_rel
# By default, the webdriver gem will return message instead of origValue
def test_03_common_patch_id_error_message
value = ''
previous_wait = driver.manage.timeouts.implicit_wait
begin
set_wait 0
find_element(:id, 'ok')
rescue StandardError => e
value = e.message
ensure
set_wait 30
set_wait previous_wait
end
exp = 'An element could not be located on the page using the given search parameters.'
assert value.start_with? exp
Expand Down
6 changes: 3 additions & 3 deletions android_tests/lib/android/specs/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_05_attributes_verify_all_attributes
assert_equal caps_with_json['appPackage'], 'io.appium.android.apis'
assert_equal caps_with_json['appActivity'], 'io.appium.android.apis.ApiDemos'
assert_equal caps_with_json['deviceName'], 'Android emulator'
assert_equal caps_with_json['someCapability'], 'some_capability'
assert_equal 'some_capability', caps_with_json['some_capability']

assert_equal actual[:caps][:platformName], 'android'
assert_equal actual[:caps][:app], expected_app
Expand All @@ -92,11 +92,11 @@ def test_05_attributes_verify_all_attributes
end

def test_06_driver_class
assert_equal $driver.class, Appium::Driver
assert_equal AppiumTestSession.driver.class, Appium::Driver
end

def absolute_app_path(path)
$driver.class.absolute_app_path(caps: { app: path })
AppiumTestSession.driver.class.absolute_app_path(caps: { app: path })
end

def validate_path(path)
Expand Down
14 changes: 9 additions & 5 deletions android_tests/lib/android/specs/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@
# rake "android[install]"
class AndroidTest
class Install < Minitest::Test
# To Do: Blocked on https://github.com/appium/appium/issues/3032
include AndroidTestNavigation

def teardown
install_app caps[:app] unless app_installed?(pkg)
reset_test_app
ensure
super
end

def pkg
'io.appium.android.apis'
end
Expand All @@ -35,9 +43,5 @@ def test_install_uninstall
install_app caps[:app]
installed
end

# no way to launch apk after it's uninstalled/installed
# blocked on: https://github.com/appium/appium/issues/2969
# launch_app
end
end
Loading
Loading