Skip to content

ci: add ci #1037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Aug 3, 2024
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
77 changes: 77 additions & 0 deletions .github/workflows/functional-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Functional Tests

on:
# Run by manual at this time
workflow_dispatch:
push:
branches: [ master ]
pull_request:
branches: [ master ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
ios_test:
runs-on: macos-14
env:
XCODE_VERSION: 15.3
IOS_VERSION: 17.4
IOS_DEVICE_NAME: iPhone 15 Plus

steps:
- uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 'lts/*'

- name: Select Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
- run: defaults write com.apple.iphonesimulator PasteboardAutomaticSync -bool false

- uses: futureware-tech/simulator-action@v3
with:
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
model: ${{ env.IOS_DEVICE_NAME }}
os_version: ${{ env.IOS_VERSION }}

- name: Preparing other environment
run: |
brew install ffmpeg
brew tap wix/brew
brew install applesimutils

# Start Appium
- name: Install appium and mjpeg-consumer
run: |
npm install -g appium
npm install -g mjpeg-consumer
- run: |
appium driver install xcuitest
appium plugin install images@2.1.8
appium plugin install execute-driver
nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors --base-path=/wd/hub > appium.log &

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
- run: |
bundle install
rake ios
name: Run tests
working-directory: ios_tests

- name: Save server output
if: ${{ always() }}
uses: actions/upload-artifact@master
with:
name: appium-ios_test_with_other_deps.log
path: |
appium.log
test/report/
4 changes: 0 additions & 4 deletions android_tests/lib/run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ def start_driver(caps)
driver.start_driver
end

# Sanity check
a = OpenStruct.new x: 'ok'
raise 'x issue' unless a.x == 'ok'

dir = File.expand_path(File.join(Dir.pwd, 'lib'))
appium_txt = File.join(Dir.pwd, 'appium.txt')
device = ARGV[0].downcase.strip
Expand Down
6 changes: 4 additions & 2 deletions ios_tests/appium.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[caps]
platformName = "ios"
platformVersion = "17.2"
deviceName ="iPhone 15"
platformVersion = "17.4"
deviceName ="iPhone 15 Plus"
automationName = 'XCUITest'
app = "../test_apps/UICatalog.app.zip"
someCapability = "some_capability"
simulatorStartupTimeout = 600000
wdaLaunchTimeout = 600000

[appium_lib]
wait = 30
Expand Down
4 changes: 4 additions & 0 deletions ios_tests/lib/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ def catalog
'UICatalog'
end

def target_bundle_id
'com.example.apple-samplecode.UICatalog'
end

def ui_ios
UI.new($driver)
end
Expand Down
3 changes: 3 additions & 0 deletions ios_tests/lib/ios/specs/common/command/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class Common
class Command
class Command < Minitest::Test
def test_01_command
driver.terminate_app target_bundle_id
driver.activate_app target_bundle_id

File.delete 'syslog.log' if File.exist? 'syslog.log'

# A number of systemlog is quite small than Android.
Expand Down
2 changes: 2 additions & 0 deletions ios_tests/lib/ios/specs/common/element/window.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class Common
class Element
class Window < Minitest::Test
def before_first
driver.terminate_app target_bundle_id
driver.activate_app target_bundle_id
assert_equal screen, catalog
end

Expand Down
2 changes: 2 additions & 0 deletions ios_tests/lib/ios/specs/common/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def setup
end

def test_01_before_first
driver.terminate_app target_bundle_id
driver.activate_app target_bundle_id
assert_equal screen, catalog
end

Expand Down
2 changes: 2 additions & 0 deletions ios_tests/lib/ios/specs/common/patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class IosTest
class Common
class Patch < Minitest::Test
def test_01_before_first
driver.terminate_app target_bundle_id
driver.activate_app target_bundle_id
assert_equal screen, catalog
end

Expand Down
2 changes: 2 additions & 0 deletions ios_tests/lib/ios/specs/common/web_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class IosTest
class Common
class WebContext < Minitest::Test
def test_01_before_first
driver.terminate_app target_bundle_id
driver.activate_app target_bundle_id
assert_equal screen, catalog
end

Expand Down
2 changes: 2 additions & 0 deletions ios_tests/lib/ios/specs/device/device.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def go_back
end

def test_01_before_first
driver.terminate_app target_bundle_id
driver.activate_app target_bundle_id
assert_equal screen, catalog
end

Expand Down
3 changes: 2 additions & 1 deletion ios_tests/lib/ios/specs/device/image_comparison.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def test_image_comparison
# Equal to `$driver.driver.find_image_occurrence`
# Equal to `driver.find_image_occurrence`
find_result = find_image_occurrence full_image: image1, partial_image: image2
assert_equal({ 'rect' => { 'x' => 0, 'y' => 0, 'width' => 750, 'height' => 1334 } }, find_result)
rect = find_result['rect']
assert_equal({ 'x' => 0, 'y' => 0, 'width' => 750, 'height' => 1334 }, rect)
end
end
end
Expand Down
10 changes: 8 additions & 2 deletions ios_tests/lib/ios/specs/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
class IosTest
class Driver < Minitest::Test
def test_01_before_first
driver.terminate_app target_bundle_id
driver.activate_app target_bundle_id
assert_equal screen, catalog
end

Expand Down Expand Up @@ -95,7 +97,7 @@ def test_09_driver_class
end

def test_10_status
assert_equal appium_server_version['build'].keys.sort, %w(built git-sha version)
assert appium_server_version['build'].keys.member?('version')
end

def test_11_server_version
Expand All @@ -119,7 +121,7 @@ def test_14_driver
end

def test_15_automation_name_is_xcuitest?
assert_equal automation_name_is_xcuitest?, automation_name_is_xcuitest?
assert_equal automation_name_is_xcuitest?, true
end

#
Expand Down Expand Up @@ -189,5 +191,9 @@ def test_24_events
log_event vendor: 'appium', event: 'funEvent'
log_events
end

def test_25_device_is_ios
assert_equal device_is_ios?, true
end
end
end
5 changes: 4 additions & 1 deletion ios_tests/lib/ios/specs/ios/command/multi_app_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ class Command
class MultiAppHandler < Minitest::Test
# Only for Xcode 9+
def test_multip_app_handler
test_app_bundle = 'com.example.apple-samplecode.UICatalog'
driver.terminate_app target_bundle_id
driver.activate_app target_bundle_id

test_app_bundle = target_bundle_id

assert_equal xcuitest_query_app_status(bundle_id: test_app_bundle), :running_in_foreground

Expand Down
3 changes: 3 additions & 0 deletions ios_tests/lib/ios/specs/ios/command/pasteboard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class Ios
class Command
class Pasteboard < Minitest::Test
def test_pasteboard
driver.terminate_app target_bundle_id
driver.activate_app target_bundle_id

# set blank before testing because pasteboard is remaining during launching simulators
set_pasteboard content: 'before'
assert_equal get_pasteboard, 'before'
Expand Down
3 changes: 3 additions & 0 deletions ios_tests/lib/ios/specs/ios/element/alert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ def open_alert
end

def test_01_before
driver.terminate_app target_bundle_id
driver.activate_app target_bundle_id

assert_equal screen, catalog
wait_true do
find_element(:name, 'Alert Views').click
Expand Down
3 changes: 3 additions & 0 deletions ios_tests/lib/ios/specs/ios/element/button.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def after_last
end

def test_01_before_first
driver.terminate_app target_bundle_id
driver.activate_app target_bundle_id

before_first
end

Expand Down
3 changes: 3 additions & 0 deletions ios_tests/lib/ios/specs/ios/element/generic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ def verify(element)
end

def test_01_before_first
driver.terminate_app target_bundle_id
driver.activate_app target_bundle_id

assert_equal screen, catalog
end

Expand Down
3 changes: 3 additions & 0 deletions ios_tests/lib/ios/specs/ios/element/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ def uiview_steppers
end

def test_01_before_first
driver.terminate_app target_bundle_id
driver.activate_app target_bundle_id

assert_equal screen, catalog
end

Expand Down
3 changes: 3 additions & 0 deletions ios_tests/lib/ios/specs/ios/element/textfield.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ def enter_password
end

def test_01_before_first
driver.terminate_app target_bundle_id
driver.activate_app target_bundle_id
assert_equal screen, catalog
go_to_textfields
end

Expand Down
3 changes: 3 additions & 0 deletions ios_tests/lib/ios/specs/ios/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class IosTest
class Ios
class Helper < Minitest::Test
def test_01_before_first
driver.terminate_app target_bundle_id
driver.activate_app target_bundle_id

assert_equal screen, catalog
end

Expand Down
2 changes: 2 additions & 0 deletions ios_tests/lib/ios/specs/ios/mobile_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class IosTest
class Ios
class MobileMethods < Minitest::Test
def test_01_before_first
driver.terminate_app target_bundle_id
driver.activate_app target_bundle_id
assert_equal screen, catalog
end

Expand Down
4 changes: 3 additions & 1 deletion ios_tests/lib/ios/specs/ios/patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
# rake "ios[ios/patch]"
class IosTest
class Ios
class MobileMethods < Minitest::Test
class Patch < Minitest::Test
def test_01_before_first
driver.terminate_app target_bundle_id
driver.activate_app target_bundle_id
assert_equal screen, catalog
go_to_textfields
end
Expand Down
2 changes: 2 additions & 0 deletions ios_tests/lib/ios/specs/ios/xcuitest_gestures.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def open_alert_custom
end

def test_01_before_first
driver.terminate_app target_bundle_id
driver.activate_app target_bundle_id
assert_equal screen, catalog
end

Expand Down
Loading
Loading