Skip to content

Instantly share code, notes, and snippets.

View testableapple's full-sized avatar

Alexey Alter-Pesotskiy testableapple

View GitHub Profile
fastlane_require 'nokogiri'
@scheme = <YOUR TEST SCHEME NAME>
@test_retries = 2
lane :test do
scan(
scheme: @scheme,
device: 'iPhone X',
output_types: 'junit',
lane :my_first_test_lane do
scan(
scheme: <YOUR TEST SCHEME NAME>,
device: 'iPhone X'
)
end
func test_NeverFailure() {
XCTAssert(true)
}
func test_NeverSuccess() {
XCTAssert(false)
}
+--------------------+---+
| Test Results |
+--------------------+---+
| Number of tests | 1 |
| Number of failures | 1 |
+--------------------+---+
+------+--------+-------------+
| fastlane summary |
+------+--------+-------------+
@max_battery_level = 42
@charging_file = '/sys/class/power_supply/battery/charging_enabled'.freeze
def devices
`adb devices`.scan(/\n(.*)\t/).flatten
end
def unplug(udid:)
charging = (`adb -s #{udid} shell "su -c 'cat #{@charging_file}'"`.to_i == 1)
puts "🔋 Charging enabled: #{charging}"
func isOpen(app: XCUIApplication) -> Bool {
return (app.windows.count > 0)
}
enum Alert: String {
case left, right, ok
}
func alert(button: Alert) {
let buttonIndex = (.right == button) ? 2 : 1
let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
let alertBtn = springboard.buttons.element(boundBy: buttonIndex)
if alertBtn.exists { alertBtn.tap() }
}
let app = XCUIApplication(bundleIdentifier: "com.my.app")
override func setUp() {
super.setUp()
app.launch()
}
Name Value
FB_REFERENCE_IMAGE_DIR $(SOURCE_ROOT)/$(PROJECT_NAME)Tests/Snapshots/ReferenceImages
IMAGE_DIFF_DIR $(SOURCE_ROOT)/$(PROJECT_NAME)Tests/Snapshots/FailureDiffs
target "Tests" do
use_frameworks!
pod 'iOSSnapshotTestCase'
end