Ejemplo n.º 1
0
        public async Task _05_CheckAndInstallUpdates_Beta()
        {
            try
            {
                VersionTuple initialVersions = this.GetVersionsFromExtractedAppFile(Apps.PackageNames.AutomaticTestsClientAppV1, TestHelpers.GetMethodName(), out FileInfo appFile);

                this.LaunchTestsAppAndGetResult <UpdateCheckResult>(appFile, Actions.HandleUpdatesWithBeta, Apps.Keys.AutomaticTestsClient, waitForExit: false);

                Window updateNowMsgBox =
                    await TestHelpers.WaitForWindowAsync(x => x.Equals("AutomaticTestsClient update installation"), TimeSpan.FromMinutes(1)).ConfigureAwait(false);

                updateNowMsgBox.Get <Button>(SearchCriteria.ByText("Yes")).Click();

                Window updater = await TestHelpers.WaitForWindowAsync(x => x.Contains("AutomaticTestsClient Updater"), TimeSpan.FromMinutes(1)).ConfigureAwait(false);

                updater.Get <Button>(SearchCriteria.ByText("Install now!")).Click();

                Window doneMsg = await TestHelpers.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);
            }
        }
Ejemplo n.º 2
0
        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);

                UpdateCheckResult result = this.LaunchTestsAppAndGetResult <UpdateCheckResult>(Apps.Paths.InstallersTestAppMsi3, Actions.CheckAndInstallUpdates, Apps.Keys.InstallersTestAppMsi3);
                Assert.IsNull(result.Exception);
                Window updater = await TestHelpers.WaitForWindowAsync(x => x.Contains("InstallersTestApp.Msi3Installer"), TimeSpan.FromMinutes(1)).ConfigureAwait(false);

                updater.Get <Button>(SearchCriteria.ByText("OK")).Click();


                this.VerifyVersionsAreUpdatedAfterInstallation(initialVersions);


                //now just assert that the update check result is empty next time
                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);
            }
        }
Ejemplo n.º 3
0
        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;
                    }
                }
            }
        }
Ejemplo n.º 4
0
        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));
        }