appium-novawindows2-driver 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/build/lib/commands/actions.d.ts +9 -9
  2. package/build/lib/commands/actions.d.ts.map +1 -1
  3. package/build/lib/commands/actions.js.map +1 -1
  4. package/build/lib/commands/app.d.ts +10 -10
  5. package/build/lib/commands/app.d.ts.map +1 -1
  6. package/build/lib/commands/app.js.map +1 -1
  7. package/build/lib/commands/device.d.ts +2 -2
  8. package/build/lib/commands/device.d.ts.map +1 -1
  9. package/build/lib/commands/device.js.map +1 -1
  10. package/build/lib/commands/element.d.ts +13 -13
  11. package/build/lib/commands/element.d.ts.map +1 -1
  12. package/build/lib/commands/element.js.map +1 -1
  13. package/build/lib/commands/extension.d.ts +28 -28
  14. package/build/lib/commands/extension.d.ts.map +1 -1
  15. package/build/lib/commands/extension.js +4 -1
  16. package/build/lib/commands/extension.js.map +1 -1
  17. package/build/lib/commands/index.d.ts +63 -63
  18. package/build/lib/commands/index.d.ts.map +1 -1
  19. package/build/lib/commands/powershell.d.ts +5 -5
  20. package/build/lib/commands/powershell.d.ts.map +1 -1
  21. package/build/lib/commands/powershell.js +59 -46
  22. package/build/lib/commands/powershell.js.map +1 -1
  23. package/build/lib/commands/system.d.ts +2 -2
  24. package/build/lib/commands/system.d.ts.map +1 -1
  25. package/build/lib/driver.d.ts +5 -1
  26. package/build/lib/driver.d.ts.map +1 -1
  27. package/build/lib/driver.js +21 -4
  28. package/build/lib/driver.js.map +1 -1
  29. package/examples/api_test.js +69 -0
  30. package/examples/concurrency_test.js +82 -0
  31. package/examples/debug_test.js +36 -0
  32. package/examples/stress_test.js +94 -0
  33. package/{verify_driver.js → examples/verify_driver.js} +47 -1
  34. package/lib/commands/actions.ts +9 -9
  35. package/lib/commands/app.ts +11 -11
  36. package/lib/commands/device.ts +2 -2
  37. package/lib/commands/element.ts +13 -13
  38. package/lib/commands/extension.ts +35 -31
  39. package/lib/commands/index.ts +1 -1
  40. package/lib/commands/powershell.ts +69 -56
  41. package/lib/commands/system.ts +2 -2
  42. package/lib/driver.ts +21 -2
  43. package/package.json +7 -6
  44. package/examples/C#/CalculatorTest/CalculatorTest/CalculatorSession.cs +0 -44
  45. package/examples/C#/CalculatorTest/CalculatorTest/CalculatorTest.csproj +0 -24
  46. package/examples/C#/CalculatorTest/CalculatorTest/ScenarioStandard.cs +0 -121
  47. package/examples/C#/CalculatorTest/CalculatorTest/ScenarioStandardInvoke.cs +0 -121
  48. package/examples/C#/CalculatorTest/CalculatorTest.sln +0 -16
@@ -1,121 +0,0 @@
1
- // Based on the original WinAppDriver Calculator test by Microsoft, licensed under the MIT License.
2
-
3
- using OpenQA.Selenium;
4
- using OpenQA.Selenium.Appium;
5
-
6
- namespace CalculatorTest;
7
-
8
- public class ScenarioStandard : CalculatorSession
9
- {
10
- private static AppiumElement _header;
11
- private static AppiumElement _calculatorResult;
12
-
13
- [Test]
14
- public void Addition()
15
- {
16
- // Find the buttons by their names and click them in sequence to perform 1 + 7 = 8
17
- Session.FindElement(MobileBy.Name("One")).Click();
18
- Session.FindElement(MobileBy.Name("Plus")).Click();
19
- Session.FindElement(MobileBy.Name("Seven")).Click();
20
- Session.FindElement(MobileBy.Name("Equals")).Click();
21
- Assert.That(GetCalculatorResultText(), Is.EqualTo("8"));
22
- }
23
-
24
- [Test]
25
- public void Division()
26
- {
27
- // Find the buttons by their accessibility ids and click them in sequence to perform 88 / 11 = 8
28
- Session.FindElement(MobileBy.AccessibilityId("num8Button")).Click();
29
- Session.FindElement(MobileBy.AccessibilityId("num8Button")).Click();
30
- Session.FindElement(MobileBy.AccessibilityId("divideButton")).Click();
31
- Session.FindElement(MobileBy.AccessibilityId("num1Button")).Click();
32
- Session.FindElement(MobileBy.AccessibilityId("num1Button")).Click();
33
- Session.FindElement(MobileBy.AccessibilityId("equalButton")).Click();
34
- Assert.That(GetCalculatorResultText(), Is.EqualTo("8"));
35
- }
36
-
37
- [Test]
38
- public void Multiplication()
39
- {
40
- // Find the buttons by their names using XPath and click them in sequence to perform 9 x 9 = 81
41
- Session.FindElement(By.XPath("//Button[@Name='Nine']")).Click();
42
- Session.FindElement(By.XPath("//Button[@Name='Multiply by']")).Click();
43
- Session.FindElement(By.XPath("//Button[@Name='Nine']")).Click();
44
- Session.FindElement(By.XPath("//Button[@Name='Equals']")).Click();
45
- Assert.That(GetCalculatorResultText(), Is.EqualTo("81"));
46
- }
47
-
48
- [Test]
49
- public void Subtraction()
50
- {
51
- // Find the buttons by their accessibility ids using XPath and click them in sequence to perform 9 - 1 = 8
52
- Session.FindElement(By.XPath("//Button[@AutomationId=\"num9Button\"]")).Click();
53
- Session.FindElement(By.XPath("//Button[@AutomationId=\"minusButton\"]")).Click();
54
- Session.FindElement(By.XPath("//Button[@AutomationId=\"num1Button\"]")).Click();
55
- Session.FindElement(By.XPath("//Button[@AutomationId=\"equalButton\"]")).Click();
56
- Assert.That(GetCalculatorResultText(), Is.EqualTo("8"));
57
- }
58
-
59
- [TestCase("One", "Plus", "Seven", "8")]
60
- [TestCase("Nine", "Minus", "One", "8")]
61
- [TestCase("Eight", "Divide by", "Eight", "1")]
62
- public void Templatized(string input1, string operation, string input2, string expectedResult)
63
- {
64
- // Run sequence of button presses specified above and validate the results
65
- Session.FindElement(MobileBy.Name(input1)).Click();
66
- Session.FindElement(MobileBy.Name(operation)).Click();
67
- Session.FindElement(MobileBy.Name(input2)).Click();
68
- Session.FindElement(MobileBy.Name("Equals")).Click();
69
- Assert.That(GetCalculatorResultText(), Is.EqualTo(expectedResult));
70
- }
71
-
72
- [OneTimeSetUp]
73
- public static void ClassInitialize()
74
- {
75
- // Create session to launch a Calculator window
76
- Setup();
77
-
78
- // Identify calculator mode by locating the header
79
- try
80
- {
81
- _header = Session.FindElement(MobileBy.AccessibilityId("Header"));
82
- }
83
- catch
84
- {
85
- _header = Session.FindElement(MobileBy.AccessibilityId("ContentPresenter"));
86
- }
87
-
88
- // Ensure that calculator is in standard mode
89
- if (!_header.Text.Equals("Standard", StringComparison.OrdinalIgnoreCase))
90
- {
91
- Session.FindElement(MobileBy.AccessibilityId("TogglePaneButton")).Click();
92
- Thread.Sleep(TimeSpan.FromSeconds(1));
93
- var splitViewPane = Session.FindElement(MobileBy.ClassName("SplitViewPane"));
94
- splitViewPane.FindElement(MobileBy.Name("Standard Calculator")).Click();
95
- Thread.Sleep(TimeSpan.FromSeconds(1));
96
- Assert.That(_header.Text.Equals("Standard", StringComparison.OrdinalIgnoreCase), Is.True);
97
- }
98
-
99
- // Locate the calculatorResult element
100
- _calculatorResult = Session.FindElement(MobileBy.AccessibilityId("CalculatorResults"));
101
- Assert.That(_calculatorResult, Is.Not.Null);
102
- }
103
-
104
- [OneTimeTearDown]
105
- public static void ClassCleanup()
106
- {
107
- TearDown();
108
- }
109
-
110
- [SetUp]
111
- public void Clear()
112
- {
113
- Session?.FindElement(MobileBy.Name("Clear")).Click();
114
- Assert.That(GetCalculatorResultText(), Is.EqualTo("0"));
115
- }
116
-
117
- private static string GetCalculatorResultText()
118
- {
119
- return _calculatorResult.Text.Replace("Display is", string.Empty).Trim();
120
- }
121
- }
@@ -1,121 +0,0 @@
1
- // Based on the original WinAppDriver Calculator test by Microsoft, licensed under the MIT License.
2
-
3
- using OpenQA.Selenium;
4
- using OpenQA.Selenium.Appium;
5
-
6
- namespace CalculatorTest;
7
-
8
- public class ScenarioStandardInvoke : CalculatorSession
9
- {
10
- private static AppiumElement _header;
11
- private static AppiumElement _calculatorResult;
12
-
13
- [Test]
14
- public void Addition()
15
- {
16
- // Find the buttons by their names and click them in sequence to perform 1 + 7 = 8
17
- Session.ExecuteScript("windows: invoke", Session.FindElement(MobileBy.Name("One")));
18
- Session.ExecuteScript("windows: invoke", Session.FindElement(MobileBy.Name("Plus")));
19
- Session.ExecuteScript("windows: invoke", Session.FindElement(MobileBy.Name("Seven")));
20
- Session.ExecuteScript("windows: invoke", Session.FindElement(MobileBy.Name("Equals")));
21
- Assert.That(GetCalculatorResultText(), Is.EqualTo("8"));
22
- }
23
-
24
- [Test]
25
- public void Division()
26
- {
27
- // Find the buttons by their accessibility ids and click them in sequence to perform 88 / 11 = 8
28
- Session.ExecuteScript("windows: invoke", Session.FindElement(MobileBy.AccessibilityId("num8Button")));
29
- Session.ExecuteScript("windows: invoke", Session.FindElement(MobileBy.AccessibilityId("num8Button")));
30
- Session.ExecuteScript("windows: invoke", Session.FindElement(MobileBy.AccessibilityId("divideButton")));
31
- Session.ExecuteScript("windows: invoke", Session.FindElement(MobileBy.AccessibilityId("num1Button")));
32
- Session.ExecuteScript("windows: invoke", Session.FindElement(MobileBy.AccessibilityId("num1Button")));
33
- Session.ExecuteScript("windows: invoke", Session.FindElement(MobileBy.AccessibilityId("equalButton")));
34
- Assert.That(GetCalculatorResultText(), Is.EqualTo("8"));
35
- }
36
-
37
- [Test]
38
- public void Multiplication()
39
- {
40
- // Find the buttons by their names using XPath and click them in sequence to perform 9 x 9 = 81
41
- Session.ExecuteScript("windows: invoke", Session.FindElement(By.XPath("//Button[@Name='Nine']")));
42
- Session.ExecuteScript("windows: invoke", Session.FindElement(By.XPath("//Button[@Name='Multiply by']")));
43
- Session.ExecuteScript("windows: invoke", Session.FindElement(By.XPath("//Button[@Name='Nine']")));
44
- Session.ExecuteScript("windows: invoke", Session.FindElement(By.XPath("//Button[@Name='Equals']")));
45
- Assert.That(GetCalculatorResultText(), Is.EqualTo("81"));
46
- }
47
-
48
- [Test]
49
- public void Subtraction()
50
- {
51
- // Find the buttons by their accessibility ids using XPath and click them in sequence to perform 9 - 1 = 8
52
- Session.ExecuteScript("windows: invoke", Session.FindElement(By.XPath("//Button[@AutomationId=\"num9Button\"]")));
53
- Session.ExecuteScript("windows: invoke", Session.FindElement(By.XPath("//Button[@AutomationId=\"minusButton\"]")));
54
- Session.ExecuteScript("windows: invoke", Session.FindElement(By.XPath("//Button[@AutomationId=\"num1Button\"]")));
55
- Session.ExecuteScript("windows: invoke", Session.FindElement(By.XPath("//Button[@AutomationId=\"equalButton\"]")));
56
- Assert.That(GetCalculatorResultText(), Is.EqualTo("8"));
57
- }
58
-
59
- [TestCase("One", "Plus", "Seven", "8")]
60
- [TestCase("Nine", "Minus", "One", "8")]
61
- [TestCase("Eight", "Divide by", "Eight", "1")]
62
- public void Templatized(string input1, string operation, string input2, string expectedResult)
63
- {
64
- // Run sequence of button presses specified above and validate the results
65
- Session.ExecuteScript("windows: invoke", Session.FindElement(MobileBy.Name(input1)));
66
- Session.ExecuteScript("windows: invoke", Session.FindElement(MobileBy.Name(operation)));
67
- Session.ExecuteScript("windows: invoke", Session.FindElement(MobileBy.Name(input2)));
68
- Session.ExecuteScript("windows: invoke", Session.FindElement(MobileBy.Name("Equals")));
69
- Assert.That(GetCalculatorResultText(), Is.EqualTo(expectedResult));
70
- }
71
-
72
- [OneTimeSetUp]
73
- public static void ClassInitialize()
74
- {
75
- // Create session to launch a Calculator window
76
- Setup();
77
-
78
- // Identify calculator mode by locating the header
79
- try
80
- {
81
- _header = Session.FindElement(MobileBy.AccessibilityId("Header"));
82
- }
83
- catch
84
- {
85
- _header = Session.FindElement(MobileBy.AccessibilityId("ContentPresenter"));
86
- }
87
-
88
- // Ensure that calculator is in standard mode
89
- if (!_header.Text.Equals("Standard", StringComparison.OrdinalIgnoreCase))
90
- {
91
- Session.ExecuteScript("windows: invoke", Session.FindElement(MobileBy.AccessibilityId("TogglePaneButton")));
92
- Thread.Sleep(TimeSpan.FromSeconds(1));
93
- var splitViewPane = Session.FindElement(MobileBy.ClassName("SplitViewPane"));
94
- Session.ExecuteScript("windows: invoke", splitViewPane.FindElement(MobileBy.Name("Standard Calculator")));
95
- Thread.Sleep(TimeSpan.FromSeconds(1));
96
- Assert.That(_header.Text.Equals("Standard", StringComparison.OrdinalIgnoreCase), Is.True);
97
- }
98
-
99
- // Locate the calculatorResult element
100
- _calculatorResult = Session.FindElement(MobileBy.AccessibilityId("CalculatorResults"));
101
- Assert.That(_calculatorResult, Is.Not.Null);
102
- }
103
-
104
- [OneTimeTearDown]
105
- public static void ClassCleanup()
106
- {
107
- TearDown();
108
- }
109
-
110
- [SetUp]
111
- public void Clear()
112
- {
113
- Session.ExecuteScript("windows: invoke", Session?.FindElement(MobileBy.Name("Clear")));
114
- Assert.That(GetCalculatorResultText(), Is.EqualTo("0"));
115
- }
116
-
117
- private static string GetCalculatorResultText()
118
- {
119
- return _calculatorResult.Text.Replace("Display is", string.Empty).Trim();
120
- }
121
- }
@@ -1,16 +0,0 @@
1
- 
2
- Microsoft Visual Studio Solution File, Format Version 12.00
3
- Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CalculatorTest", "CalculatorTest\CalculatorTest.csproj", "{AAB0751F-0906-4FE2-8725-BF90D7AC9F9D}"
4
- EndProject
5
- Global
6
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
7
- Debug|Any CPU = Debug|Any CPU
8
- Release|Any CPU = Release|Any CPU
9
- EndGlobalSection
10
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
11
- {AAB0751F-0906-4FE2-8725-BF90D7AC9F9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
12
- {AAB0751F-0906-4FE2-8725-BF90D7AC9F9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
13
- {AAB0751F-0906-4FE2-8725-BF90D7AC9F9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
14
- {AAB0751F-0906-4FE2-8725-BF90D7AC9F9D}.Release|Any CPU.Build.0 = Release|Any CPU
15
- EndGlobalSection
16
- EndGlobal