Coder Social home page Coder Social logo

calabash / calabash-ios-server Goto Github PK

View Code? Open in Web Editor NEW
86.0 24.0 81.0 241.27 MB

An embedded HTTP server for performing queries and test automation

License: Other

Objective-C 95.87% C 0.46% Objective-C++ 0.07% Shell 1.80% Ruby 0.99% HTML 0.67% Makefile 0.03% Gherkin 0.11%

calabash-ios-server's Introduction

Status versioning license contributing
Build Status Version License Contributing

The Calabash iOS Server

The companion of the calabash-ios gem: https://github.com/calabash/calabash-ios

Building

Building dylibs now requires a Developer Team.

Requires Xcode 10.3 - 12.x

Requires ruby >= 2.3.*

$ git clone --recursive [email protected]:calabash/calabash-ios-server.git
$ cd calabash-ios-server
$ bundle

To build with an alternative Xcode:

$ DEVELOPER_DIR=/Xcode/10.1/Xcode-beta.app make < rule >

If you have build errors, see the xcpretty section below.

Maintainers must install the calabash/calabash-resign private repo. Details are below.

Non-maintainers will see code signing errors like:

No certificate matching 'Mac Developer: Karl Krukow (YTTN6Y2QS9)' for
team 'FYD86LA7RE': Select a different signing certificate for
CODE_SIGN_IDENTITY, a team that matches your selected certificate, or
switch to automatic provisioning.

when building - you must edit the code signing settings in the Xcode project for the target you are trying to build. Turning on automatic provisioning is usually the easiest solution.

Building the Framework

make framework

if you add this framework to your project, you should also add this lines to other linker flags: -force_load $(PROJECT_DIR)/calabash.framework/calabash

Building the XCFramework

make xcframework

if you add this xcframework to your project, you should also add this lines to other linker flags: if you use an iOS simulator then: -force_load $(PROJECT_DIR)/calabash.xcframework/ios-arm64_x86_64-simulator/libcalabash.a

if you use a physical iOS device then: -force_load $(PROJECT_DIR)/calabash.xcframework/ios-arm64_armv7/libcalabash.a

Building the dylibs

make dylibs

NOTE

If you are a maintainer, you must install the codesign tool if you are planning on making a Calabash iOS gem release.

Building to embed in Calabash gem

See the calabash-ios/calabash-cucumber/Rakefile for more details.

$ cd path/to/calabash-ios/calabash-cucumber
$ bundle update
$ rake build_server

Testing

# Objective-C Unit tests.
$ make xct

# Building libraries.
$ make all

# Integration tests
$ make framework
$ make app-cal
$ bin/test/cucumber.sh

If you are running the XCTests from Xcode, you might see failures in LPJSONUtilsTest. If you do, clean (Shift + Option + Command + K) and rerun.

If you want to test the LPTestTarget on device and are having problems in Xcode or the command line with messages like this:

iPhone Developer: ambiguous matches

then you must either:

  1. $ CODE_SIGN_IDENTITY="< cert name >" make ipa-cal (preferred)
  2. Update the Xcode project with a specific Code Signing entity. DO NOT CHECK THESE CHANGES INTO GIT.

Maintainers should be using the Calabash.keychain (calabash/calabash-codesign).

Contributing

  • The Calabash iOS Toolchain uses git-flow.
  • Contributors should not bump the version.
  • See the CONTRIBUTING.md guide.
  • There is a style guide: STYLE_GUIDE.md.
  • Pull-requests with unit tests will be merged faster.
  • Pull-requests with Cucumber integration tests will be merged even faster.

Releasing

See the CONTRIBUTING.md document for instructions.

xcpretty

https://github.com/supermarin/xcpretty

We use xcpretty to make builds faster and to reduce the amount of logging. Travis CI, for example, has a limit on the number of lines of logging that can be generated; xcodebuild breaks this limit.

The only problem with xcpretty is that it does not report build errors very well. If you encounter an issue with any of the make rules, run without xcpretty:

$ XCPRETTY=0 make ipa

Licenses

Calabash iOS Server uses several third-party sources. You can find the licenses for these sources in the third-party-licenses directory.

calabash-ios-server's People

Contributors

agileseph avatar alex-oreshko avatar alexeybudynkov avatar andreymaslennikov avatar baek-jinoo avatar btaylor-litl avatar falcon027 avatar hydhknn avatar idcuesta avatar igorfedotenkov avatar ilyabausovakvelon avatar isachs avatar ivan-nosar avatar jcovoluntis avatar jescriba avatar jmoody avatar joesss avatar krukow avatar ldiqual avatar lievesley avatar liohau avatar martica avatar michaelkirk avatar olarivain avatar owenniblock avatar pbernery avatar physx23 avatar polyakrecords avatar svevang avatar tommeier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

calabash-ios-server's Issues

Xcode 7 GM: failing WebView test on iOS 9

The have been disabled for iOS 9, but should be investigated.

  • CalWebApp app Scenarios are all green.
LPWebQueryTest
  testArrayByEvaluatingNoVisibleCenterIsZeroZeroButInsideYES, failed: caught "NSInvalidArgumentException", "-[__NSArrayM ancestorSharedWithLayer:]: unrecognized selector sent to instance 0x7f8384c315b0"
  /Users/moody/git/calabash/calabash-ios-server/calabash/Classes/WebViewQuery/LPWebQuery.m:76

    CGPoint center = CGPointMake(webViewPageOffset.x + center_x, webViewPageOffset.y + center_y);
    CGPoint windowCenter = [window convertPoint:center fromView:webView];
    CGPoint keyCenter = [frontWindow convertPoint:windowCenter fromWindow:window];


  testArrayByEvaluatingNoVisibleCenterNotZeroZeroButPointInsideNO, failed: caught "NSInvalidArgumentException", "-[__NSArrayM ancestorSharedWithLayer:]: unrecognized selector sent to instance 0x7f83848d6b20"
  /Users/moody/git/calabash/calabash-ios-server/calabash/Classes/WebViewQuery/LPWebQuery.m:76

    CGPoint center = CGPointMake(webViewPageOffset.x + center_x, webViewPageOffset.y + center_y);
    CGPoint windowCenter = [window convertPoint:center fromView:webView];
    CGPoint keyCenter = [frontWindow convertPoint:windowCenter fromWindow:window];


  testArrayByEvaluatingQueryCss, failed: caught "NSInvalidArgumentException", "-[__NSArrayM ancestorSharedWithLayer:]: unrecognized selector sent to instance 0x7f83848d8900"
  /Users/moody/git/calabash/calabash-ios-server/calabash/Classes/WebViewQuery/LPWebQuery.m:76

    CGPoint center = CGPointMake(webViewPageOffset.x + center_x, webViewPageOffset.y + center_y);
    CGPoint windowCenter = [window convertPoint:center fromView:webView];
    CGPoint keyCenter = [frontWindow convertPoint:windowCenter fromWindow:window];

LPTestTarget: embedded plug-ins are not signed correctly

Motivation

Xcode 7.3 beta and iOS 9.3 beta eval.

Discovered:

Jan 22 11:28:49 pegasi kernel[0] <Notice>: AMFI: LPTestTarget(pid 215) - [deny-mmap] mapped executable file has no team identifier in its signature: /private/var/containers/Bundle/Application/B495CD66-EE95-4643-A4CE-2B4C97BBD3F4/LPTestTarget.app/memoryPluginCalabash.dylib
Jan 22 11:28:49 pegasi amfid[207] <Error>: /private/var/containers/Bundle/Application/B495CD66-EE95-4643-A4CE-2B4C97BBD3F4/LPTestTarget.app/memoryPluginCalabash.dylib not valid: 0xe8008016: The executable was signed with invalid entitlements.
Jan 22 11:28:49 pegasi LPTestTarget[215] <Critical>: ERROR LPPluginLoader:56 | Warning: Could not load Calabash plugin memoryPluginCalabash.dylib.
Jan 22 11:28:49 pegasi LPTestTarget[215] <Critical>: ERROR LPPluginLoader:57 | Warning: dlopen(/var/containers/Bundle/Application/B495CD66-EE95-4643-A4CE-2B4C97BBD3F4/LPTestTarget.app/memoryPluginCalabash.dylib, 4): no suitable image found.  Did find:
        /var/containers/Bundle/Application/B495CD66-EE95-4643-A4CE-2B4C97BBD3F4/LPTestTarget.app/memoryPluginCalabash.dylib: mmap() errno=1 validating first page of '/var/containers/Bundle/Application/B495CD66-EE95-4643-A4CE-2B4C97BBD3F4/LPTestTarget.app/memoryPluginCalabash.dylib'

Xcode 7.2: builds frank simulator library to Debug-iphoneos directory

and not to the Debug-iphonesimulator directory:

$ xcrun lipo -info build/frank-plugin/sim/Build/Products/Debug-iphoneos/libcalabash-plugin-for-frank.a 
Architectures in the fat file: build/frank-plugin/sim/Build/Products/Debug-iphoneos/libcalabash-plugin-for-frank.a are: i386 x86_64 

Intermittent launch failures: WebKit Threading Violation - initial use of WebKit from a secondary thread.

Only seeing this in Calabash 2.0 at the moment with the CocoaHTTPServer 2.3 sources.

Xcode 6.4

 Time out waiting for UIAutomation run-loop execution expired. 
  Logfile /var/folders/bx/5wplnzxx7492fynry0m_hw080000gp/T/run_loop20150720-60743-5tcdlw/run_loop.out 

  2015-07-20 21:23:54.441 instruments[64395:402028] WebKit Threading Violation - initial use of WebKit from a secondary thread.

  (RunLoop::TimeoutError)
 /Users/moody/git/calabash/calabash/lib/calabash/ios/device/device.rb:402:in `start_app_with_device_and_options'
 /Users/moody/git/calabash/calabash/lib/calabash/ios/device/device.rb:369:in `start_app_on_simulator'
 /Users/moody/git/calabash/calabash/lib/calabash/ios/device/device.rb:350:in `_start_app'
 /Users/moody/git/calabash/calabash/lib/calabash/device.rb:37:in `start_app'
 /Users/moody/git/calabash/calabash/lib/calabash/life_cycle.rb:10:in `start_app'

Log file contains one line:

instruments[64395:402028] WebKit Threading Violation - initial use of WebKit from a secondary thread.

I see this output a bunch in the Terminal, but it has never caused problems. Apple themselves told me this was "normal output". This is the first time I have seen it cause the app not to launch.

@krukow @sapieneptus Please keep an eye out for this.

Xcode 7.0.1 requires arm libraries to be _archived_ to enable bit code

This will affect any users who have updated to Xcode 7.0.1.

  • The calabash.framework cannot be linked using xcodebuild archive from the command line.

  • The framework can be linked when targeting a device from Xcode.

  • Predictably, it cannot be linked when archived from Xcode (Products > Archive).

    ⌦  ld: bitcode bundle could not be generated because 
    '/Users/moody/git/calabash/ios-smoke-test-app/CalSmokeApp/calabash.framework/calabash(LPGCDAsyncSocket.o)' 
    was built without full bitcode. All object files and libraries for bitcode must be generated from Xcode Archive or Install build for architecture armv7
    

This will effect users who build ipas from the command line. I have tried adding this compiler flag: -fembed-bitcode in the server, but I cannot build for arm because of this error:

clang: error: argument unused during compilation:  '-fembed-bitcode-marker'

https://forums.developer.apple.com/thread/8810?q=ENABLE_BITCODE

Exceptions in backdoors are caught by calabash server, preventing crash reports

After we upgraded recently, when code called from a backdoor throws an exception, the application no longer crashes, and so we no longer get a crash report. Instead we get the log lines produced by this pull request:
#156

This prevents us from finding the error in our code. We need the crash report for that.

It looks like #156 is a workaround for some specific problem. Could you change the implementation to only apply to that problem?

Library sizes are growing: what can we remove from the server?

Motivation

There is a bunch of dead code in the server and the size of the libraries is ballooning.

Please update this list of candidates for removal.

  • LPResources - used by LPKeyboardRoute which itself can be removed
  • LPKeyboardRoute - unused
  • LPReflectUtils - should be replaced by LPInvoker; used in UIAST*
  • LPRecorder - API is no longer supported
  • LPAsyncPlaybackRoute - API is no longer supported
  • LPInterpolationRoute - API is no longer supported
  • LPRecordRoute - API is no longer supported
  • LPAppPropertyRoute - There is no client for this route. At first glance it does key-value coding on the app delegate which is not very useful.

Xcode 7.2: builds simulator dylib to Debug-iphoneos directory

instead of Debug-iphonesimulator directory:

$ xcrun lipo -info build/dylib/sim/Build/Products/Debug-iphoneos/calabash-dylib.dylib 
Architectures in the fat file: build/dylib/sim/Build/Products/Debug-iphoneos/calabash-dylib.dylib are: i386 x86_64 

UIAutomation run-loop Error while writing to fifo. RunLoop::Fifo::NoReaderConfiguredError

HI @jmoody

I have a bug that I want report you as below. Then please support me to resolve it.
Thank you so much

REST_BETWEEN_SCENARIOS=1 DEVICE_ENDPOINT=http://10.48.0.36:37265 DEVICE_TARGET=dca1dc41e80d5fa49fc41133c03d704d2b62a06e BUNDLE_ID=test.core.app-cal APP_BUNDLE_PATH="app-cal.app" cucumber -v

Code:

  • features/support/env.rb
  • features/support/01_launch.rb
  • features/support/02_pre_stop_hooks.rb
  • features/step_definitions/calabash_steps.rb
  • features/step_definitions/my_first_steps.rb

Features:

  • features/my_first.feature
    Parsing feature files took 0m0.016s

Feature: Running a test
As an iOS developer
I want to have a sample feature file
So I can begin testing quickly

Scenario: Example steps # features/my_first.feature:6
Unable to start. Make sure you've set APP_BUNDLE_PATH to a build supported by this simulator version
Calabash::Cucumber::Launcher::StartError: Time out waiting for UIAutomation run-loop Error while writing to fifo. RunLoop::Fifo::NoReaderConfiguredError.
Logfile /var/folders/b7/f1yzx1ls7wjgn_953my63m200000gp/T/run_loop20151021-50207-1kzqybk/run_loop.out

2015-10-21 18:42:18.282 instruments[50319:333698] WebKit Threading Violation - initial use of WebKit from a secondary thread.

(Calabash::Cucumber::Launcher::StartError)
/Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/calabash-cucumber-0.15.0/lib/calabash-cucumber/launcher.rb:775:in new_run_loop' /Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/calabash-cucumber-0.15.0/lib/calabash-cucumber/launcher.rb:636:inrelaunch'
/Users/hoangvm/IOS-INP-Cal/calabash/features/support/01_launch.rb:27:in Before' Given I am on the Welcome Screen # features/step_definitions/my_first_steps.rb:1 Then I swipe left # calabash-cucumber-0.15.0/features/step_definitions/calabash_steps.rb:222 And I wait until I don't see "Please swipe left" # calabash-cucumber-0.15.0/features/step_definitions/calabash_steps.rb:158 And take picture # calabash-cucumber-0.15.0/features/step_definitions/calabash_steps.rb:217 getaddrinfo: nodename nor servname provided, or not known (http://proxy-monolala.local:3128) (SocketError) /Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient/session.rb:799:ininitialize'
/Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient/session.rb:799:in new' /Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient/session.rb:799:increate_socket'
/Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient/session.rb:747:in `block in connect'

/Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/timeout.rb:66:in timeout' /Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/timeout.rb:97:intimeout'
/Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient/session.rb:746:in connect' /Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient/session.rb:612:inquery'
/Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient/session.rb:164:in query' /Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient.rb:1191:indo_get_block'
/Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient.rb:974:in block in do_request' /Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient.rb:1082:inprotect_keep_alive_disconnected'
/Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient.rb:969:in do_request' /Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient.rb:822:inrequest'
/Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient.rb:725:in post' /Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/calabash-cucumber-0.15.0/lib/calabash-cucumber/http_helpers.rb:57:inblock in make_http_request'
/Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/calabash-cucumber-0.15.0/lib/calabash-cucumber/http_helpers.rb:50:in times' /Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/calabash-cucumber-0.15.0/lib/calabash-cucumber/http_helpers.rb:50:inmake_http_request'
/Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/calabash-cucumber-0.15.0/lib/calabash-cucumber/http_helpers.rb:29:in http' /Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/calabash-cucumber-0.15.0/lib/calabash-cucumber/connection_helpers.rb:11:inhttp'
/Users/hoangvm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/calabash-cucumber-0.15.0/lib/calabash-cucumber/core.rb:877:in calabash_exit' /Users/hoangvm/IOS-INP-Cal/calabash/features/support/01_launch.rb:34:inAfter'

Failing Scenarios:
cucumber features/my_first.feature:6 # Scenario: Example steps

1 scenario (1 failed)
4 steps (4 skipped)
2m56.547s

Here is my Environment

xcode-select --print-path

/Applications/Xcode.app/Contents/Developer/

xcodebuild -version

Xcode 6.4
Build version 6E35b

calabash-ios version

0.15.0

I can run normally on Simulator iPhone6 6Plus then I can make sure no problem with -cal.app or BUNDLE PATH

Evaluate a batch of queries in a single webservice call

Hi Team,

Since we do intensive validation for almost all view objects in a screen for each test scenario, it takes more time to complete each scenario due to the network latency in the webservice calls between calabash server and client.

Hence we came up with an idea to batch all the queries in a single request and send it to calabash server and validate the same batch and return the results. We have made the changes on our local copy and willing to contribute to the calabash repository.

I am getting this error while creating the branch feature/batch_query for raising the pull request.

remote: Permission to calabash/calabash-ios.git denied to yamkay.
fatal: unable to access 'https://github.com/calabash/calabash-ios-server.git/': The requested URL returned error: 403

Could you please guide the process for the same.

Thanks,
Mohan Kumar Selvaraj

Backgrounding app broken

I am running Xcode 7.3 with the iPhone 6s / iOS 9.3 simulator.

With Calabash 0.18.1 send_app_to_background works for me. In the console, I see:

irb(main):001:0> start_test_server_in_background
Calabash::Cucumber::Launcher: Launch Method instruments
Log file: <path omitted>
irb(main):002:0> send_app_to_background 1.0
{
    "duration" => 1
}
irb(main):003:0> query 'view'
<returns results...>

The sim returns to the home screen, then back into the app, as expected. Further commands are successful.
When using send_app_to_background in a feature spec, it works as well.

But when I updated Calabash to 0.18.2 (both the Cocoapod and the calabash-cucumber gem), it broke.

irb(main):001:0> start_test_server_in_background
 INFO: Detected app at path:
 INFO: <path omitted>
 INFO: Modification time of app: Thu 14 Apr 2016 12:15:57 CDT
 INFO: If this is incorrect, set the APP variable and/or rebuild your app
 INFO: It is your responsibility to ensure you are testing the right app.
Calabash::Cucumber::Launcher: Launch Method instruments
Log file: <path omitted>
irb(main):002:0> send_app_to_background 2.0
{
    "duration" => 2
}
irb(main):003:0> query 'view'
Retrying.. Errno::ECONNREFUSED: (Connection refused - connect(2) (localhost:37265))
Retrying.. Errno::ECONNREFUSED: (Connection refused - connect(2) (localhost:37265))
Failing... Errno::ECONNREFUSED
<stack trace>

The sim goes to the home screen but does not return, and (presumably because the app is still backgrounded) does not accept any further connections from the console.

Apologies if this has already been identified, but I didn't see any related open issues.

Let me know if you need more info. Thanks!

build scripts should run the static analyzer

Today I found 2 issues:

  • memory leak in a PR
  • a bug in LPScrollOperation (introduced by me) #980

The analyzer is particularly important because this is a mixed ARC and retain/release project.

We have one trivial and one non-trivial problem.

2016-01-11_11-49-32

I believe that we could make the CalabashServer a singleton to resolve this issue.

need some CI for dylibs

On Travis, making dylibs is a pain because it requires codesigning.

It is possible to stand up a keychain on Travis, but it would require pulling in a private repo, which I am not sure is safe.

  • Check with Travis staff about safety

The next choice is Jenkins, but that machine in SF needs love. A lot of love.

Xcode 7.1: `make framework` does not find arm library on every system

Reported by @stopiccot

Changing the ARM_LIBRARY_XC7 fixes the problem:

"${ARM_BUILD_DIR}/Build/Intermediates/ArchiveIntermediates/${XC_TARGET}/IntermediateBuildFilesPath/UninstalledProducts/${LIBRARY_NAME}"`
"${ARM_BUILD_DIR}/Build/Intermediates/ArchiveIntermediates/${XC_TARGET}/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/${LIBRARY_NAME}"`

Jenkins builds are unstable

The iOS Simulator environment in Xcode 7 on El Capitan is much less stable than on Yosemite.

At the moment we are starting Jenkins as a LaunchAgent; I wonder if we should go back to starting manually.

  • Reduce the number of simulators we test on in Jenkins
  • $ bundle exec run-loop simctl manage-processes before tests?

Fix Duplicate Query Results: Use NSOrderedSet instead of NSArray

Motivation

Suppose you have a hierarchy:

myView <UIView>
    └ myScrollView <UIScrollView>
        └ myLabel <UILabel>

And you do a query

query "* UILabel"

You will end up returning 3 duplicate copies of myLabel.

Explanation

"* UILabel" means any UILabel, or any descendent of a UIView that is a UILabel. myLabel matches this condition on three separate occasions:

  1. myLabel is a UILabel that has descended from myView, which is a UIView
  2. myLabel is a UILabel that has descended from myScrollView, which is a UIView
  3. myLabel is a UILabel

Walkthrough

# Evaluation algorithm for finding views by class
def find(view, class):
    res = []
    if view.matches(class):
        res.add(view)
    for subview in view.subviews:
        res.addAll(find(subview, class))

# query string: "* UILabel" =>  "UIView UILabel" 
# So we are searching for all UIViews, then from those results, 
# we check if any result is a UILabel, recurse on the subviews, 
# and return cumulation of all UILabel results. 

find(mainWindow, UIView) =>  [ myView, myScrollView, myLabel ]  #returns the whole heirarchy 

#Then we recurse on each match, but searching for UILabel
find(myView, UILabel) => [ myLabel ]
find(myScrollView, UILabel) => [ myLabel ]
find(myLabel, UILabel) => [ myLabel ]

#Final return value:
[ myLabel, myLabel, myLabel ]

This can be easily resolved if we use an NSMutableOrderedSet to gather results instead of an NSMutableArray.

LPWKWebViewCalabashStringByEvaulatingJavaScriptIMP deadlock

When I push a new view controller containing a WKWebView, if I wait for a element to exist with wait_for_element_exists("WKWebView xpath:'//..., then the app freezes.
If I pause the Xcode debugger, I can see it's somehow stuck in LPWKWebViewCalabashStringByEvaulatingJavaScriptIMP:

screen shot 2016-12-07 at 15 21 52

If instead I wait for a second then I do the wait_for_element_exists everything works fine.

My guess is that the completion handler is not called and so the finish property is never set to YES, therefore this while loop will run forever:

while(!finish) {
    [[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
  }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.