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

Add grey_firstElement() to examples #135

Closed
wants to merge 1 commit into from
Closed

Add grey_firstElement() to examples #135

wants to merge 1 commit into from

Conversation

bootstraponline
Copy link
Contributor

}

let description: DescribeToBlock = { (description: GREYDescription!) -> Void in
guard let description = description else {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is description sometimes nil?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can be empty but shouldn't be nil. You're supposed to append matcher's description to it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting exceptions when running description.appendText("first match") without the guard.

Copy link
Collaborator

@khandpur khandpur Jun 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

found the bug:

return [self matches:item describingMismatchTo:nil];

We should fix that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I agree! Opened #136

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should close this or find another way to provide it or so until we fix that issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be better to merge since this is what people have to do right now? Then update once the bug is fixed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update this as #137 is in?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bootstraponline, should the guard be removed now that your fix is in?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bootstraponline, should the guard be removed now that your fix is in?

yes, updated.

@tirodkar
Copy link
Collaborator

LGTM

When an application has exact duplicate elements (every attribute is the same,
including their hierarchy), then the correct fix is to update the app to avoid
duplicating the UI. When that's not possible, a workaround is to match on
the first element.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of the first element, couldn't we generalize this to match on Nth element?
I believe that can be baked in to the API :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that's a great idea. I received similar feedback internally.

@khandpur
Copy link
Collaborator

@bootstraponline - I feel that this would serve better as a first party API. Thoughts?

@bootstraponline
Copy link
Contributor Author

@bootstraponline - I feel that this would serve better as a first party API. Thoughts?

agreed

@bootstraponline
Copy link
Contributor Author

Closing in favor of implementing Nth element matcher in EarlGrey core.

#138

@bootstraponline bootstraponline deleted the examples.md branch July 1, 2016 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants