Skip to content

Instantly share code, notes, and snippets.

Avatar

Adam Heimendinger wf-adamhei

View GitHub Profile
View one_click_blog_full_script.sh
# Find credentials in keychain
# ...
# Create test account credentials ($USER + $PASS)
# ...
# Boot target simulator if not already booted
# ...
xcrun simctl get_app_container $TARGET_DEVICE_IDENTIFIER com.Wealthfront.CredentialHelper 2> /dev/null
if [[ $? -e 0 ]]; then
View one_click_blog_appdelegate.swift
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
private let WFAccessGroupKey: String = "WFAccessGroup"
private let WFCredentialHelperServiceKey: String = "WFCredentialHelperServiceName"
private let AccessPropertiesPlistName: String = "KeychainAccessGroupBridge-Dev"
private let TestAccountUsernameKey = "TestAccountUsernameKey"
private let TestAccountPasswordKey = "TestAccountUsernameKey"
View one_click_blog_first_script.sh
USERNAME=`id -un`
PASSWORD=`security find-generic-password -ws $WF_CI_KEYCHAIN_ITEM_NAME`
# Map USER + PASSWORD to test account credentials
# ...
View ui_tests_blog_jenkinsfile_v2.groovy
partitioned_test_cases = []
pipeline {
agent { label ‘iOS’ }
environment {
TARGET_PARALLEL_AGENTS = 3
}
stages {
View ui_tests_blog_jenkinsfile_v1.groovy
partitioned_test_cases = []
pipeline {
environment {
TARGET_PARALLEL_AGENTS = 3
}
stages {
stage(“Partition UI tests”) {
steps {
View ui_tests_blog_partition.groovy
def partitionTestClassNames(classNames, buckets) {
def subArrays = []
def bucketSize = classNames.size() / buckets
for (int i = 0; i < buckets; i++) {
def start = i * bucketSize
def end = i == buckets - 1 ? classNames.size() : start + bucketSize
subArrays += [classNames[start..<end]]
}
return subArrays
}
View ui_tests_blog_all_tests.groovy
def getAllUITestClassNames() {
def allSwiftFiles = sh(
script: “find WealthfrontUITests -name ‘*.swift’”,
returnStdout: true
).trim().split(‘\n’) as String[]
def directory = pwd()
def allClassNames = []
allSwiftFiles.each {
def file = readFile “${directory}/${it}”
def matcher = (file =~ /(?<=class ).*?(?=:)/)
View ui_tests_blog_fastfile.rb
desc “Run UI Tests on iPhone 11 Pro”
lane :ui_tests
tests_to_run = options[:only_testing]
clear_derived_data(derived_data_path: derived_data_path)
sh(“xcrun simctl shutdown booted”)
sh(“xcrun simctl erase all”)
sh(“xcrun instruments -w ‘iPhone 11 Pro (13.3) [ -t Blank”)
scan(workspace: “Wealthfront.xcworkspace”,
scheme: “WealthfrontUITests”,
output_style: “basic”,