diff --git a/ApplicationUnderTests/AppUIBasics/UpgradeLog.htm b/ApplicationUnderTests/AppUIBasics/UpgradeLog.htm new file mode 100644 index 00000000..ca7461b6 Binary files /dev/null and b/ApplicationUnderTests/AppUIBasics/UpgradeLog.htm differ diff --git a/ApplicationUnderTests/AppUIBasics/UpgradeLog2.htm b/ApplicationUnderTests/AppUIBasics/UpgradeLog2.htm new file mode 100644 index 00000000..1e334c7b Binary files /dev/null and b/ApplicationUnderTests/AppUIBasics/UpgradeLog2.htm differ diff --git a/Samples/C#/AlarmClockTest/AlarmClockSession.cs b/Samples/C#/AlarmClockTest/AlarmClockSession.cs index 6e0dc855..18865f1d 100644 --- a/Samples/C#/AlarmClockTest/AlarmClockSession.cs +++ b/Samples/C#/AlarmClockTest/AlarmClockSession.cs @@ -79,7 +79,7 @@ public virtual void TestInit() catch { // Click back button if application is in a nested page such as New Alarm or New Timer - session.FindElementByAccessibilityId("Back").Click(); + session.FindElementByAccessibilityId("CancelButton").Click(); Thread.Sleep(TimeSpan.FromSeconds(1)); alarmTabElement = session.FindElementByAccessibilityId("AlarmPivotItem"); } diff --git a/Samples/C#/AlarmClockTest/AlarmClockTest.csproj b/Samples/C#/AlarmClockTest/AlarmClockTest.csproj index 6b21b6f6..cc5c3968 100644 --- a/Samples/C#/AlarmClockTest/AlarmClockTest.csproj +++ b/Samples/C#/AlarmClockTest/AlarmClockTest.csproj @@ -75,6 +75,7 @@ + diff --git a/Samples/C#/AlarmClockTest/ScenarioStopwatch.cs b/Samples/C#/AlarmClockTest/ScenarioStopwatch.cs index 37d48868..aa23775b 100644 --- a/Samples/C#/AlarmClockTest/ScenarioStopwatch.cs +++ b/Samples/C#/AlarmClockTest/ScenarioStopwatch.cs @@ -29,7 +29,7 @@ public class ScenarioStopwatch : AlarmClockSession [TestMethod] public void StopwatchLap() { - int numberOfEntry = 3; + int numberOfEntry = 5; var stopwatchPivotItem = session.FindElementByAccessibilityId("StopwatchPivotItem"); // Start the stopwatch @@ -60,13 +60,13 @@ public void StopwatchLap() Assert.IsFalse(firstLapEntry.Displayed); // Horizontally scroll the list up and verify that the fist lap entry is now displayed while the last entry is now hidden - touchScreen.Scroll(lapListView.Coordinates, 0, -50); + touchScreen.Scroll(lapListView.Coordinates, 0, -150); Thread.Sleep(TimeSpan.FromSeconds(1)); Assert.IsTrue(firstLapEntry.Displayed); Assert.IsFalse(lastLapEntry.Displayed); // Horizontally scroll the list down and verify that the last lap entry is now displayed while the first entry is now hidden again - touchScreen.Scroll(lapListView.Coordinates, 0, 50); + touchScreen.Scroll(lapListView.Coordinates, 0, 150); Thread.Sleep(TimeSpan.FromSeconds(1)); Assert.IsTrue(lastLapEntry.Displayed); Assert.IsFalse(firstLapEntry.Displayed); diff --git a/Samples/C#/AlarmClockTest/ScenarioTimer.cs b/Samples/C#/AlarmClockTest/ScenarioTimer.cs new file mode 100644 index 00000000..7027aec7 --- /dev/null +++ b/Samples/C#/AlarmClockTest/ScenarioTimer.cs @@ -0,0 +1,89 @@ +//****************************************************************************** +// +// Copyright (c) 2018 Microsoft Corporation. All rights reserved. +// +// This code is licensed under the MIT License (MIT). +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +//****************************************************************************** + +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Threading; +using System; + +namespace AlarmClockTest +{ + [TestClass] + public class ScenarioTimer : AlarmClockSession + { + private const string NewTimerName = "Sample Test Timer"; + + // Pre-baked action + //session.FindElementByAccessibilityId("AddTimerButton").Click(); + //session.FindElementByAccessibilityId("HourLoopingSelector").FindElementByName("5").Click(); + //session.FindElementByAccessibilityId("TimerNameTextBox").Clear(); + //session.FindElementByAccessibilityId("TimerNameTextBox").SendKeys(NewTimerName); + //session.FindElementByAccessibilityId("TimerStartButton").Click(); + /// + + // Pre-baked inspection + //Assert.IsNotNull(session.FindElementByAccessibilityId("TimerListView")); + //var timerEntries = session.FindElementByAccessibilityId("TimerListView").FindElementsByClassName("ListViewItem"); + //Assert.IsTrue(timerEntries.Count > 0); + //var timerEntry = timerEntries[timerEntries.Count - 1]; + //var timerEntryResetButton = timerEntry.FindElementByAccessibilityId("TimerResetButton"); + //var timerEntryText = timerEntry.FindElementByAccessibilityId("TimerNameText"); + //Assert.IsTrue(timerEntryResetButton.Enabled); + //Assert.AreEqual(NewTimerName, timerEntryText.Text); + /// + + // Pre-baked cleanup + //timerEntry.SendKeys(OpenQA.Selenium.Keys.Delete + OpenQA.Selenium.Keys.Enter); + /// + + [TestInitialize] + public override void TestInit() + { + // Invoke base class test initialization to ensure that the app is in the main page + base.TestInit(); + + // Navigate to Timer tab + session.FindElementByAccessibilityId("TimerPivotItem").Click(); + } + + [ClassInitialize] + public static void ClassInitialize(TestContext context) + { + Setup(context); + } + + [ClassCleanup] + public static void ClassCleanup() + { + // Try to delete any timer entry that may have been created + while (true) + { + try + { + var timerEntry = session.FindElementByXPath($"//ListItem[starts-with(@Name, \"{NewTimerName}\")]"); + session.Mouse.ContextClick(timerEntry.Coordinates); + session.FindElementByName("Delete").Click(); + Thread.Sleep(TimeSpan.FromSeconds(1)); + } + catch + { + break; + } + } + + TearDown(); + } + } +} diff --git a/Samples/C#/Paint3DTest/ScenarioDraw.cs b/Samples/C#/Paint3DTest/ScenarioDraw.cs index aba13fec..c754e9e0 100644 --- a/Samples/C#/Paint3DTest/ScenarioDraw.cs +++ b/Samples/C#/Paint3DTest/ScenarioDraw.cs @@ -117,10 +117,10 @@ public void SetupBrushesPane() // Set eraser thickness to eraser width in pixel brushesPane.FindElementByAccessibilityId("Eraser3d").Click(); - if (brushesPane.FindElementByAccessibilityId("Thickness").Text != eraserWidth) + if (brushesPane.FindElementByAccessibilityId("BrushSize").Text != eraserWidth) { - brushesPane.FindElementByAccessibilityId("Thickness").SendKeys(Keys.Control + "a" + Keys.Control); - brushesPane.FindElementByAccessibilityId("Thickness").SendKeys(eraserWidth + Keys.Enter); + brushesPane.FindElementByAccessibilityId("BrushSize").SendKeys(Keys.Control + "a" + Keys.Control); + brushesPane.FindElementByAccessibilityId("BrushSize").SendKeys(eraserWidth + Keys.Enter); Thread.Sleep(TimeSpan.FromSeconds(1)); } diff --git a/Samples/C#/PaintTest/ScenarioDraw.cs b/Samples/C#/PaintTest/ScenarioDraw.cs index f691e6a8..7347d4a8 100644 --- a/Samples/C#/PaintTest/ScenarioDraw.cs +++ b/Samples/C#/PaintTest/ScenarioDraw.cs @@ -16,6 +16,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System; +using System.Drawing; using System.Collections.Generic; using OpenQA.Selenium.Interactions; using OpenQA.Selenium.Appium.Interactions; @@ -34,6 +35,7 @@ public class ScenarioDraw : PaintSession { private WindowsElement inkCanvas; private WindowsElement undoButton; + private static Size originalSize; private const int defaultRadius = 300; // half of ABCD square side. E.g. distance between AB private const int radiusOffset = 10; // distance between concentric square in pixels @@ -235,11 +237,19 @@ public static void ClassInitialize(TestContext context) { // Create session to launch or bring up Paint application Setup(context); + + // Save application window original size and temporarily set it to 1400 x 1000 + originalSize = session.Manage().Window.Size; + Assert.IsNotNull(originalSize); + session.Manage().Window.Size = new Size(1400, 1000); } [ClassCleanup] public static void ClassCleanup() { + // Restore application window original size and position + session.Manage().Window.Size = originalSize; + TearDown(); }