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

Can not click on button after view animated #270

Open
dangluan opened this issue Mar 4, 2014 · 19 comments
Open

Can not click on button after view animated #270

dangluan opened this issue Mar 4, 2014 · 19 comments

Comments

@dangluan
Copy link

dangluan commented Mar 4, 2014

Hi everybody!
I try to click button after my view controller animated , but it's not working , and this is errors:
When I touch on the "menu icon" button after animate # Frank/features/step_definitions/frank_steps.rb:77 frankly_map button marked:'menu icon' touch failed because: encountered error while attempting to perform touch on selected elements View not touched because it would not be the recipient of the touch event - consider FEX_forcedTouch instead (touch recipient: 0x989cef0#UIView) (RuntimeError) ./Frank/features/step_definitions/frank_steps.rb:81:in /^I touch on the "([^\"]*)" button after animate$/' Frank/features/main.feature:213:in 'When I touch on the "menu icon" button after animate'

And this is my custom frank step:
When /^I touch on the "([^\"]*)" button after animate$/ do |mark| wait_for_nothing_to_be_animating selector = "button marked:'#{mark}'" if check_element_exists(selector) touch(selector) end end
please help me !!!!

@madewulf
Copy link

Have you ever found a solution for this?

@oradyvan
Copy link

Well, this sometimes happens when you attempt tapping control while it is still part of animation sequence. Try this approach in your step definition:

wait_for_element_to_exist(selector)
wait_for_nothing_to_be_animating
touch(selector)

@madewulf
Copy link

Thanks a lot!

That seems to help indeed, the error disappeared, but now, the problem is
that I was trying to touch a UITableViewCell, and apparently, it does not
work with this code. I would be very grateful for any idea about this.

On Mon, Jan 19, 2015 at 3:02 PM, Oleksiy Radyvanyuk <
notifications@github.com> wrote:

Well, this sometimes happens when you attempt tapping control while it is
still part of animation sequence. Try this approach in your step definition:

wait_for_element_to_exist(selector)
wait_for_nothing_to_be_animating
touch(selector)


Reply to this email directly or view it on GitHub
#270 (comment).

@oradyvan
Copy link

Do you have an output in console showing what kind of issue occurs when your scenario is executed?

@madewulf
Copy link

The cell is just not pressed, since the action associated just does not happen.

Here is what I wrote:
selector = "view:'IPMoreCell' marked:'Account settings'"
check_element_exists selector
wait_for_element_to_exist selector
wait_for_nothing_to_be_animating
touch selector

So, the element does exist, but it is not touched in the end.

@oradyvan
Copy link

Try change your cell selector to this:

selector = "view:'IPMoreCell' marked:'Account settings' FEX_isVisible"

@madewulf
Copy link

Thanks a lot for your help, but with that, I have the following error:

Given I launch the app                  #

Frank/features/step_definitions/launch_steps.rb:5
Then I should be on the Services screen #
Frank/features/step_definitions/login_steps.rb:41
When I open the menu #
Frank/features/step_definitions/login_steps.rb:45
When I tap on the user settings #
Frank/features/step_definitions/login_steps.rb:49
Could not find element matching selector (view:'IPMoreCell'
marked:'Account settings' FEX_isVisible)
(RSpec::Expectations::ExpectationNotMetError)
./Frank/features/step_definitions/login_steps.rb:51:in /^I tap on the user settings$/' Frank/features/login.feature:11:inWhen I tap on the user settings'
When I logout #
Frank/features/step_definitions/login_steps.rb:58

Athought the selector seems ok as you can see in this symbiote screenshot:

https://www.dropbox.com/s/7amz0u96shj6gnd/Screenshot%202015-01-19%2015.35.03.png?dl=0

On Mon, Jan 19, 2015 at 3:27 PM, Oleksiy Radyvanyuk <
notifications@github.com> wrote:

Try change your cell selector to this:

selector = "view:'IPMoreCell' marked:'Account settings' FEX_isVisible"


Reply to this email directly or view it on GitHub
#270 (comment).

@oradyvan
Copy link

So if you while on that same screen in Symbiote, will press "Touch" button for this selector - will the action happen?

@madewulf
Copy link

Yes, that works.

On Mon, Jan 19, 2015 at 3:39 PM, Oleksiy Radyvanyuk <
notifications@github.com> wrote:

So if you while on that same screen in Symbiote, will press "Touch" button
for this selector - will the action happen?


Reply to this email directly or view it on GitHub
#270 (comment).

@oradyvan
Copy link

Hm, it seems to me this is pure timing issue related to animation. Maybe, in order to not waste your time on this, just add some delay with "sleep 0.5" for example, right before touching the cell. Otherwise I have no fresh ideas on why tapping the cell from code does not happen for you.

@madewulf
Copy link

You were right, it's related to the animation. Actually, I just noticed
that adding wait_for_nothing_to_be_animating made this precise test freeze
(it never ends). Replacing by a sleep instruction made the test succeed.

Thanks a lot for your time!

On Mon, Jan 19, 2015 at 3:44 PM, Oleksiy Radyvanyuk <
notifications@github.com> wrote:

Hm, it seems to me this is pure timing issue related to animation. Maybe,
in order to not waste your time on this, just add some delay with "sleep
0.5" for example, right before touching the cell. Otherwise I have no fresh
ideas on why tapping the cell from code does not happen for you.


Reply to this email directly or view it on GitHub
#270 (comment).

@oradyvan
Copy link

Oh, if adding call to wait_for_nothing_to_be_animating freezes your app that means most likely you are using animated UIImageViews and Frank at the moment does not process that nicely. I had to modify sources of Frank and use my own gem in order to solve this problem, however this is in closed repository and I cannot share the code with you.

@madewulf
Copy link

I don't think we use such thing, but maybe one of the libraries we use do.
I'll try to check, but thanks for the hint!

On Mon, Jan 19, 2015 at 3:51 PM, Oleksiy Radyvanyuk <
notifications@github.com> wrote:

Oh, if adding call to wait_for_nothing_to_be_animating freezes your app
that means most likely you are using animated UIImageViews and Frank at
the moment does not process that nicely. I had to modify sources of Frank
and use my own gem in order to solve this problem, however this is in
closed repository and I cannot share the code with you.


Reply to this email directly or view it on GitHub
#270 (comment).

@seanoshea
Copy link
Contributor

wait_for_nothing_to_be_animating can be troublesome when dealing with UIRefreshControls as they are always 'animating' even when they are off screen.

@oradyvan
Copy link

Yes, and not only refresh control, but also with any UIImageView having isAnimating method return true and also animationRepeatCount return 0 that is endless animation. And in case you extend scope of windows being requested by Shelley engine to all windows, there will be problems with network activity indicator on status bar. To avoid all these issues Frank libraries need to be customized.

@ondrejhanslik
Copy link
Contributor

Don't wait random times, don't wait for everything. Make specific wait selectors. You don't have to wait for everything to stop animating. Create a selector for the view that you expect to be animating and wait for it. If you want to touch a button, don't wait for animations, wait for the button to become touchable (there is a selector for that, something like FEX_isTouchable).
Frank is very good but unfortunately new development has stopped. I tried to push some big changes when I was needing them but in the end if was easier (and faster) to just fork and work locally.

@madewulf
Copy link

Ok, thanks a lot for all this information, it is very precious to me!

On Tue, Jan 20, 2015 at 12:09 PM, Ondrej Hanslik notifications@github.com
wrote:

Don't wait random times, don't wait for everything. Make specific wait
selectors. You don't have to wait for everything to stop animating. Create
a selector for the view that you expect to be animating and wait for it. If
you want to touch a button, don't wait for animations, wait for the button
to become touchable (there is a selector for that, something like
FEX_isTouchable).
Frank is very good but unfortunately new development has stopped. I tried
to push some big changes when I was needing them but in the end if was
easier (and faster) to just fork and work locally.


Reply to this email directly or view it on GitHub
#270 (comment).

@kundanyevale
Copy link

kundanyevale commented Nov 30, 2017

Thank a lot @oradyvan
For how much time wait to find element(selector)?
Is there any max limit to search it?

@oradyvan
Copy link

My apologies, I have stopped working with Frank quite a long time ago, so I have no answer to your question.

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