public async Task _04_MsiCheckAndInstallUpdates() { this.ProductCodesTest_InstallersTestAppMsi3(); //sanity check to save time try { this.UninstallPackages(Apps.ProductCodes.InstallersTestAppMsi3V1, Apps.ProductCodes.InstallersTestAppMsi3V2); VersionTuple initialVersions = this.GetVersionsFromMsiApp(Apps.PackageNames.InstallersTestAppMsi3V1, Apps.Paths.InstallersTestAppMsi3, Apps.ProductCodes.InstallersTestAppMsi3V1); Log("Read initial versions"); UpdateCheckResult result = this.LaunchTestsAppAndGetResult <UpdateCheckResult>(Apps.Paths.InstallersTestAppMsi3, Actions.CheckAndInstallUpdates, Apps.Keys.InstallersTestAppMsi3); Assert.IsNull(result.Exception); Window updater = await WindowHelpers.WaitForWindowAsync(x => x.Contains("InstallersTestApp.Msi3Installer"), TimeSpan.FromMinutes(1)).ConfigureAwait(false); updater.Get <Button>(SearchCriteria.ByText("OK")).Click(); Log("Clicked OK"); this.VerifyVersionsAreUpdatedAfterInstallation(initialVersions); //now just assert that the update check result is empty next time Log("Checking update info is false"); result = this.LaunchTestsAppAndGetResult <UpdateCheckResult>(Apps.Paths.InstallersTestAppMsi3, Actions.CheckAndInstallUpdates, Apps.Keys.InstallersTestAppMsi3); this.AssertNoNonBetaUpdatesToInstall(result, false); this.UninstallPackages(Apps.ProductCodes.InstallersTestAppMsi3V1, Apps.ProductCodes.InstallersTestAppMsi3V2); } catch (Exception ex) { throw this.CleanupAndRethrow(ex); } }
private void VerifyVersionsAreUpdatedAfterInstallation(VersionTuple initialVersions) { int i = 0; while (true) { i++; Thread.Sleep(1000 * i * 2); VersionTuple newVersions = this.GetVersionsFromFile(Apps.Paths.InstallersTestAppMsi3); try { Assert.IsTrue(newVersions.AssemblyVersion.IsNewerVersionThan(initialVersions.AssemblyVersion) , $"Version don't match. Initial AssVer: {initialVersions.AssemblyVersion}. New {newVersions.AssemblyVersion}"); Assert.IsTrue(newVersions.FileVersion.IsNewerVersionThan(initialVersions.FileVersion), $"Version don't match. Initial FileVer: {initialVersions.AssemblyVersion}. New {newVersions.AssemblyVersion}"); return; } catch (Exception) { if (i > 4) { throw; } } } }
public async Task _05_CheckAndInstallUpdates_Beta() { try { VersionTuple initialVersions = this.GetVersionsFromExtractedAppFile(Apps.PackageNames.AutomaticTestsClientAppV1, SharedTestHelpers.GetMethodName(), out FileInfo appFile); this.LaunchTestsAppAndGetResult <UpdateCheckResult>(appFile, Actions.HandleUpdatesWithBeta, Apps.Keys.AutomaticTestsClient, waitForExit: false); await this.PerformManualUpdate("AutomaticTestsClient", "3."); VersionTuple newVersions = this.GetVersionsFromFile(appFile); Log($"New versions: {newVersions.ToLog()}"); this.AssertVersionAreCorrect(newVersions, initialVersions, appFile, "3."); //now just assert that the update check result is empty next time Log("Checking update info is false"); UpdateCheckResult result = this.LaunchTestsAppAndGetResult <UpdateCheckResult>(appFile, Actions.CheckAndInstallUpdates, Apps.Keys.AutomaticTestsClient, waitForExit: true); this.AssertNoNonBetaUpdatesToInstall(result, false); } catch (Exception ex) { this.CleanupAndLog(ex); throw; } }
public async Task _05_CheckAndInstallUpdates_Beta() { try { VersionTuple initialVersions = this.GetVersionsFromExtractedAppFile(Apps.PackageNames.AutomaticTestsClientAppV1, SharedTestHelpers.GetMethodName(), out FileInfo appFile); this.LaunchTestsAppAndGetResult <UpdateCheckResult>(appFile, Actions.HandleUpdatesWithBeta, Apps.Keys.AutomaticTestsClient, waitForExit: false); Window updateNowMsgBox = await WindowHelpers.WaitForWindowAsync(x => x.Equals("AutomaticTestsClient update installation"), TimeSpan.FromMinutes(1)).ConfigureAwait(false); updateNowMsgBox.Get <Button>(SearchCriteria.ByText("Yes")).Click(); Window updater = await WindowHelpers.WaitForWindowAsync(x => x.Contains("AutomaticTestsClient Updater"), TimeSpan.FromMinutes(1)).ConfigureAwait(false); updater.Get <Button>(SearchCriteria.ByText("Install now!")).Click(); Window doneMsg = await WindowHelpers.WaitForMessageBoxAsync(updater, "Update complete", TimeSpan.FromMinutes(1)).ConfigureAwait(false); doneMsg.Get <Button>(SearchCriteria.ByText("No")).Click(); VersionTuple newVersions = this.GetVersionsFromFile(appFile); await this.AssertVersionAreCorrect(newVersions, initialVersions, appFile, "3.").ConfigureAwait(false); //now just assert that the update check result is empty next time UpdateCheckResult result = this.LaunchTestsAppAndGetResult <UpdateCheckResult>(appFile, Actions.CheckAndInstallUpdates, Apps.Keys.AutomaticTestsClient, waitForExit: true); this.AssertNoNonBetaUpdatesToInstall(result, false); } catch (Exception ex) { throw this.CleanupAndRethrow(ex); } }
public VersionTuple GetVersionsFromApp(FileInfo exe) { Log($"Reading versions from [{exe.FullName}]"); var versionTuple = new VersionTuple(); versionTuple.AssemblyVersion = TelimenaVersionReader.Read(exe, VersionTypes.AssemblyVersion).ToString(); versionTuple.FileVersion = TelimenaVersionReader.Read(exe, VersionTypes.FileVersion).ToString(); return(versionTuple); }
private async Task AssertVersionAreCorrect(VersionTuple newVersions, VersionTuple initialVersions, FileInfo appFile, string newVersionStartingPart) { Assert.IsTrue(newVersions.AssemblyVersion.IsNewerVersionThan(initialVersions.AssemblyVersion)); Assert.IsTrue(newVersions.FileVersion.IsNewerVersionThan(initialVersions.FileVersion)); VersionTuple postUpdateVersions = this.GetVersionsFromFile(appFile); Assert.AreEqual(postUpdateVersions.AssemblyVersion, newVersions.AssemblyVersion); Assert.AreEqual(postUpdateVersions.FileVersion, newVersions.FileVersion); Assert.IsTrue(newVersions.AssemblyVersion.StartsWith(newVersionStartingPart)); Assert.IsTrue(newVersions.FileVersion.StartsWith(newVersionStartingPart)); }
private void AssertVersionAreCorrect(VersionTuple newVersions, VersionTuple initialVersions, FileInfo appFile, string newVersionStartingPart) { Log("Initial versions\r\n" + initialVersions.GetPropertyInfoString()); Log("New versions\r\n" + newVersions.GetPropertyInfoString()); Assert.IsTrue(Extensions.IsNewerVersionThan(newVersions.AssemblyVersion, initialVersions.AssemblyVersion), $"New assembly version {newVersions.AssemblyVersion} is not newer than initial assembly version {initialVersions.AssemblyVersion}"); Assert.IsTrue(Extensions.IsNewerVersionThan(newVersions.FileVersion, initialVersions.FileVersion), $"New file version {newVersions.FileVersion} is not newer than initial file version {initialVersions.FileVersion}"); VersionTuple postUpdateVersions = this.GetVersionsFromFile(appFile); Log("PostUpdate versions\r\n" + postUpdateVersions.GetPropertyInfoString()); Assert.AreEqual(postUpdateVersions.AssemblyVersion, newVersions.AssemblyVersion, $"Post update assembly version {postUpdateVersions.AssemblyVersion} is equal to 'new' assembly version {newVersions.AssemblyVersion}"); Assert.AreEqual(postUpdateVersions.FileVersion, newVersions.FileVersion, $"Post update file version {postUpdateVersions.FileVersion} is equal to 'new' file version {newVersions.FileVersion}"); Assert.IsTrue(newVersions.AssemblyVersion.StartsWith(newVersionStartingPart), $"{newVersions.AssemblyVersion}.StartsWith({newVersionStartingPart})"); Assert.IsTrue(newVersions.FileVersion.StartsWith(newVersionStartingPart), $"{newVersions.FileVersion}.StartsWith({newVersionStartingPart})"); }
public async Task _02_HandleUpdates_NonBeta() { try { VersionTuple initialVersions = await this.GetVersionsFromApp(Apps.PackageNames.AutomaticTestsClientAppV1, SharedTestHelpers.GetMethodName()).ConfigureAwait(false); UpdateCheckResult result = this.LaunchTestsAppNewInstanceAndGetResult <UpdateCheckResult>(out FileInfo appFile, Actions.HandleUpdates, Apps.Keys.AutomaticTestsClient, Apps.PackageNames.AutomaticTestsClientAppV1 , SharedTestHelpers.GetMethodName(), waitForExit: false); Window updateNowMsgBox = await WindowHelpers.WaitForWindowAsync(x => x.Equals("AutomaticTestsClient update installation"), TimeSpan.FromMinutes(1)).ConfigureAwait(false); this.CheckProperUpdateVersionDownloadedInMessageBo(updateNowMsgBox, "2."); updateNowMsgBox.Get <Button>(SearchCriteria.ByText("Yes")).Click(); Log("Clicked yes"); Window updater = await WindowHelpers.WaitForWindowAsync(x => x.Contains("AutomaticTestsClient Updater"), TimeSpan.FromMinutes(1)).ConfigureAwait(false); updater.Get <Button>(SearchCriteria.ByText("Install now!")).Click(); Log("Clicked Install now!"); Window doneMsg = await WindowHelpers.WaitForMessageBoxAsync(updater, "Update complete", TimeSpan.FromMinutes(1)).ConfigureAwait(false); doneMsg.Get <Button>(SearchCriteria.ByText("Yes")).Click(); Log("Clicked yes"); Window appWarning = await WindowHelpers.WaitForWindowAsync(x => x.Equals("AutomaticTestsClient - This app requires arguments to run") , TimeSpan.FromMinutes(2)).ConfigureAwait(false); Log("Reading versions"); VersionTuple newVersions = await this.GetVersionFromMsgBox(appWarning).ConfigureAwait(false); this.AssertVersionAreCorrect(newVersions, initialVersions, appFile, "2."); Log("Checking update info is false"); //now just assert that the update check result is empty next time result = this.LaunchTestsAppAndGetResult <UpdateCheckResult>(appFile, Actions.CheckAndInstallUpdates, Apps.Keys.AutomaticTestsClient, waitForExit: true); this.AssertNoNonBetaUpdatesToInstall(result, true); } catch (Exception ex) { throw this.CleanupAndRethrow(ex); } }
public async Task _03_CheckAndInstallUpdates_NonBeta() { try { VersionTuple initialVersions = this.GetVersionsFromExtractedAppFile(Apps.PackageNames.AutomaticTestsClientAppV1, SharedTestHelpers.GetMethodName(), out FileInfo appFile); var installationResult = this.LaunchTestsAppAndGetResult <UpdateInstallationResult>(appFile, Actions.CheckAndInstallUpdates, Apps.Keys.AutomaticTestsClient, waitForExit: false); if (installationResult?.Exception != null) { throw installationResult.Exception; } Window updater = await WindowHelpers.WaitForWindowAsync(x => x.Contains("AutomaticTestsClient Updater"), TimeSpan.FromMinutes(1)).ConfigureAwait(false); this.CheckProperUpdateVersionDownloadedInUpdater(updater, "2."); WindowHelpers.ClickButtonByText(updater, "Install now!"); Log("Clicked Install now!"); Window doneMsg = await WindowHelpers.WaitForMessageBoxAsync(updater, "Update complete", TimeSpan.FromMinutes(1)).ConfigureAwait(false); WindowHelpers.ClickButtonByText(doneMsg, "Yes"); Log("Clicked yes"); VersionTuple newVersions = this.GetVersionsFromApp(appFile); Log($"New versions: {newVersions.ToLog()}"); this.AssertVersionAreCorrect(newVersions, initialVersions, appFile, "2."); //now just assert that the update check result is empty next time Log("Checking update info is false"); UpdateCheckResult result = this.LaunchTestsAppAndGetResult <UpdateCheckResult>(appFile, Actions.CheckAndInstallUpdates, Apps.Keys.AutomaticTestsClient, waitForExit: true); this.AssertNoNonBetaUpdatesToInstall(result, true); } catch (Exception ex) { this.CleanupAndLog(ex); throw; } }