-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1421 from wix/rn59
Restricted support in RN .59
- Loading branch information
Showing
22 changed files
with
178 additions
and
29 deletions.
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
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