예제 #1
0
        public void AppiumWinAppDriverTest()
        {
            string testString = "A test this is";

            NotepadApplication = new NotepadPageModel(this.TestObject);
            NotepadApplication.TextEditor.SendKeys(testString);

            this.SoftAssert.Assert(() => Assert.AreEqual(this.Log, NotepadApplication.GetLogger(), "Expected same logger"));
            this.SoftAssert.Assert(() => Assert.AreEqual(this.PerfTimerCollection, NotepadApplication.GetPerfTimerCollection(), "Expected same perf collection"));
            this.SoftAssert.Assert(() => Assert.AreEqual(this.AppiumDriver, NotepadApplication.GetAppiumDriver(), "Expected same logger"));

            this.SoftAssert.Assert(() => Assert.IsTrue(NotepadApplication.IsPageLoaded(), "Expect page is loaded"));
            this.SoftAssert.Assert(() => Assert.IsTrue(NotepadApplication.TextEditor.Enabled, "Expect enabled"));
            this.SoftAssert.Assert(() => Assert.IsTrue(NotepadApplication.TextEditor.Displayed, "Expect displayed"));
            this.SoftAssert.Assert(() => Assert.IsFalse(NotepadApplication.DontSave.ExistsNow, "Expect not to exist now"));

            this.SoftAssert.Assert(() => Assert.AreEqual(testString, this.AppiumDriver.FindElement(MobileBy.Name("Text Editor")).Text));

            NotepadApplication.OverrideDriver(null);
            this.SoftAssert.Assert(() => Assert.AreEqual(null, NotepadApplication.GetAppiumDriver()));

            NotepadApplication.OverrideDriver(this.AppiumDriver);

            this.SoftAssert.FailTestIfAssertFailed();
        }
예제 #2
0
        /// <summary>
        /// Cleanup after application
        /// </summary>
        protected override void BeforeCleanup(TestResultType resultType)
        {
            // Make sure we get all the logging info
            base.BeforeCleanup(resultType);

            // Cleanup after the app
            NotepadApplication?.CloseAndDontSave();
            NotepadApplication = null;
        }