EarlGrey - bootstraponline/meta GitHub Wiki
React Native
- Create shared scheme for
React - Add
Reactto Target Dependencies of test target build phases
Custom EarlGrey framework
- Change custom framework's
DYLIB_INSTALL_NAME_BASEfrom@rpathto@executable_pathCustomFrameworktarget →Build Settings→Dynamic Library Install Name Base
- Add custom framework to
CopyFilesBuildPhasein the app test targetEarlGrey.frameworkmust also be in this Copy Files phase
- Update
DYLD_INSERT_LIBRARIESenvironment variable in the test target scheme to@executable_path/EarlGrey.framework/EarlGrey:@executable_path/CustomEarlGrey.framework/CustomEarlGreyProduct→Scheme→Manage Schemes...→Edit...→Test→Arguments→Environment Variables
EarlGrey build config notes
DYLIB_INSTALL_NAME_BASE@rpathnot@executable_pathLD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";not$(PROJECT_DIR)/../Pods/Pods/EarlGrey/EarlGreyIPHONEOS_DEPLOYMENT_TARGETset to 11.2 or below for Firebase Test LabFRAMEWORK_SEARCH_PATHSmust include dir that contains the EarlGrey framework
Hide keyboard
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
Install Ruby
$ brew update
$ brew install rbenv
Load rbenv automatically by appending the following to ~/.bash_profile or ~/.zshrc
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
Now source bash profile or zshrc:
$ source ~/.bash_profile$ source ~/.zshrc
and run the following commands:
$ rbenv install 2.3.3
$ rbenv global 2.3.3
$ echo "gem: --no-document" >> ~/.gemrc
$ gem update --system --no-document
$ gem install --no-document bundler fastlane cocoapods
Now manually run rbenv init
If Ruby 2.3.3 still isn't on your path, try reinstalling ruby:
rbenv install 2.3.3
Optionally symlink /usr/local/bin/ruby to ~/.rbenv/shims/ruby which ensures system Ruby points to rbenv Ruby.
ln -snf ~/.rbenv/shims/ruby /usr/local/bin/ruby
react-native
- Extend
GREYInteractionnotGREYElementInteractionotherwise there may be weird compile errors - Always use
GREYCondition::waitWithTimeout:pollInterval:and notGREYCondition::waitWithTimeoutotherwise the app may freeze due to the main thread getting blocked.- scanning the hierarchy with a
pollIntervalof zero will prevent the main thread from doing other work.
- scanning the hierarchy with a
Loop a Swift test to check for stability
func testStability() {
for _ in 1...1000 {
setUp()
// test code
tearDown()
}
}