mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-21 02:26:18 +08:00
Open sourced 4 more instrumentation tests for RN Android
Summary: More instrumentation tests in OSS means less work for FB engineers to investigate if a PR breaks some internal tests. + increased timeouts and retries for OSS tests runner Reviewed By: andreicoman11 Differential Revision: D3292582 fbshipit-source-id: 3f8aa4d3536450ea3af7acff044b9bb62be0f9db
This commit is contained in:
committed by
Facebook Github Bot 2
parent
31c8b3bd61
commit
2c3ca4c058
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule CatalystRootViewTestModule
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var React = require('React');
|
||||
var Recording = require('NativeModules').Recording;
|
||||
var View = require('View');
|
||||
|
||||
var CatalystRootViewTestApp = React.createClass({
|
||||
componentWillUnmount: function() {
|
||||
Recording.record('RootComponentWillUnmount');
|
||||
},
|
||||
render: function() {
|
||||
return <View collapsable={false} style={{alignSelf: 'stretch'}} />;
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
CatalystRootViewTestApp: CatalystRootViewTestApp,
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule DatePickerDialogTestModule
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var BatchedBridge = require('BatchedBridge');
|
||||
var DatePickerAndroid = require('DatePickerAndroid');
|
||||
var React = require('React');
|
||||
var RecordingModule = require('NativeModules').DatePickerDialogRecordingModule;
|
||||
var View = require('View');
|
||||
|
||||
var DatePickerDialogTestApp = React.createClass({
|
||||
render: function() {
|
||||
return (<View />);
|
||||
},
|
||||
});
|
||||
|
||||
var DatePickerDialogTestModule = {
|
||||
DatePickerDialogTestApp: DatePickerDialogTestApp,
|
||||
showDatePickerDialog: function(options) {
|
||||
DatePickerAndroid.open(options).then(
|
||||
({action, year, month, day}) => {
|
||||
if (action === DatePickerAndroid.dateSetAction) {
|
||||
RecordingModule.recordDate(year, month, day);
|
||||
} else if (action === DatePickerAndroid.dismissedAction) {
|
||||
RecordingModule.recordDismissed();
|
||||
}
|
||||
},
|
||||
({code, message}) => RecordingModule.recordError()
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
BatchedBridge.registerCallableModule(
|
||||
'DatePickerDialogTestModule',
|
||||
DatePickerDialogTestModule
|
||||
);
|
||||
|
||||
module.exports = DatePickerDialogTestModule;
|
||||
@@ -12,17 +12,30 @@
|
||||
// Disable YellowBox so we do not have to mock its dependencies
|
||||
console.disableYellowBox = true;
|
||||
|
||||
// Include modules used by integration tests
|
||||
require('PickerAndroidTestModule');
|
||||
// Include callable JS modules first, in case one of the other ones below throws
|
||||
require('ProgressBarTestModule');
|
||||
require('ViewRenderingTestModule');
|
||||
|
||||
require('PickerAndroidTestModule');
|
||||
require('CatalystRootViewTestModule');
|
||||
require('DatePickerDialogTestModule');
|
||||
require('ScrollViewTestModule');
|
||||
require('SwipeRefreshLayoutTestModule');
|
||||
require('TextInputTestModule');
|
||||
require('TimePickerDialogTestModule');
|
||||
|
||||
// Define catalyst test apps used in integration tests
|
||||
var AppRegistry = require('AppRegistry');
|
||||
|
||||
var apps = [
|
||||
{
|
||||
appKey: 'CatalystRootViewTestApp',
|
||||
component: () => require('CatalystRootViewTestModule').CatalystRootViewTestApp
|
||||
},
|
||||
{
|
||||
appKey: 'DatePickerDialogTestApp',
|
||||
component: () => require('DatePickerDialogTestModule').DatePickerDialogTestApp
|
||||
},
|
||||
{
|
||||
appKey: 'HorizontalScrollViewTestApp',
|
||||
component: () => require('ScrollViewTestModule').HorizontalScrollViewTestApp,
|
||||
@@ -47,6 +60,10 @@ var apps = [
|
||||
appKey: 'TestIdTestApp',
|
||||
component: () => require('TestIdTestModule').TestIdTestApp
|
||||
},
|
||||
{
|
||||
appKey: 'TimePickerDialogTestApp',
|
||||
component: () => require('TimePickerDialogTestModule').TimePickerDialogTestApp
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule TimePickerDialogTestModule
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var BatchedBridge = require('BatchedBridge');
|
||||
var TimePickerAndroid = require('TimePickerAndroid');
|
||||
var React = require('React');
|
||||
var RecordingModule = require('NativeModules').TimePickerDialogRecordingModule;
|
||||
var View = require('View');
|
||||
|
||||
var TimePickerDialogTestApp = React.createClass({
|
||||
render: function() {
|
||||
return <View />;
|
||||
},
|
||||
});
|
||||
|
||||
var TimePickerDialogTestModule = {
|
||||
TimePickerDialogTestApp: TimePickerDialogTestApp,
|
||||
showTimePickerDialog: function(options) {
|
||||
TimePickerAndroid.open(options).then(
|
||||
({action, hour, minute}) => {
|
||||
if (action === TimePickerAndroid.timeSetAction) {
|
||||
RecordingModule.recordTime(hour, minute);
|
||||
} else if (action === TimePickerAndroid.dismissedAction) {
|
||||
RecordingModule.recordDismissed();
|
||||
}
|
||||
},
|
||||
({code, message}) => RecordingModule.recordError()
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
BatchedBridge.registerCallableModule(
|
||||
'TimePickerDialogTestModule',
|
||||
TimePickerDialogTestModule
|
||||
);
|
||||
|
||||
module.exports = TimePickerDialogTestModule;
|
||||
102
ReactAndroid/src/androidTest/js/ViewRenderingTestModule.js
Normal file
102
ReactAndroid/src/androidTest/js/ViewRenderingTestModule.js
Normal file
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule ViewRenderingTestModule
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
var BatchedBridge = require('BatchedBridge');
|
||||
var React = require('React');
|
||||
var View = require('View');
|
||||
var StyleSheet = require('StyleSheet');
|
||||
|
||||
var renderApplication = require('renderApplication');
|
||||
|
||||
var styles = StyleSheet.create({
|
||||
view: {
|
||||
opacity: 0.75,
|
||||
backgroundColor: "rgb(255, 0, 0)",
|
||||
},
|
||||
});
|
||||
|
||||
var ViewSampleApp = React.createClass({
|
||||
render: function() {
|
||||
return (
|
||||
<View style={styles.view} collapsable={false}/>
|
||||
);
|
||||
},
|
||||
getInitialState: function() {
|
||||
return {};
|
||||
},
|
||||
});
|
||||
|
||||
var updateMargins;
|
||||
var MarginSampleApp = React.createClass({
|
||||
getInitialState: function() {
|
||||
return {margin: 10};
|
||||
},
|
||||
render: function() {
|
||||
updateMargins = this.setState.bind(this, {margin: 15});
|
||||
return (
|
||||
<View style={{margin: this.state.margin, marginLeft: 20}} collapsable={false}/>
|
||||
)
|
||||
},
|
||||
});
|
||||
|
||||
var BorderSampleApp = React.createClass({
|
||||
render: function() {
|
||||
return (
|
||||
<View style={{borderLeftWidth: 20, borderWidth: 5, backgroundColor: 'blue'}} collapsable={false}>
|
||||
<View style={{backgroundColor: 'red', width: 20, height: 20}} collapsable={false}/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
var TransformSampleApp = React.createClass({
|
||||
render: function() {
|
||||
var style = {
|
||||
transform: [
|
||||
{translateX: 20},
|
||||
{translateY: 25},
|
||||
{rotate: '15deg'},
|
||||
{scaleX: 5},
|
||||
{scaleY: 10},
|
||||
]
|
||||
};
|
||||
return (
|
||||
<View style={style} collapsable={false}/>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
var ViewRenderingTestModule = {
|
||||
renderViewApplication: function(rootTag) {
|
||||
renderApplication(ViewSampleApp, {}, rootTag);
|
||||
},
|
||||
renderMarginApplication: function(rootTag) {
|
||||
renderApplication(MarginSampleApp, {}, rootTag);
|
||||
},
|
||||
renderBorderApplication: function(rootTag) {
|
||||
renderApplication(BorderSampleApp, {}, rootTag);
|
||||
},
|
||||
renderTransformApplication: function(rootTag) {
|
||||
renderApplication(TransformSampleApp, {}, rootTag);
|
||||
},
|
||||
updateMargins: function() {
|
||||
updateMargins();
|
||||
},
|
||||
};
|
||||
|
||||
BatchedBridge.registerCallableModule(
|
||||
'ViewRenderingTestModule',
|
||||
ViewRenderingTestModule
|
||||
);
|
||||
|
||||
module.exports = ViewRenderingTestModule;
|
||||
Reference in New Issue
Block a user