From 7e5ac6b7f89e9b6bc5ad0bac1ff1ce038fc05af8 Mon Sep 17 00:00:00 2001 From: scottbommarito Date: Wed, 22 Jun 2016 17:00:24 -0700 Subject: [PATCH] another test case --- test/template/scenarios/scenarioRestart2x.js | 16 ++++++++++++ test/test.ts | 26 +++++++++++++++++--- 2 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 test/template/scenarios/scenarioRestart2x.js diff --git a/test/template/scenarios/scenarioRestart2x.js b/test/template/scenarios/scenarioRestart2x.js new file mode 100644 index 0000000..819ec3b --- /dev/null +++ b/test/template/scenarios/scenarioRestart2x.js @@ -0,0 +1,16 @@ +import CodePush from "react-native-code-push"; + +module.exports = { + startTest: function(testApp) { + CodePush.restartApp(true); + CodePushWrapper.checkAndInstall(testApp, + () => { + CodePush.restartApp(true); + } + ); + }, + + getScenarioName: function() { + return "Restart2x"; + } +}; \ No newline at end of file diff --git a/test/test.ts b/test/test.ts index e21596e..a0c6472 100644 --- a/test/test.ts +++ b/test/test.ts @@ -472,6 +472,7 @@ const ScenarioSyncResumeDelay = "scenarioSyncResumeDelay.js"; const ScenarioSyncRestartDelay = "scenarioSyncResumeDelay.js"; const ScenarioSync2x = "scenarioSync2x.js"; const ScenarioRestart = "scenarioRestart.js"; +const ScenarioRestart2x = "scenarioRestart2x.js"; const ScenarioSyncMandatoryDefault = "scenarioSyncMandatoryDefault.js"; const ScenarioSyncMandatoryResume = "scenarioSyncMandatoryResume.js"; const ScenarioSyncMandatoryRestart = "scenarioSyncMandatoryRestart.js"; @@ -989,11 +990,28 @@ PluginTestingFramework.initializeTests(new RNProjectManager(), supportedTargetPl TestBuilder.describe("#codePush.restartApplication.2x", () => { - TestBuilder.it("with pending update", false, + // TestBuilder.it("blocks when a restart is in progress and doesn't crash if there is a pending package", false, + // (done: MochaDone) => { + // ServerUtil.updateResponse = { updateInfo: ServerUtil.createUpdateResponse(false, targetPlatform) }; + // setupTestRunScenario(projectManager, targetPlatform, ScenarioInstallRestart2x) + // .then(setupUpdateScenario.bind(this, projectManager, targetPlatform, UpdateDeviceReady, "Good Update")) + // .then((updatePath: string) => { + // ServerUtil.updatePackagePath = updatePath; + // projectManager.runApplication(TestConfig.testRunDirectory, targetPlatform); + // return ServerUtil.expectTestMessages([ + // ServerUtil.TestMessage.CHECK_UPDATE_AVAILABLE, + // ServerUtil.TestMessage.DOWNLOAD_SUCCEEDED, + // ServerUtil.TestMessage.UPDATE_INSTALLED, + // ServerUtil.TestMessage.DEVICE_READY_AFTER_UPDATE]); + // }) + // .done(() => { done(); }, (e) => { done(e); }); + // }); + + TestBuilder.it("doesn't block when the restart is ignored", false, (done: MochaDone) => { ServerUtil.updateResponse = { updateInfo: ServerUtil.createUpdateResponse(false, targetPlatform) }; - - setupUpdateScenario(projectManager, targetPlatform, UpdateDeviceReady, "Update 1") + setupTestRunScenario(projectManager, targetPlatform, ScenarioRestart2x) + .then(setupUpdateScenario.bind(this, projectManager, targetPlatform, UpdateDeviceReady, "Good Update")) .then((updatePath: string) => { ServerUtil.updatePackagePath = updatePath; projectManager.runApplication(TestConfig.testRunDirectory, targetPlatform); @@ -1005,7 +1023,7 @@ PluginTestingFramework.initializeTests(new RNProjectManager(), supportedTargetPl }) .done(() => { done(); }, (e) => { done(e); }); }); - }, ScenarioInstallRestart2x); + }); TestBuilder.describe("#window.codePush.sync", () => {