forked from microsoft/react-native-code-push
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstallModeOnNextRestartTest.js
More file actions
35 lines (29 loc) · 1.56 KB
/
InstallModeOnNextRestartTest.js
File metadata and controls
35 lines (29 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"use strict";
import React from "react-native";
import { DeviceEventEmitter, Platform, AppRegistry } from "react-native";
import CodePush from "react-native-code-push";
import createTestCaseComponent from "../../utils/createTestCaseComponent";
import assert from "assert";
const NativeCodePush = React.NativeModules.CodePush;
const PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
let remotePackage = require("../resources/remotePackage");
let InstallModeOnNextRestartTest = createTestCaseComponent(
"InstallModeOnNextRestartTest",
"App should boot up the new version after it is installed and restarted",
() => {
if (Platform.OS === "android") {
// Genymotion forwards 10.0.3.2 to host machine's localhost
remotePackage.downloadUrl = "http://10.0.3.2:8081/CodePushDemoAppTests/InstallUpdateTests/resources/PassInstallModeOnNextRestartTest.includeRequire.runModule.bundle?platform=android&dev=true"
} else if (Platform.OS === "ios") {
remotePackage.downloadUrl = "http://localhost:8081/CodePushDemoAppTests/InstallUpdateTests/resources/PassInstallModeOnNextRestartTest.includeRequire.runModule.bundle?platform=ios&dev=true"
}
remotePackage = Object.assign(remotePackage, PackageMixins.remote());
},
async () => {
let localPackage = await remotePackage.download();
await localPackage.install(NativeCodePush.codePushInstallModeOnNextRestart);
CodePush.restartApp();
},
/*passAfterRun*/ false
);
AppRegistry.registerComponent("InstallModeOnNextRestartTest", () => InstallModeOnNextRestartTest);