Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Touch issues with xcode6 #278

Closed
dzielak79 opened this issue Nov 5, 2014 · 13 comments
Closed

Touch issues with xcode6 #278

dzielak79 opened this issue Nov 5, 2014 · 13 comments

Comments

@dzielak79
Copy link

iOS 7 (frank-cucumber 1.2.3)
pry(#Frank::Console)> touch("view marked:'Some text'")
=> [true]

Element with selector successfully touched.

iOS 8 (frank-cucumber 1.2.3)
pry(#Frank::Console)> touch("view marked:'Some text'")
=> [true]

Element with selector not touched but something else is touched.

@oradyvan
Copy link

oradyvan commented Nov 5, 2014

Hi @dzielak79,

Could you please also show the output of these commands on iOS 7 and iOS 8?

frankly_map("view marked:'Some text'", "self")
accessibility_frame("view marked:'Some text'")

@dzielak79
Copy link
Author

Hi Oradyvan,
as You can see coordinates x and y are switched:

iOS 8.1

frankly_map("view marked:'Password'", "self") => [""] accessibility_frame("view marked:'Password'")
=> #<Frank::Cucumber::Rect:0x000001011ee748
@height=29,
@width=310,
@x=357,
@y=556>

iOS 7.1

frankly_map("view marked:'Password'", "self") => [""] accessibility_frame("view marked:'Password'")
=> #<Frank::Cucumber::Rect:0x000001011b2900
@height=310,
@width=29,
@x=556,
@y=357>

We can observe "a pattern" here :)
but we are not using coordinates to select fields in app:
frankly_map(’view marked:’Password’’, ‘touch’)

@oradyvan
Copy link

oradyvan commented Nov 5, 2014

I was supposing that the selectors on different platforms match different views, so this looks strange that sending "self" returns empty string, as it should return class name of the view.

I wonder if you launch Symbiote and highlight the "view marked:'Password'", would it show highlighted regions of different shape on different platforms?

@ondrejhanslik
Copy link
Contributor

Is your simulator in landscape? Unfortunately iOS 8 did some pretty big changes in view hierarchy and it changed behavior of some methods connected with rotation. The Automation framework uses screen coordinates so there is probably a problem when translating screen coordinates to window coordinates (or viceversa).

@dzielak79
Copy link
Author

  1. Ondrejhansilk: "...is your simulator in landscape?..."
    [comment]: Simulator is in landscape mode. In "inspect" mode view is in portrait mode but in the way which force You to move your head on right side :)
  2. Oradyvan: "...so this looks strange that sending "self" returns empty string..."
    [comment]: Oradyvan string was not empty - part of the message for some reasons couldn't be visible.
    Oryginal result paste below as screenshot:
    image
  3. Oradyvan: "... if you launch Symbiote and highlight the "view marked:'Password'", would it show highlighted regions of different shape on different platforms?..."
    [comment]: as You can see on both screens below it marked the same control, but because different simulator screen position in Symbiote - it marked different region (same from "visual" point of view).

SCREEN1:
image

SCREEN2:
image

@dzielak79
Copy link
Author

As better example:

  1. Please download and use simple app created today:
    https://drive.google.com/file/d/0B-2dmEJZt7dBb3ZyY0ZEdWhfODA/view?usp=sharing

  2. Setup:
    frank setup
    frank build
    frank launch

  3. Test
    frank console

    frankly_map("view:'UIButtonLabel' marked:'Button'", 'touch')
    => [1]

Successfully touched but there is no effect in the app (value label was not increased)

Hope i helps with further investigation.

@oradyvan
Copy link

oradyvan commented Nov 6, 2014

I works every other time I do "frank launch" :) Something is definitely wrong with Shelley I think. If you open Symbiote you will see there are completely no accessibility labels available in the app!

moredip added a commit to TestingWithFrank/PublicAutomation that referenced this issue Nov 16, 2014
Per https://groups.google.com/forum/#!topic/frank-discuss/6eZ2uXIuV9A, it appears that iOS 8
changed the way coordinate spaces work for UIScreen. That mean that tap coords for landscape orientation
wasn't being mapped properly. This fixes that issue by using UICoordinateSpace if available (iOS 8 and up).
moredip added a commit to TestingWithFrank/Frank that referenced this issue Nov 16, 2014
@moredip
Copy link
Owner

moredip commented Nov 16, 2014

I believe I have a fix for this. Please try installing frank-cucumber gem version 1.2.4.pre1 and see if that resolves the issue.

If this DOES resolve the issue please let me know so I can do a non-pre release of the gem.

@moredip moredip closed this as completed Nov 16, 2014
@dgmora
Copy link

dgmora commented Nov 17, 2014

I run some tests and I only encountered one issue (our app runs in landscape all the time). If there is a window on top of another window, the window on the top is rotated 90º to the left.

We're showing this second window to show a custom pop-up. In the simulator the pop-up is shown correctly, but the buttons are not touched. If you check in symbiote, the main window is rotated correctly but the pop-up is rotated incorrectly -90º

@moredip
Copy link
Owner

moredip commented Nov 17, 2014

Could you create a sample app which demonstrates this problem? It'd be best to do so in a new GH issue.

joemasilotti pushed a commit to joemasilotti/PublicAutomation that referenced this issue Nov 20, 2014
Per https://groups.google.com/forum/#!topic/frank-discuss/6eZ2uXIuV9A, it appears that iOS 8
changed the way coordinate spaces work for UIScreen. That mean that tap coords for landscape orientation
wasn't being mapped properly. This fixes that issue by using UICoordinateSpace if available (iOS 8 and up).
@itsthejb
Copy link

itsthejb commented Jan 8, 2015

Hi all,

Just encountered this issue - have to test one case in landscape on the 6+ (8.1). Trying the pre-release version. Tailing the app log shows that the point calculations seem to be correct:

Jan  8 10:38:22 JCs-*****.local *****[33724]: Using Shelley 1.2.3 to select views with selector: view:'UIImageView' marked:'Adjustments' in windows: (
        "<UIWindow: 0x79ebc210; frame = (0 0; 736 414); opaque = NO; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x79ebc9b0>; layer = <UIWindowLayer: 0x79ebc180>>",
        "<UITextEffectsWindow: 0x79e58ab0; frame = (0 0; 736 414); opaque = NO; gestureRecognizers = <NSArray: 0x79e584a0>; layer = <UIWindowLayer: 0x79e588f0>>",
        "<UIStatusBarWindow: 0x79e9a2b0; frame = (0 0; 736 414); opaque = NO; gestureRecognizers = <NSArray: 0x79e7d590>; layer = <UIWindowLayer: 0x79e9a700>>"
    )
Jan  8 10:38:22 JCs-*****.local *****[33724]: tapping at (412.00,22.00)

Measuring the point <412, 22> on the simulator is the correct point, however the actual tap appears to touch a view in the very top left corner, so seems this might be where it's still going wrong, unless there's something else at my end that I'm missing

Please let me know if I can do anything to help!

@moredip
Copy link
Owner

moredip commented Jan 8, 2015

@itsthejb, one thing you could do which would really help is to provide a sample app plus test which reproduces the bug. That will make it a lot easier for someone to fix. You could either make a really simple app from scratch, share your actually app (or a stripped down portion of it), or modify one of the example apps in this repo.

@itsthejb
Copy link

@moredip Ok, here's a test project that recreates the issue: https://github.com/itsthejb/FrankRotateIssue

There is a feature to test this at https://github.com/itsthejb/FrankRotateIssue/blob/master/Frank/features/touch.feature. Basically there are three UIImageView instances posing as buttons with attached gesture recognisers. Not sure if this bastardisation contributes to the issue or not, but am mimicking the full project as closely as possible. The test checks the update of the test label. The test label text should match the accessibility id of the touched button (set the view controller code), but it does not. Most interestingly, touching button 3 actually triggers the Back button, which is on the top-left of the view and not tested directly.

      Text should be "Back", is "" (RuntimeError)
      ./Frank/features/step_definitions/touch_steps.rb:27:in `/^the label should read (.+)$/'
      Frank/features/touch.feature:7:in `Then the label should read <button>'
      | One    |
      Text should be "One", is "" (RuntimeError)
      ./Frank/features/step_definitions/touch_steps.rb:27:in `/^the label should read (.+)$/'
      Frank/features/touch.feature:7:in `Then the label should read <button>'
      | Two    |
      Text should be "Two", is "" (RuntimeError)
      ./Frank/features/step_definitions/touch_steps.rb:27:in `/^the label should read (.+)$/'
      Frank/features/touch.feature:7:in `Then the label should read <button>'
      | Three  |
=>    Text should be "Three", is "Back" (RuntimeError)
      ./Frank/features/step_definitions/touch_steps.rb:27:in `/^the label should read (.+)$/'
      Frank/features/touch.feature:7:in `Then the label should read <button>'

Hopefully this can help to find a solution 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants