-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Introduce restricted support in RN .58+ for Android #1416
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Wed Dec 20 14:09:27 IST 2017 | ||
#Sun May 26 15:32:06 IDT 2019 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
detox/test/android/app/src/androidTest/java/com/example/DetoxTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,5 +41,4 @@ public void onCreate() { | |
super.onCreate(); | ||
SoLoader.init(this, /* native exopackage */ false); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,3 @@ | |
# org.gradle.parallel=true | ||
|
||
android.useDeprecatedNdk=true | ||
android.enableAapt2=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Tue Jun 20 12:00:16 IDT 2017 | ||
#Tue May 21 17:08:37 IDT 2019 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** | ||
* A mini suite providing an alternative to tests failing due to issues found in RN 58+ on Android (see | ||
* https://github.com/facebook/react-native/issues/23870). | ||
* It basically runs similar use cases -- all of which involve visibility and scrolling, but in a | ||
* setup where they _can_ pass, so as to assert that the core Detox functionality (waitFor(), scroll()) | ||
* is valid nevertheless. | ||
*/ | ||
|
||
describe('Fullscreen scrolling Actions', () => { | ||
beforeEach(async () => { | ||
await device.reloadReactNative(); | ||
await element(by.text('Scroll-Actions')).tap(); | ||
}); | ||
|
||
it('should scroll for a small amount in direction', async () => { | ||
await expect(scrollViewDriver.element()).toBeVisible(); | ||
await expect(scrollViewDriver.firstItem()).toBeVisible(); | ||
await expect(scrollViewDriver.lastItem()).toBeNotVisible(); | ||
|
||
await scrollViewDriver.scrollBy(60); | ||
await expect(scrollViewDriver.firstItem()).toBeNotVisible(); | ||
await expect(scrollViewDriver.secondItem()).toBeVisible(); | ||
await scrollViewDriver.scrollBy(-60); | ||
await expect(scrollViewDriver.firstItem()).toBeVisible(); | ||
await expect(scrollViewDriver.lastItem()).toBeNotVisible(); | ||
}); | ||
|
||
it('should scroll for a large amount in direction', async () => { | ||
await expect(scrollViewDriver.element()).toBeVisible(); | ||
await expect(scrollViewDriver.firstItem()).toBeVisible(); | ||
await expect(scrollViewDriver.lastItem()).toBeNotVisible(); | ||
|
||
try { | ||
await scrollViewDriver.scrollBy(1000); | ||
} catch (error) { | ||
console.log('Expected error caught: Scrolled the list down to its very end'); | ||
} | ||
await expect(scrollViewDriver.firstItem()).toBeNotVisible(); | ||
await expect(scrollViewDriver.lastItem()).toBeVisible(); | ||
}); | ||
|
||
it('should find element by scrolling until it is visible', async () => { | ||
await expect(scrollViewDriver.lastItem()).toBeNotVisible(); | ||
await waitFor(scrollViewDriver.lastItem()).toBeVisible().whileElement(scrollViewDriver.viewFilter()).scroll(200, 'down'); | ||
await expect(scrollViewDriver.lastItem()).toBeVisible(); | ||
}); | ||
}); | ||
|
||
const scrollViewDriver = { | ||
viewFilter: () => by.id('FSScrollActions.scrollView'), | ||
element: () => element(scrollViewDriver.viewFilter()), | ||
listItem: (index) => element(by.text(`Text${index}`)), | ||
firstItem: () => scrollViewDriver.listItem(1), | ||
secondItem: () => scrollViewDriver.listItem(2), | ||
lastItem: () => scrollViewDriver.listItem(20), | ||
scrollBy: (amount) => scrollViewDriver.element().scroll(Math.abs(amount), (amount > 0 ? 'down' : 'up')), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const _ = require('lodash'); | ||
const rnMinorVer = require('./rn-consts').rnVersion.minor; | ||
|
||
const _it = { | ||
withFailureIf: { | ||
android: { | ||
rn58OrNewer: (spec, specFn) => runOrExpectFailByPredicates(spec, specFn, platformIs('android'), rnVerAtLeast(58)), | ||
} | ||
}, | ||
}; | ||
|
||
function runOrExpectFailByPredicates(spec, specFn, ...predicateFuncs) { | ||
it(spec, async function() { | ||
if (allPredicatesTrue(predicateFuncs)) { | ||
await expectSpecFail(specFn); | ||
} else { | ||
await runSpec(specFn); | ||
} | ||
}); | ||
} | ||
|
||
const platformIs = (platform) => () => (device.getPlatform() === platform); | ||
const rnVerAtLeast = (rnVer) => () => (rnMinorVer >= rnVer); | ||
const allPredicatesTrue = (predicateFuncs) => _.reduce(predicateFuncs, (result, predicate) => (result && predicate()), true); | ||
|
||
async function expectSpecFail(specFn) { | ||
try { | ||
await runSpec(specFn); | ||
} catch (e) { | ||
console.log('Successfully caught an expected error:', e); | ||
return; | ||
} | ||
throw new Error('Ran a spec expecting an error, but no error was thrown'); | ||
} | ||
|
||
const runSpec = (specFn) => specFn(); | ||
|
||
module.exports = { | ||
it: _it, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const rnVersion = (function parseRNVersion() { | ||
const packageJson = require('react-native/package.json'); | ||
const raw = packageJson.version; | ||
const [major, minor, patch] = raw.split('.'); | ||
return { | ||
major, | ||
minor, | ||
patch, | ||
raw, | ||
}; | ||
})(); | ||
|
||
module.exports = { | ||
rnVersion, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React, { Component } from 'react'; | ||
import { | ||
Text, | ||
View, | ||
ScrollView, | ||
} from 'react-native'; | ||
|
||
export default class ScrollActionsScreen extends Component { | ||
|
||
render() { | ||
return ( | ||
<View style={{ flex: 1, justifyContent: 'flex-start', borderColor: '#c0c0c0', borderWidth: 1, backgroundColor: '#f8f8ff' }}> | ||
<ScrollView testID='FSScrollActions.scrollView'> | ||
{ | ||
Array.from({length: 20}, (_, index) => this.renderItem(index + 1)) | ||
} | ||
</ScrollView> | ||
</View> | ||
); | ||
} | ||
|
||
renderItem(id) { | ||
return <Text key={`listItem.${id}`} style={{ height: 30, backgroundColor: '#e8e8f8', padding: 5, margin: 10 }}>{`Text${id}`}</Text>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the point of this if we know it will fail anyway? We will be running the RN59 suite from now on, on both iOS and Android. Why not just close it off for Android until we have a proper fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so we'd know when (if) they decide to get it fixed.