Skip to content

Commit 686c6bc

Browse files
committed
Added Appium specific platform app start extensions for the LegerityTestClass
1 parent d9495f9 commit 686c6bc

File tree

3 files changed

+211
-0
lines changed

3 files changed

+211
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
namespace Legerity.Android.Extensions
2+
{
3+
using System;
4+
using OpenQA.Selenium;
5+
using OpenQA.Selenium.Appium.Android;
6+
7+
/// <summary>
8+
/// Defines a collection of extensions for <see cref="LegerityTestClass"/> instances.
9+
/// </summary>
10+
public static class LegerityTestClassExtensions
11+
{
12+
/// <summary>
13+
/// Starts the Android application ready for testing.
14+
/// </summary>
15+
/// <param name="testClass">
16+
/// The test class to launch an Android application for.
17+
/// </param>
18+
/// <param name="waitUntil">
19+
/// An optional condition of the driver to wait on until it is met.
20+
/// </param>
21+
/// <param name="waitUntilTimeout">
22+
/// An optional timeout wait on the conditional wait until being true. If not set, the wait will run immediately, and if not valid, will throw an exception.
23+
/// </param>
24+
/// <param name="waitUntilRetries">
25+
/// An optional count of retries after a timeout on the wait until condition before accepting the failure.
26+
/// </param>
27+
/// <returns>The configured and running application driver.</returns>
28+
public static AndroidDriver<AndroidElement> StartAndroidApp(
29+
this LegerityTestClass testClass,
30+
Func<IWebDriver, bool> waitUntil = default,
31+
TimeSpan? waitUntilTimeout = default,
32+
int waitUntilRetries = 0)
33+
{
34+
return testClass.StartApp(waitUntil, waitUntilTimeout, waitUntilRetries) as AndroidDriver<AndroidElement>;
35+
}
36+
37+
/// <summary>
38+
/// Starts the Android application ready for testing.
39+
/// </summary>
40+
/// <param name="testClass">
41+
/// The test class to launch an Android application for.
42+
/// </param>
43+
/// <param name="options">
44+
/// The optional options to configure the driver with.
45+
/// <para>
46+
/// Settings this will override the <see cref="LegerityTestClass.Options"/> if previously set.
47+
/// </para>
48+
/// </param>
49+
/// <param name="waitUntil">
50+
/// An optional condition of the driver to wait on until it is met.
51+
/// </param>
52+
/// <param name="waitUntilTimeout">
53+
/// An optional timeout wait on the conditional wait until being true. If not set, the wait will run immediately, and if not valid, will throw an exception.
54+
/// </param>
55+
/// <param name="waitUntilRetries">
56+
/// An optional count of retries after a timeout on the wait until condition before accepting the failure.
57+
/// </param>
58+
/// <returns>The configured and running application driver.</returns>
59+
public static AndroidDriver<AndroidElement> StartAndroidApp(
60+
this LegerityTestClass testClass,
61+
AndroidAppManagerOptions options,
62+
Func<IWebDriver, bool> waitUntil = default,
63+
TimeSpan? waitUntilTimeout = default,
64+
int waitUntilRetries = 0)
65+
{
66+
return testClass.StartApp(options, waitUntil, waitUntilTimeout, waitUntilRetries) as
67+
AndroidDriver<AndroidElement>;
68+
}
69+
}
70+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
namespace Legerity.IOS.Extensions
2+
{
3+
using System;
4+
using OpenQA.Selenium;
5+
using OpenQA.Selenium.Appium.iOS;
6+
7+
/// <summary>
8+
/// Defines a collection of extensions for <see cref="LegerityTestClass"/> instances.
9+
/// </summary>
10+
public static class LegerityTestClassExtensions
11+
{
12+
/// <summary>
13+
/// Starts the iOS application ready for testing.
14+
/// </summary>
15+
/// <param name="testClass">
16+
/// The test class to launch an Android application for.
17+
/// </param>
18+
/// <param name="waitUntil">
19+
/// An optional condition of the driver to wait on until it is met.
20+
/// </param>
21+
/// <param name="waitUntilTimeout">
22+
/// An optional timeout wait on the conditional wait until being true. If not set, the wait will run immediately, and if not valid, will throw an exception.
23+
/// </param>
24+
/// <param name="waitUntilRetries">
25+
/// An optional count of retries after a timeout on the wait until condition before accepting the failure.
26+
/// </param>
27+
/// <returns>The configured and running application driver.</returns>
28+
public static IOSDriver<IOSElement> StartIOSApp(
29+
this LegerityTestClass testClass,
30+
Func<IWebDriver, bool> waitUntil = default,
31+
TimeSpan? waitUntilTimeout = default,
32+
int waitUntilRetries = 0)
33+
{
34+
return testClass.StartApp(waitUntil, waitUntilTimeout, waitUntilRetries) as IOSDriver<IOSElement>;
35+
}
36+
37+
/// <summary>
38+
/// Starts the iOS application ready for testing.
39+
/// </summary>
40+
/// <param name="testClass">
41+
/// The test class to launch an Android application for.
42+
/// </param>
43+
/// <param name="options">
44+
/// The optional options to configure the driver with.
45+
/// <para>
46+
/// Settings this will override the <see cref="LegerityTestClass.Options"/> if previously set.
47+
/// </para>
48+
/// </param>
49+
/// <param name="waitUntil">
50+
/// An optional condition of the driver to wait on until it is met.
51+
/// </param>
52+
/// <param name="waitUntilTimeout">
53+
/// An optional timeout wait on the conditional wait until being true. If not set, the wait will run immediately, and if not valid, will throw an exception.
54+
/// </param>
55+
/// <param name="waitUntilRetries">
56+
/// An optional count of retries after a timeout on the wait until condition before accepting the failure.
57+
/// </param>
58+
/// <returns>The configured and running application driver.</returns>
59+
public static IOSDriver<IOSElement> StartIOSApp(
60+
this LegerityTestClass testClass,
61+
IOSAppManagerOptions options,
62+
Func<IWebDriver, bool> waitUntil = default,
63+
TimeSpan? waitUntilTimeout = default,
64+
int waitUntilRetries = 0)
65+
{
66+
return testClass.StartApp(options, waitUntil, waitUntilTimeout, waitUntilRetries) as
67+
IOSDriver<IOSElement>;
68+
}
69+
}
70+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
namespace Legerity.Windows.Extensions
2+
{
3+
using System;
4+
using OpenQA.Selenium;
5+
using OpenQA.Selenium.Appium.iOS;
6+
using OpenQA.Selenium.Appium.Windows;
7+
8+
/// <summary>
9+
/// Defines a collection of extensions for <see cref="LegerityTestClass"/> instances.
10+
/// </summary>
11+
public static class LegerityTestClassExtensions
12+
{
13+
/// <summary>
14+
/// Starts the Windows application ready for testing.
15+
/// </summary>
16+
/// <param name="testClass">
17+
/// The test class to launch an Android application for.
18+
/// </param>
19+
/// <param name="waitUntil">
20+
/// An optional condition of the driver to wait on until it is met.
21+
/// </param>
22+
/// <param name="waitUntilTimeout">
23+
/// An optional timeout wait on the conditional wait until being true. If not set, the wait will run immediately, and if not valid, will throw an exception.
24+
/// </param>
25+
/// <param name="waitUntilRetries">
26+
/// An optional count of retries after a timeout on the wait until condition before accepting the failure.
27+
/// </param>
28+
/// <returns>The configured and running application driver.</returns>
29+
public static WindowsDriver<WindowsElement> StartWindowsApp(
30+
this LegerityTestClass testClass,
31+
Func<IWebDriver, bool> waitUntil = default,
32+
TimeSpan? waitUntilTimeout = default,
33+
int waitUntilRetries = 0)
34+
{
35+
return testClass.StartApp(waitUntil, waitUntilTimeout, waitUntilRetries) as WindowsDriver<WindowsElement>;
36+
}
37+
38+
/// <summary>
39+
/// Starts the Windows application ready for testing.
40+
/// </summary>
41+
/// <param name="testClass">
42+
/// The test class to launch an Android application for.
43+
/// </param>
44+
/// <param name="options">
45+
/// The optional options to configure the driver with.
46+
/// <para>
47+
/// Settings this will override the <see cref="LegerityTestClass.Options"/> if previously set.
48+
/// </para>
49+
/// </param>
50+
/// <param name="waitUntil">
51+
/// An optional condition of the driver to wait on until it is met.
52+
/// </param>
53+
/// <param name="waitUntilTimeout">
54+
/// An optional timeout wait on the conditional wait until being true. If not set, the wait will run immediately, and if not valid, will throw an exception.
55+
/// </param>
56+
/// <param name="waitUntilRetries">
57+
/// An optional count of retries after a timeout on the wait until condition before accepting the failure.
58+
/// </param>
59+
/// <returns>The configured and running application driver.</returns>
60+
public static WindowsDriver<WindowsElement> StartWindowsApp(
61+
this LegerityTestClass testClass,
62+
WindowsAppManagerOptions options,
63+
Func<IWebDriver, bool> waitUntil = default,
64+
TimeSpan? waitUntilTimeout = default,
65+
int waitUntilRetries = 0)
66+
{
67+
return testClass.StartApp(options, waitUntil, waitUntilTimeout, waitUntilRetries) as
68+
WindowsDriver<WindowsElement>;
69+
}
70+
}
71+
}

0 commit comments

Comments
 (0)