* Update RN Native app sample
* Add variables for setting a breakpoints

* Add global variables that stores line number for setting a breakpoint

* Add fix for RN 0.60 version

* Add App.js sample for pure RN app with Expo

* Exclude pure RN app.js sample from gulp clean task

* Add binding for home -> Home button for webdriverIO

* Adapt to @react-native-community/cli@2.1.0 iOS logging

* Change success patterns for iOS for react-native-cli 2.1.0
This commit is contained in:
Yuri Skorokhodov 2019-07-09 14:00:43 +03:00 коммит произвёл GitHub
Родитель d8cf3d51c1
Коммит 3021756ba7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
12 изменённых файлов: 243 добавлений и 87 удалений

Просмотреть файл

@ -185,6 +185,7 @@ gulp.task("clean", () => {
"nls.*.json",
"!test/smoke/resources/ReactNativeSample/App.js",
"!test/smoke/resources/ExpoSample/App.js",
"!test/smoke/resources/PureRNExpoSample/App.js",
]
return del(pathsToDelete, { force: true });
});

16
js-patched/open-main.js Normal file
Просмотреть файл

@ -0,0 +1,16 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
'use strict';
var open = require('./index.js');
module.exports = function(target, opts) {
if (process.env.REACT_DEBUGGER) {
if (opts.app) {
console.log("Debugger for React Native is configured. Skipping launch of " + opts.app);
}
return;
}
return open(target, opts);
};

Просмотреть файл

@ -14,7 +14,6 @@ import {Request} from "./node/request";
import {ReactNativeProjectHelper} from "./reactNativeProjectHelper";
import {PackagerStatusIndicator, PackagerStatus} from "../extension/packagerStatusIndicator";
import {SettingsHelper} from "../extension/settingsHelper";
import * as Q from "q";
import * as path from "path";
import * as XDL from "../extension/exponent/xdlInterface";
@ -30,10 +29,18 @@ export class Packager {
private packagerStatusIndicator: PackagerStatusIndicator;
private logger: OutputChannelLogger = OutputChannelLogger.getChannel(OutputChannelLogger.MAIN_CHANNEL_NAME, true);
private static JS_INJECTOR_FILENAME = "opn-main.js";
private static JS_INJECTOR_FILEPATH = path.resolve(path.dirname(path.dirname(__dirname)), "js-patched", Packager.JS_INJECTOR_FILENAME);
// old name for RN < 0.60.0, new for versions >= 0.60.0
private static JS_INJECTOR_FILENAME = {
new: "open-main.js",
old: "opn-main.js",
};
private static RN_VERSION_WITH_OPEN_PKG = "0.60.0";
private static JS_INJECTOR_DIRPATH = path.resolve(path.dirname(path.dirname(__dirname)), "js-patched");
private static NODE_MODULES_FODLER_NAME = "node_modules";
private static OPN_PACKAGE_NAME = "opn";
private static OPN_PACKAGE_NAME = {
new: "open",
old: "opn",
};
private static REACT_NATIVE_PACKAGE_NAME = "react-native";
private static OPN_PACKAGE_MAIN_FILENAME = "index.js";
private static fs: FileSystem = new Node.FileSystem();
@ -111,12 +118,12 @@ export class Packager {
executedStartPackagerCmd = true;
return this.monkeyPatchOpnForRNPackager()
.then(() => {
return ReactNativeProjectHelper.getReactNativeVersion(this.projectPath);
})
return ReactNativeProjectHelper.getReactNativeVersion(this.projectPath)
.then((version) => {
rnVersion = version;
return this.monkeyPatchOpnForRNPackager(rnVersion);
})
.then((version) => {
return this.getPackagerArgs(rnVersion, resetCache);
})
.then((args) => {
@ -267,13 +274,19 @@ export class Packager {
return pu.retryAsync(() => this.isRunning(), (running) => running, retryCount, delay, localize("CouldNotStartPackager", "Could not start the packager."));
}
private findOpnPackage(): Q.Promise<string> {
private findOpnPackage(ReactNativeVersion: string): Q.Promise<string> {
try {
let OPN_PACKAGE_NAME: string;
if (semver.gte(ReactNativeVersion, Packager.RN_VERSION_WITH_OPEN_PKG)) {
OPN_PACKAGE_NAME = Packager.OPN_PACKAGE_NAME.new;
} else {
OPN_PACKAGE_NAME = Packager.OPN_PACKAGE_NAME.old;
}
let flatDependencyPackagePath = path.resolve(this.projectPath, Packager.NODE_MODULES_FODLER_NAME,
Packager.OPN_PACKAGE_NAME, Packager.OPN_PACKAGE_MAIN_FILENAME);
OPN_PACKAGE_NAME, Packager.OPN_PACKAGE_MAIN_FILENAME);
let nestedDependencyPackagePath = path.resolve(this.projectPath, Packager.NODE_MODULES_FODLER_NAME,
Packager.REACT_NATIVE_PACKAGE_NAME, Packager.NODE_MODULES_FODLER_NAME, Packager.OPN_PACKAGE_NAME, Packager.OPN_PACKAGE_MAIN_FILENAME);
Packager.REACT_NATIVE_PACKAGE_NAME, Packager.NODE_MODULES_FODLER_NAME, OPN_PACKAGE_NAME, Packager.OPN_PACKAGE_MAIN_FILENAME);
let fsHelper = new Node.FileSystem();
@ -290,24 +303,32 @@ export class Packager {
}
}
private monkeyPatchOpnForRNPackager(): Q.Promise<void> {
private monkeyPatchOpnForRNPackager(ReactNativeVersion: string): Q.Promise<void> {
let opnPackage: Package;
let destnFilePath: string;
// Finds the 'opn' package
return this.findOpnPackage()
// Finds the 'opn' or 'open' package
return this.findOpnPackage(ReactNativeVersion)
.then((opnIndexFilePath) => {
destnFilePath = opnIndexFilePath;
// Read the package's "package.json"
opnPackage = new Package(path.resolve(path.dirname(destnFilePath)));
return opnPackage.parsePackageInformation();
}).then((packageJson) => {
if (packageJson.main !== Packager.JS_INJECTOR_FILENAME) {
let JS_INJECTOR_FILEPATH: string;
let JS_INJECTOR_FILENAME: string;
if (semver.gte(ReactNativeVersion, Packager.RN_VERSION_WITH_OPEN_PKG)) {
JS_INJECTOR_FILENAME = Packager.JS_INJECTOR_FILENAME.new;
} else {
JS_INJECTOR_FILENAME = Packager.JS_INJECTOR_FILENAME.old;
}
JS_INJECTOR_FILEPATH = path.resolve(Packager.JS_INJECTOR_DIRPATH, JS_INJECTOR_FILENAME);
if (packageJson.main !== JS_INJECTOR_FILENAME) {
// Copy over the patched 'opn' main file
return new Node.FileSystem().copyFile(Packager.JS_INJECTOR_FILEPATH, path.resolve(path.dirname(destnFilePath), Packager.JS_INJECTOR_FILENAME))
return new Node.FileSystem().copyFile(JS_INJECTOR_FILEPATH, path.resolve(path.dirname(destnFilePath), JS_INJECTOR_FILENAME))
.then(() => {
// Write/over-write the "main" attribute with the new file
return opnPackage.setMainFile(Packager.JS_INJECTOR_FILENAME);
return opnPackage.setMainFile(JS_INJECTOR_FILENAME);
});
}
return Q.resolve(void 0);

Просмотреть файл

@ -44,7 +44,7 @@ export class IOSPlatform extends GeneralMobilePlatform {
errorCode: InternalErrorCode.IOSDeployNotFound,
}];
private static RUN_IOS_SUCCESS_PATTERNS = ["BUILD SUCCEEDED"];
private static readonly RUN_IOS_SUCCESS_PATTERNS = ["BUILD SUCCEEDED"];
public showDevMenu(deviceId?: string): Q.Promise<void> {
return IOSPlatform.remote(this.runOptions.projectRoot).showDevMenu(deviceId);
@ -100,8 +100,13 @@ export class IOSPlatform extends GeneralMobilePlatform {
if (!semver.valid(version) /*Custom RN implementations should support this flag*/ || semver.gte(version, IOSPlatform.NO_PACKAGER_VERSION)) {
this.runArguments.push("--no-packager");
}
// Since @react-native-community/cli@2.1.0 build output are hidden by default
// we are using `--verbose` to show it as it contains `BUILD SUCCESSFUL` and other patterns
if (semver.gte(version, "0.60.0")) {
this.runArguments.push("--verbose");
}
const runIosSpawn = new CommandExecutor(this.projectPath, this.logger).spawnReactCommand("run-ios", this.runArguments, {env});
return new OutputVerifier(() => this.generateSuccessPatterns(), () => Q(IOSPlatform.RUN_IOS_FAILURE_PATTERNS), "ios")
return new OutputVerifier(() => this.generateSuccessPatterns(version), () => Q(IOSPlatform.RUN_IOS_FAILURE_PATTERNS), "ios")
.process(runIosSpawn);
});
});
@ -196,12 +201,28 @@ export class IOSPlatform extends GeneralMobilePlatform {
return runArguments;
}
private generateSuccessPatterns(): Q.Promise<string[]> {
return this.targetType === IOSPlatform.deviceString ?
Q(IOSPlatform.RUN_IOS_SUCCESS_PATTERNS.concat("INSTALLATION SUCCEEDED")) :
this.getBundleId()
.then(bundleId => IOSPlatform.RUN_IOS_SUCCESS_PATTERNS
.concat([`Launching ${bundleId}\n${bundleId}: `]));
private generateSuccessPatterns(version: string): Q.Promise<string[]> {
// Clone RUN_IOS_SUCCESS_PATTERNS to avoid its runtime mutation
let successPatterns = [...IOSPlatform.RUN_IOS_SUCCESS_PATTERNS];
if (this.targetType === IOSPlatform.deviceString) {
if (semver.gte(version, "0.60.0")) {
successPatterns.push("success Installed the app on the device");
} else {
successPatterns.push("INSTALLATION SUCCEEDED");
}
return Q(successPatterns);
} else {
return this.getBundleId()
.then(bundleId => {
if (semver.gte(version, "0.60.0")) {
successPatterns.push(`Launching "${bundleId}"\nsuccess Successfully launched the app `);
} else {
successPatterns.push(`Launching ${bundleId}\n${bundleId}: `);
}
return successPatterns;
});
}
}
private getConfiguration(): string {

Просмотреть файл

@ -32,7 +32,7 @@ export class PlistBuddy {
if (semver.gte(rnVersion, "0.59.0")) {
if (!scheme) {
// If no scheme were provided via runOptions.scheme or via runArguments then try to get scheme using the way RN CLI does.
scheme = this.getInferredScheme(projectRoot);
scheme = this.getInferredScheme(projectRoot, rnVersion);
}
productsFolder = path.join(iosProjectRoot, "build", scheme, "Build", "Products");
} else {
@ -81,8 +81,8 @@ export class PlistBuddy {
return this.invokePlistBuddy(`Print ${property}`, plistFile);
}
public getInferredScheme(projectRoot: string) {
// Portion of code was taken from https://github.com/react-native-community/react-native-cli/blob/master/packages/cli/src/commands/runIOS/runIOS.js
public getInferredScheme(projectRoot: string, rnVersion: string) {
// Portion of code was taken from https://github.com/react-native-community/cli/blob/master/packages/platform-ios/src/commands/runIOS/index.js
// and modified a little bit
/**
* Copyright (c) Facebook, Inc. and its affiliates.
@ -93,7 +93,13 @@ export class PlistBuddy {
* @flow
* @format
*/
const findXcodeProject = require(path.join(projectRoot, "node_modules/@react-native-community/cli/build/commands/runIOS/findXcodeProject")).default;
let iOSCliFolderName: string;
if (semver.gte(rnVersion, "0.60.0")) {
iOSCliFolderName = "cli-platform-ios";
} else {
iOSCliFolderName = "cli";
}
const findXcodeProject = require(path.join(projectRoot, `node_modules/@react-native-community/${iOSCliFolderName}/build/commands/runIOS/findXcodeProject`)).default;
const xcodeProject = findXcodeProject(fs.readdirSync(`${projectRoot}/ios`));
if (!xcodeProject) {
throw new Error(

Просмотреть файл

@ -0,0 +1,51 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
* @lint-ignore-every XPLATJSCOPYRIGHT1
*/
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
android:
'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
});
type Props = {};
export default class App extends Component<Props> {
render() {
console.log('Test output from debuggee');
return (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to React Native!</Text>
<Text style={styles.instructions}>To get started, edit App.js</Text>
<Text style={styles.instructions}>{instructions}</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});

Просмотреть файл

@ -4,48 +4,81 @@
*
* @format
* @flow
* @lint-ignore-every XPLATJSCOPYRIGHT1
*/
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
import React, {Fragment} from 'react';
import { SafeAreaView, StyleSheet, ScrollView, View, Text, StatusBar } from 'react-native';
import { Header, LearnMoreLinks, Colors, DebugInstructions, ReloadInstructions } from 'react-native/Libraries/NewAppScreen';
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
android:
'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
});
type Props = {};
export default class App extends Component<Props> {
render() {
console.log('Test output from debuggee');
return (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to React Native!</Text>
<Text style={styles.instructions}>To get started, edit App.js</Text>
<Text style={styles.instructions}>{instructions}</Text>
</View>
);
}
}
const App = () => {
console.log('Test output from debuggee');
return (
<Fragment>
<StatusBar barStyle="dark-content" />
<SafeAreaView>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={styles.scrollView}>
<Header />
<View style={styles.body}>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>Step One</Text>
<Text style={styles.sectionDescription}>
Edit <Text style={styles.highlight}>App.js</Text> to change this
screen and then come back to see your edits.
</Text>
</View>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>See Your Changes</Text>
<Text style={styles.sectionDescription}>
<ReloadInstructions />
</Text>
</View>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>Debug</Text>
<Text style={styles.sectionDescription}>
<DebugInstructions />
</Text>
</View>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>Learn More</Text>
<Text style={styles.sectionDescription}>
Read the docs to discover what to do next:
</Text>
</View>
<LearnMoreLinks />
</View>
</ScrollView>
</SafeAreaView>
</Fragment>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
scrollView: {
backgroundColor: Colors.lighter,
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
body: {
backgroundColor: Colors.white,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
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',
},
});
export default App;

Просмотреть файл

@ -17,6 +17,9 @@ const EXPO_APP_PACKAGE_NAME = SetupEnvironmentHelper.expoPackageName;
const EXPO_APP_ACTIVITY_NAME = `${EXPO_APP_PACKAGE_NAME}.experience.HomeActivity`;
const RNDebugConfigName = "Debug Android";
const ExpoDebugConfigName = "Debug in Exponent";
const RNSetBreakpointOnLine = 14;
const ExpoSetBreakpointOnLine = 16;
const PureRNExpoSetBreakpointOnLine = 23;
// Time for Android Debug Test before it reaches timeout
const debugAndroidTestTime = SmokeTestsConstants.androidAppBuildAndInstallTimeout + 100 * 1000;
// Time for Android Expo Debug Test before it reaches timeout
@ -42,8 +45,8 @@ export function setup(testParameters?: TestRunArguments) {
await app.workbench.explorer.openFile("App.js");
await app.runCommand("cursorTop");
console.log("Android Debug test: App.js file is opened");
await app.workbench.debug.setBreakpointOnLine(23);
console.log("Android Debug test: Breakpoint is set on line 23");
await app.workbench.debug.setBreakpointOnLine(RNSetBreakpointOnLine);
console.log(`Android Debug test: Breakpoint is set on line ${RNSetBreakpointOnLine}`);
await app.workbench.debug.openDebugViewlet();
await app.workbench.debug.chooseDebugConfiguration(RNDebugConfigName);
console.log(`Android Debug test: Chosen debug configuration: ${RNDebugConfigName}`);
@ -56,7 +59,7 @@ export function setup(testParameters?: TestRunArguments) {
await AppiumHelper.enableRemoteDebugJS(clientInited, Platform.Android);
await app.workbench.debug.waitForDebuggingToStart();
console.log("Android Debug test: Debugging started");
await app.workbench.debug.waitForStackFrame(sf => sf.name === "App.js" && sf.lineNumber === 23, "looking for App.js and line 23");
await app.workbench.debug.waitForStackFrame(sf => sf.name === "App.js" && sf.lineNumber === RNSetBreakpointOnLine, `looking for App.js and line ${RNSetBreakpointOnLine}`);
console.log("Android Debug test: Stack frame found");
await app.workbench.debug.continue();
// await for our debug string renders in debug console
@ -80,8 +83,8 @@ export function setup(testParameters?: TestRunArguments) {
await app.workbench.explorer.openFile("App.js");
await app.runCommand("cursorTop");
console.log("Android Expo Debug test: App.js file is opened");
await app.workbench.debug.setBreakpointOnLine(16);
console.log("Android Expo Debug test: Breakpoint is set on line 12");
await app.workbench.debug.setBreakpointOnLine(ExpoSetBreakpointOnLine);
console.log(`Android Expo Debug test: Breakpoint is set on line ${ExpoSetBreakpointOnLine}`);
await app.workbench.debug.openDebugViewlet();
console.log(`Android Expo Debug test: Chosen debug configuration: ${ExpoDebugConfigName}`);
await app.workbench.debug.chooseDebugConfiguration(ExpoDebugConfigName);
@ -111,7 +114,7 @@ export function setup(testParameters?: TestRunArguments) {
await AppiumHelper.enableRemoteDebugJS(clientInited, Platform.Android);
await app.workbench.debug.waitForDebuggingToStart();
console.log("Android Expo Debug test: Debugging started");
await app.workbench.debug.waitForStackFrame(sf => sf.name === "App.js" && sf.lineNumber === 16, "looking for App.js and line 16");
await app.workbench.debug.waitForStackFrame(sf => sf.name === "App.js" && sf.lineNumber === ExpoSetBreakpointOnLine, `looking for App.js and line ${ExpoSetBreakpointOnLine}`);
console.log("Android Expo Debug test: Stack frame found");
await app.workbench.debug.continue();
// Wait for debug string to be rendered in debug console
@ -135,8 +138,8 @@ export function setup(testParameters?: TestRunArguments) {
await app.workbench.explorer.openFile("App.js");
await app.runCommand("cursorTop");
console.log("Android pure RN Expo test: App.js file is opened");
await app.workbench.debug.setBreakpointOnLine(23);
console.log("Android pure RN Expo test: Breakpoint is set on line 23");
await app.workbench.debug.setBreakpointOnLine(PureRNExpoSetBreakpointOnLine);
console.log(`Android pure RN Expo test: Breakpoint is set on line ${PureRNExpoSetBreakpointOnLine}`);
await app.workbench.debug.openDebugViewlet();
console.log(`Android pure RN Expo test: Chosen debug configuration: ${ExpoDebugConfigName}`);
await app.workbench.debug.chooseDebugConfiguration(ExpoDebugConfigName);
@ -164,7 +167,7 @@ export function setup(testParameters?: TestRunArguments) {
await AppiumHelper.enableRemoteDebugJS(clientInited, Platform.Android);
await app.workbench.debug.waitForDebuggingToStart();
console.log("Android pure RN Expo test: Debugging started");
await app.workbench.debug.waitForStackFrame(sf => sf.name === "App.js" && sf.lineNumber === 23, "looking for App.js and line 23");
await app.workbench.debug.waitForStackFrame(sf => sf.name === "App.js" && sf.lineNumber === PureRNExpoSetBreakpointOnLine, `looking for App.js and line ${PureRNExpoSetBreakpointOnLine}`);
console.log("Android pure RN Expo test: Stack frame found");
await app.workbench.debug.continue();
// Wait for debug string to be rendered in debug console

Просмотреть файл

@ -15,6 +15,9 @@ import { TestRunArguments } from "./helpers/configHelper";
const RnAppBundleId = "org.reactjs.native.example.latestRNApp";
const RNDebugConfigName = "Debug iOS";
const ExpoDebugConfigName = "Debug in Exponent";
const RNSetBreakpointOnLine = 14;
const ExpoSetBreakpointOnLine = 16;
const PureRNExpoSetBreakpointOnLine = 23;
// Time for OS Debug Test before it reaches timeout
const debugIosTestTime = SmokeTestsConstants.iosAppBuildAndInstallTimeout + 100 * 1000;
// Time for iOS Expo Debug Test before it reaches timeout
@ -40,8 +43,8 @@ export function setup(testParameters?: TestRunArguments) {
await app.workbench.explorer.openFile("App.js");
await app.runCommand("cursorTop");
console.log("iOS Debug test: App.js file is opened");
await app.workbench.debug.setBreakpointOnLine(23);
console.log("iOS Debug test: Breakpoint is set on line 23");
await app.workbench.debug.setBreakpointOnLine(RNSetBreakpointOnLine);
console.log(`iOS Debug test: Breakpoint is set on line ${RNSetBreakpointOnLine}`);
await app.workbench.debug.openDebugViewlet();
await app.workbench.debug.chooseDebugConfiguration(RNDebugConfigName);
console.log(`iOS Debug test: Chosen debug configuration: ${RNDebugConfigName}`);
@ -62,7 +65,7 @@ export function setup(testParameters?: TestRunArguments) {
}
await app.workbench.debug.waitForDebuggingToStart();
console.log("iOS Debug test: Debugging started");
await app.workbench.debug.waitForStackFrame(sf => sf.name === "App.js" && sf.lineNumber === 23, "looking for App.js and line 23");
await app.workbench.debug.waitForStackFrame(sf => sf.name === "App.js" && sf.lineNumber === RNSetBreakpointOnLine, `looking for App.js and line ${RNSetBreakpointOnLine}`);
console.log("iOS Debug test: Stack frame found");
await app.workbench.debug.continue();
// Wait for our debug string to render in debug console
@ -86,8 +89,8 @@ export function setup(testParameters?: TestRunArguments) {
await app.workbench.explorer.openFile("App.js");
await app.runCommand("cursorTop");
console.log("iOS Expo Debug test: App.js file is opened");
await app.workbench.debug.setBreakpointOnLine(16);
console.log("iOS Expo Debug test: Breakpoint is set on line 12");
await app.workbench.debug.setBreakpointOnLine(ExpoSetBreakpointOnLine);
console.log(`iOS Expo Debug test: Breakpoint is set on line ${ExpoSetBreakpointOnLine}`);
await app.workbench.debug.openDebugViewlet();
console.log(`iOS Expo Debug test: Chosen debug configuration: ${ExpoDebugConfigName}`);
await app.workbench.debug.chooseDebugConfiguration(ExpoDebugConfigName);
@ -130,7 +133,7 @@ export function setup(testParameters?: TestRunArguments) {
}
await app.workbench.debug.waitForDebuggingToStart();
console.log("iOS Expo Debug test: Debugging started");
await app.workbench.debug.waitForStackFrame(sf => sf.name === "App.js" && sf.lineNumber === 16, "looking for App.js and line 16");
await app.workbench.debug.waitForStackFrame(sf => sf.name === "App.js" && sf.lineNumber === ExpoSetBreakpointOnLine, `looking for App.js and line ${ExpoSetBreakpointOnLine}`);
console.log("iOS Expo Debug test: Stack frame found");
await app.workbench.debug.continue();
// Wait for our debug string to render in debug console
@ -154,8 +157,8 @@ export function setup(testParameters?: TestRunArguments) {
await app.workbench.explorer.openFile("App.js");
await app.runCommand("cursorTop");
console.log("iOS pure RN Expo test: App.js file is opened");
await app.workbench.debug.setBreakpointOnLine(23);
console.log("iOS pure RN Expo test: Breakpoint is set on line 23");
await app.workbench.debug.setBreakpointOnLine(PureRNExpoSetBreakpointOnLine);
console.log(`iOS pure RN Expo test: Breakpoint is set on line ${PureRNExpoSetBreakpointOnLine}`);
await app.workbench.debug.openDebugViewlet();
console.log(`iOS pure RN Expo test: Chosen debug configuration: ${ExpoDebugConfigName}`);
await app.workbench.debug.chooseDebugConfiguration(ExpoDebugConfigName);
@ -198,7 +201,7 @@ export function setup(testParameters?: TestRunArguments) {
}
await app.workbench.debug.waitForDebuggingToStart();
console.log("iOS pure RN Expo test: Debugging started");
await app.workbench.debug.waitForStackFrame(sf => sf.name === "App.js" && sf.lineNumber === 23, "looking for App.js and line 23");
await app.workbench.debug.waitForStackFrame(sf => sf.name === "App.js" && sf.lineNumber === PureRNExpoSetBreakpointOnLine, `looking for App.js and line ${PureRNExpoSetBreakpointOnLine}`);
console.log("iOS pure RN Expo test: Stack frame found");
await app.workbench.debug.continue();
// Wait for our debug string to render in debug console

Просмотреть файл

@ -19,7 +19,7 @@ export class SetupEnvironmentHelper {
public static expoBundleId = "host.exp.Exponent";
public static iOSExpoAppsCacheDir = `${os.homedir()}/.expo/ios-simulator-app-cache`;
public static prepareReactNativeApplication(workspaceFilePath: string, resourcesPath: string, workspacePath: string, appName: string, version?: string) {
public static prepareReactNativeApplication(workspaceFilePath: string, resourcesPath: string, workspacePath: string, appName: string, customEntryPointFolder: string, version?: string) {
let command = `react-native init ${appName}`;
if (version) {
command += ` --version ${version}`;
@ -27,7 +27,7 @@ export class SetupEnvironmentHelper {
console.log(`*** Creating RN app via '${command}' in ${workspacePath}...`);
cp.execSync(command, { cwd: resourcesPath, stdio: "inherit" });
let customEntryPointFile = path.join(resourcesPath, "ReactNativeSample", "App.js");
let customEntryPointFile = path.join(resourcesPath, customEntryPointFolder, "App.js");
let launchConfigFile = path.join(resourcesPath, "launch.json");
let vsCodeConfigPath = path.join(workspacePath, ".vscode");

Просмотреть файл

@ -169,11 +169,11 @@ async function setup(): Promise<void> {
await AndroidEmulatorHelper.runAndroidEmulator();
SetupEnvironmentHelper.prepareReactNativeApplication(RNworkspaceFilePath, resourcesPath, RNworkspacePath, SmokeTestsConstants.RNAppName);
SetupEnvironmentHelper.prepareReactNativeApplication(RNworkspaceFilePath, resourcesPath, RNworkspacePath, SmokeTestsConstants.RNAppName, "ReactNativeSample");
if (!testParams.RunBasicTests) {
SetupEnvironmentHelper.prepareExpoApplication(ExpoWorkspaceFilePath, resourcesPath, ExpoWorkspacePath, SmokeTestsConstants.ExpoAppName);
const latestRNVersionExpo = await SetupEnvironmentHelper.getLatestSupportedRNVersionForExpo();
SetupEnvironmentHelper.prepareReactNativeApplication(pureRNWorkspaceFilePath, resourcesPath, pureRNWorkspacePath, SmokeTestsConstants.pureRNExpoApp, latestRNVersionExpo);
SetupEnvironmentHelper.prepareReactNativeApplication(pureRNWorkspaceFilePath, resourcesPath, pureRNWorkspacePath, SmokeTestsConstants.pureRNExpoApp, "PureRNExpoSample", latestRNVersionExpo);
SetupEnvironmentHelper.addExpoDependencyToRNProject(pureRNWorkspacePath);
await SetupEnvironmentHelper.installExpoAppOnAndroid(ExpoWorkspacePath);
await SetupEnvironmentHelper.patchExpoApp(ExpoWorkspacePath);

Просмотреть файл

@ -361,6 +361,7 @@ export class SpectronApplication {
"up" : "ArrowUp",
"right" : "ArrowRight",
"down" : "ArrowDown",
"home": "Home",
";" : "Semicolon",
"," : "Separator",
"=" : "Equals",