From 49798d4dfdf085e7256471059be44dfa1f4e5ab0 Mon Sep 17 00:00:00 2001 From: RedMickey <33267199+RedMickey@users.noreply.github.com> Date: Wed, 2 Oct 2019 14:38:55 +0300 Subject: [PATCH] Add smoke tests for Hermes debugger (#1120) * Add Hermes RN sample project to smoke tests * Add Hermes smoke test scenario * Add TestButton click and fix comments * Add checking for the existence of Hermes mark * Bump RN version for the tests * Change TestButton name to AppTestButton --- gulpfile.js | 5 +- package.json | 1 + .../resources/HermesReactNativeSample/App.js | 75 +++++ .../HermesReactNativeSample/AppTestButton.js | 25 ++ .../HermesReactNativeSample/build.gradle | 201 +++++++++++ .../HermesReactNativeSample/react.gradle | 314 ++++++++++++++++++ test/smoke/resources/launch.json | 13 + test/smoke/src/areas/debug/debug.ts | 6 + test/smoke/src/debugAndroid.test.ts | 51 ++- test/smoke/src/debugIos.test.ts | 2 +- .../src/helpers/androidEmulatorHelper.ts | 9 + test/smoke/src/helpers/appiumHelper.ts | 13 + .../src/helpers/setupEnvironmentHelper.ts | 37 ++- test/smoke/src/main.ts | 4 + 14 files changed, 748 insertions(+), 8 deletions(-) create mode 100644 test/smoke/resources/HermesReactNativeSample/App.js create mode 100644 test/smoke/resources/HermesReactNativeSample/AppTestButton.js create mode 100644 test/smoke/resources/HermesReactNativeSample/build.gradle create mode 100644 test/smoke/resources/HermesReactNativeSample/react.gradle diff --git a/gulpfile.js b/gulpfile.js index 2dcb017e1..e18e28425 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -183,9 +183,8 @@ gulp.task("clean", () => { "!test/resources/sampleReactNative022Project/**/*.js", ".vscode-test/", "nls.*.json", - "!test/smoke/resources/ReactNativeSample/App.js", - "!test/smoke/resources/ExpoSample/App.js", - "!test/smoke/resources/PureRNExpoSample/App.js", + "!test/smoke/**/*.js", + "!test/smoke/**/*.js.map", ] return del(pathsToDelete, { force: true }); }); diff --git a/package.json b/package.json index 3584e966d..dbb44da92 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ ], "activationEvents": [ "onDebugResolve:reactnative", + "onDebugResolve:reactnativedirect", "onDebugInitialConfigurations", "onCommand:reactNative.runAndroidSimulator", "onCommand:reactNative.runAndroidDevice", diff --git a/test/smoke/resources/HermesReactNativeSample/App.js b/test/smoke/resources/HermesReactNativeSample/App.js new file mode 100644 index 000000000..50fe117f5 --- /dev/null +++ b/test/smoke/resources/HermesReactNativeSample/App.js @@ -0,0 +1,75 @@ +/** + * Sample React Native App + * https://github.com/facebook/react-native + * + * @format + * @flow + */ + +import React from 'react'; +import { SafeAreaView, StyleSheet, ScrollView, View, Text, StatusBar } from 'react-native'; +import { Header, LearnMoreLinks, Colors, DebugInstructions, ReloadInstructions } from 'react-native/Libraries/NewAppScreen'; +import AppTestButton from './AppTestButton'; + +const App: () => React$Node = () => { + console.log('Test output from debuggee'); + return ( + <> + + + +
+ {global.HermesInternal == null ? null : ( + + Engine: Hermes + + )} + + + + + ); +}; + +const styles = StyleSheet.create({ + scrollView: { + backgroundColor: Colors.lighter, + }, + engine: { + position: 'absolute', + right: 0, + }, + body: { + backgroundColor: Colors.white, + }, + sectionContainer: { + marginTop: 32, + paddingHorizontal: 24, + }, + sectionTitle: { + fontSize: 24, + fontWeight: '600', + color: Colors.black, + }, + sectionDescription: { + marginTop: 8, + fontSize: 18, + fontWeight: '400', + color: Colors.dark, + }, + highlight: { + fontWeight: '700', + }, + footer: { + color: Colors.dark, + fontSize: 12, + fontWeight: '600', + padding: 4, + paddingRight: 12, + textAlign: 'right', + }, +}); + +export default App; diff --git a/test/smoke/resources/HermesReactNativeSample/AppTestButton.js b/test/smoke/resources/HermesReactNativeSample/AppTestButton.js new file mode 100644 index 000000000..d5c4a6bdb --- /dev/null +++ b/test/smoke/resources/HermesReactNativeSample/AppTestButton.js @@ -0,0 +1,25 @@ +import React, { Component } from 'react'; +import { View, Button } from 'react-native'; + +export default class AppTestButton extends Component { + constructor(props) { + super(props); + this.handleClick = this.handleClick.bind(this); + } + handleClick() { + let testBooleanValue = true; + console.log('Test output from Hermes debuggee'); + } + render() { + return ( + +