Skip to content
New issue

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

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

Already on GitHub? # to your account

Nested Scrollview fix #458

Closed
wants to merge 7 commits into from
Closed

Nested Scrollview fix #458

wants to merge 7 commits into from

Conversation

Protothor
Copy link

Solution to issue #164
Gets first scrollView in Element.scroll() to fix iOS nested scrollView problem

@rotemmiz
Copy link
Member

Can you please provide an e2e test that will prove this correction?

@LeoNatan
Copy link
Contributor

LeoNatan commented Dec 13, 2017

I don't think this is a correct fix.

As I understand from the code, this will only scroll the first matched instance. But as the issue describes, if two scroll views exist, outer for vertical and inner for horizontal scrolls, scrolling vertically with this solution would fail.

This is a good workaround for people that need the type of solution here, but this is not a general case.

Correct me if I'm wrong.

@Protothor
Copy link
Author

Protothor commented Dec 13, 2017

Sorry about not getting back to you until now, but I live on the West Coast of the US (GMT -8)

Based on my testing it works, and in theory based on the code it should too. The "_extendToDescendantScrollViews" function gets all UIScrollViews inside of the RCTScrollView and the order they will appear in array will be from parent to child. Since the first UIScrollView that is returned from that array will be the one we're targeting based on a testID the "atIndex(0)" will target the correct one. Unfortunately, I didn't have the time to attack the "waitFor().action().whileElement().scroll()" this time because it uses a great deal of native code to do the whileElement matcher, but this allows testing of nested ScrollViews in iOS in some fashion even if it's not as pretty.

@Protothor
Copy link
Author

So, I'm not sure what the problem with the 4th build.

The first time it froze on the "before all" hook

  1. "before all" hook
    0 passing (2m)
    1 failing
  2. "before all" hook:
    Error: Timeout of 120000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

And the second time it timed out during the lerna set up

$ ./scripts/demo-projects.ios.sh
./scripts/bootstrap.sh
lerna info version 2.4.0
lerna info Bootstrapping 9 packages
lerna info lifecycle preinstall
lerna info Installing external dependencies
No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received
The build has been terminated

Otherwise the tests works, it's a simple nested scrollview that uses "swipe", "scrollTo" and "scroll" to scroll the both the parent and child scroll views.

@Protothor
Copy link
Author

Hello again, I didn't want to bother anyone around the end of the year holidays, but this passes, there are tests written, is there anything else I can do to complete this pull request?

@LeoNatan LeoNatan requested a review from rotemmiz January 6, 2018 00:37
@rotemmiz
Copy link
Member

rotemmiz commented Jan 9, 2018

Looks great, I just need you to make sure it doesn't break Android e2e, and since we still can't run it in CI please make sure it runs locally . When done mention it here and I'll merge

@Protothor
Copy link
Author

So, I tested android and the way that the deep linking worked there, it was getting stuck. So I just updated the test to launch a non-linked instance so that it wouldn't lock the app in after a device.reloadReactNative()

@Protothor
Copy link
Author

Hello, checking in again. Seeing where we're at with this. It's all passing. I've verified android locally. Anything else I can do to get this merged?

@lorrainefox
Copy link

This update is very important to my project. Can we get an approval please? I have some people on my team looking for another automated testing tool and I would rather stay with detox.

@rotemmiz
Copy link
Member

The best way to to have this PR merged is by adding an e2e test that proves its
necessity. This e2e test will also make sure it doesn't break in the future.
This is where I'd add it:
E2e test:
https://github.com/wix/detox/blob/master/detox/test/e2e/c-actions.js

Test app:
https://github.com/wix/detox/blob/master/detox/test/src/Screens/ActionsScreen.js

@Protothor
Copy link
Author

Oh, I'm sorry if I placed the tests incorrectly. I added another test suite. (p-nested-scroll-view), linked it to the main page and ran it as a part of the suite.

@@ -1,4 +1,7 @@
describe('Deep Links', () => {
after(async () => {
Copy link
Member

Choose a reason for hiding this comment

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

Why was this added?

await device.reloadReactNative();
});

beforeEach(async () => {
Copy link
Member

Choose a reason for hiding this comment

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

You can merge both beforeEachs

await element(by.text('Nested ScrollView')).tap();
});

it('Should handle swipe', async () => {
Copy link
Member

Choose a reason for hiding this comment

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

Nicee!!

await expect(element(by.text('Left'))).toBeVisible();
});
it('Should handle scroll', async () => {
try {
Copy link
Member

Choose a reason for hiding this comment

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

What are you catching here?

@rotemmiz
Copy link
Member

Ping ;)

@stale
Copy link

stale bot commented May 4, 2018

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the 🏚 stale label May 4, 2018
@stale
Copy link

stale bot commented May 11, 2018

The issue has been closed for inactivity.

@stale stale bot closed this May 11, 2018
@heuism
Copy link

heuism commented May 17, 2018

@Protothor does this work that @rotemmiz can merge in?

@timea
Copy link

timea commented Jun 14, 2018

Can we please get this PR in? Would be very helpful.

@wix wix locked and limited conversation to collaborators Jul 23, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants