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

Feature request - waitForActivity() modification to recognize subclasses #627

Closed
renas opened this issue Aug 20, 2015 · 3 comments
Closed

Comments

@renas
Copy link
Contributor

renas commented Aug 20, 2015

From ianm...@gmail.com on October 31, 2013 11:48:35

Lets say we have the following classes

Activity

EditActivity extends Activity

NoteEditActivity extends EditActivity
NotebookEditActivity extends EditActivity

Current functionality

In Robotium now calling waitForActivity(EditActivity.class)
will return false for its subclasses (ie. NoteEditActivity and NotebookEditActivity).

Desired functionality

having waitForActivity(EditActivity.class) return true for all its subclasses (ie. NoteEditActivity and NotebookEditActivity).

Current usage/workaround

calling
solo.waitForActivity(NoteEditActivity.class, TIME_OUT) || solo.waitForActivity(NotebookEditActivity.class, TIME_OUT)

Problems

  1. slow due to timing out of first condition before second condition is evaluated
  2. if a new sub class of EditActivity is added, the above code needs to be modified. It is not scaleable.

Suggested modification

using the instanceof operator should work. I assume the current code is implemented using Class:getClass() comparisons.

Possible issues

Cases:

  1. Where the current implementation returns true, the proposed waitForActivity() functionality will always return true
  2. Where the current functionality returns false sometimes the new functionality will return true
    eg.
    Current: waitForClass(ParentActivity.class) -> false
    Proposed: waitForClass(ParentActivity.class) -> true

The 2) case looks like it may be an issue for some current projects. If this is an issue adding a new method to Solo would be just as helpful. Actually thinking about it more, I think it would probably be the better solution.

Maybe call it waitForActivityInstanceOf()

Thanks for Robotium it has been a huge help for me :)

Original issue: http://code.google.com/p/robotium/issues/detail?id=548

@renas
Copy link
Contributor Author

renas commented Aug 20, 2015

From carl.na...@sas.com on October 31, 2013 12:08:01

I would recommend that if the requested feature is not already present in another function, then it should definitely be implemented in a new separate function.

I'd see your waitForActivityInstanceOf() and raise you a waitForActivitySubclass().

InstanceOf "feels" like it would contradict the required Class parameter signature.

@renas
Copy link
Contributor Author

renas commented Aug 20, 2015

From renasr...@gmail.com on October 31, 2013 22:17:01

Thanks for reporting this. A new method will be included in the next release.

Status: Accepted
Owner: renasr...@gmail.com

@renas
Copy link
Contributor Author

renas commented Aug 20, 2015

From renasr...@gmail.com on January 05, 2014 23:54:03

At this time we've opted to not include this. Will open this issue if that changes in the future.

Status: WontFix

@renas renas closed this as completed Aug 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant