Skip to content

Commit

Permalink
don't create debug builds
Browse files Browse the repository at this point in the history
  • Loading branch information
nemanjar7 committed Dec 19, 2024
1 parent 52bc511 commit 02de768
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,30 @@ def self.run(params)
end

UI.message("Emualtor_device: #{params[:emulator_device]}")
adb = "#{params[:sdk_dir]}/platform-tools/adb"

setup_emulator(params)
sleep(5)
demo_mode(params)
build_and_install_android_app(params)
install_android_app(params)

UI.message("Running Maestro tests on Android...")
sh("maestro test #{params[:maestro_flow_file]}")
UI.success("Finished Maestro tests on Android.")
devices = `adb devices`.split("\n").drop(1)
if devices.empty?
UI.message("No running emulators found.")
else
sleep(2)
UI.message("Devices: #{devices}")
devices.each do |device|
serial = device.split("\t").first # Extract the serial number
if serial.include?("emulator") # Check if it's an emulator
sh("maestro --device #{serial} test #{params[:maestro_flow_file]}")
UI.success("Finished Maestro tests on Android.")
end
end
end

UI.message("Exit demo mode and kill Android emulator...")
adb = "#{params[:sdk_dir]}/platform-tools/adb"
system("#{adb} shell am broadcast -a com.android.systemui.demo -e command exit")
sleep(3)
system("#{adb} emu kill")
Expand Down Expand Up @@ -83,11 +95,10 @@ def self.demo_mode(params)
sh("#{params[:sdk_dir]}/platform-tools/adb shell am broadcast -a com.android.systemui.demo -e command network -e mobile show -e datatype none -e level 4")
end

def self.build_and_install_android_app(params)
UI.message("Building Android app...")
other_action.gradle(task: "assembleDebug")
def self.install_android_app(params)
UI.message("Installing Android app...")

apk_path = Dir["app/build/outputs/apk/debug/app-debug.apk"].first
apk_path = Dir["app/build/outputs/apk/release/app-release.apk"].first

if apk_path.nil?
UI.user_error!("Error: APK file not found in build outputs.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ def self.run(params)
end

boot_ios_simulator(params)
build_and_install_ios_app(params)
install_ios_app(params)

UI.message("Running Maestro tests on iOS...")
`maestro test #{params[:maestro_flow_file]}`

simulators_list = `xcrun simctl list devices`.strip
device_status = simulators_list.match(/#{Regexp.quote(params[:simulator_name])}.*\(([^)]+)\) \(([^)]+)\)/)
device_id = device_status[1]
`maestro --device #{device_id} test #{params[:maestro_flow_file]}`
UI.success("Finished Maestro tests on iOS.")

UI.message("Killing iOS simulator...")
Expand Down Expand Up @@ -64,25 +68,9 @@ def self.boot_ios_simulator(params)
end
end

def self.build_and_install_ios_app(params)
UI.message("Building iOS app with scheme: #{params[:scheme]}")
other_action.gym(
workspace: params[:workspace],
scheme: params[:scheme],
destination: "platform=iOS Simulator,name=#{params[:simulator_name]}",
configuration: "Debug",
clean: true,
sdk: "iphonesimulator",
build_path: "./build",
skip_archive: true,
skip_package_ipa: true,
include_symbols: false,
include_bitcode: false,
xcargs: "-UseModernBuildSystem=YES"
)

def self.install_ios_app(params)
derived_data_path = File.expand_path("~/Library/Developer/Xcode/DerivedData")
app_path = Dir["#{derived_data_path}/**/#{params[:scheme]}.app"].first
app_path = Dir["#{derived_data_path}/**/Release-iphonesimulator/#{params[:scheme]}.app"].first

if app_path.nil?
UI.user_error!("Error: .app file not found in DerivedData.")
Expand Down

0 comments on commit 02de768

Please sign in to comment.