-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d196c9
commit f128a6d
Showing
66 changed files
with
992 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
...DeviceTestingKitApp.UITests.Android/DeviceTestingKitApp.UITests.XunitTests.Android.csproj
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
sample/test/DeviceTestingKitApp.UITests.NUnitTests/AppiumServerTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using NUnit.Framework.Internal; | ||
|
||
namespace DeviceTestingKitApp.UITests.NUnitTests; | ||
|
||
public class AppiumServerTests : BaseUITests | ||
{ | ||
public AppiumServerTests(string appKey) | ||
: base(appKey) | ||
{ | ||
} | ||
|
||
[Test] | ||
public void IsReady() | ||
{ | ||
//var id = Driver.SessionId; | ||
|
||
//Assert.NotNull(id); | ||
//Assert.NotEmpty(id.ToString()); | ||
|
||
//Assert.Equal(AppState.RunningInForeground, Driver.GetAppState()); | ||
|
||
Assert.Pass(); | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
sample/test/DeviceTestingKitApp.UITests.NUnitTests/BaseUITests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using System.Xml.Linq; | ||
|
||
using DeviceRunners.UIAutomation; | ||
using DeviceRunners.UIAutomation.Appium; | ||
|
||
using NUnit.Framework.Internal; | ||
|
||
namespace DeviceTestingKitApp.UITests.NUnitTests; | ||
|
||
[TestFixture("android")] | ||
[TestFixture("windows")] | ||
[Parallelizable(ParallelScope.All)] | ||
public abstract class BaseUITests | ||
{ | ||
private readonly string _testKey; | ||
|
||
private AutomationTestSuite _automationTestSuite; | ||
private IAutomatedApp _app; | ||
|
||
public BaseUITests(string testKey) | ||
{ | ||
_testKey = testKey; | ||
} | ||
|
||
protected IAutomatedApp App => _app; | ||
|
||
protected TextWriter Output => TestContext.Out; | ||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
_automationTestSuite = UITestsSetupFixture.TestSuite; | ||
_app = _automationTestSuite.StartApp(_testKey); | ||
|
||
//DeviceBy = new UITestsDeviceBy(Driver); | ||
} | ||
|
||
[TearDown] | ||
public void TearDown() | ||
{ | ||
if (App?.GetPageSource() is string source && !string.IsNullOrWhiteSpace(source)) | ||
Output.WriteLine($"Last page source:{Environment.NewLine}{XDocument.Parse(source)}"); | ||
else | ||
Output.WriteLine("Page source is empty"); | ||
|
||
if (App?.GetScreenshot() is { } screenshot) | ||
Output.WriteLine($"Last screenshot:{Environment.NewLine}{screenshot.ToBase64String()}"); | ||
else | ||
Output.WriteLine("No screenshot available"); | ||
|
||
_automationTestSuite.StopApp(_testKey); | ||
} | ||
|
||
//protected UITestsDeviceBy DeviceBy { get; } | ||
|
||
//protected class UITestsDeviceBy(AppiumDriver driver) | ||
//{ | ||
// public By AutomationId(string id) => | ||
// driver switch | ||
// { | ||
// WindowsDriver => MobileBy.AccessibilityId(id), | ||
// _ => MobileBy.Id(id) | ||
// }; | ||
//} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
sample/test/DeviceTestingKitApp.UITests.NUnitTests/UITestsSetupFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using DeviceRunners.UIAutomation; | ||
using DeviceRunners.UIAutomation.Appium; | ||
|
||
using NUnit.Framework.Internal; | ||
|
||
namespace DeviceTestingKitApp.UITests.NUnitTests; | ||
|
||
[SetUpFixture] | ||
public class UITestsSetupFixture | ||
{ | ||
[OneTimeSetUp] | ||
public void OneTimeSetUp() | ||
{ | ||
var builder = AutomationTestSuiteBuilder.Create() | ||
.AddAppium(options => options | ||
.UseServiceAddress("127.0.0.1", 4723) | ||
.AddLogger(new TestContextLogger()) | ||
.AddAndroidApp("android", options => options | ||
.UsePackageName("com.companyname.devicetestingkitapp") | ||
.UseActivityName(".MainActivity")) | ||
.AddWindowsApp("windows", options => options | ||
.UseAppId("com.companyname.devicetestingkitapp_9zz4h110yvjzm!App"))) | ||
; | ||
//.AddSelenium(options => options | ||
// .AddWebApp("https://dot.net/")); | ||
|
||
TestSuite = builder.Build(); | ||
} | ||
|
||
[OneTimeTearDown] | ||
public void OneTimeTearDown() | ||
{ | ||
TestSuite.Dispose(); | ||
} | ||
|
||
public static AutomationTestSuite TestSuite { get; private set; } | ||
|
||
class TestContextLogger : IAppiumDiagnosticLogger | ||
{ | ||
public void Log(string message) => | ||
TestContext.Out.WriteLine(message); | ||
} | ||
} |
5 changes: 0 additions & 5 deletions
5
...DeviceTestingKitApp.UITests.Windows/DeviceTestingKitApp.UITests.XunitTests.Windows.csproj
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
...ngKitApp.UITests.XunitTests.Android/DeviceTestingKitApp.UITests.XunitTests.Android.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<Import Project="..\DeviceTestingKitApp.UITests.XunitTests\DeviceTestingKitApp.UITests.XunitTests.targets" /> | ||
|
||
</Project> |
2 changes: 1 addition & 1 deletion
2
...eTestingKitApp.UITests.Android/_Config.cs → ...App.UITests.XunitTests.Android/_Config.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...ngKitApp.UITests.XunitTests.Windows/DeviceTestingKitApp.UITests.XunitTests.Windows.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<Import Project="..\DeviceTestingKitApp.UITests.XunitTests\DeviceTestingKitApp.UITests.XunitTests.targets" /> | ||
|
||
</Project> |
2 changes: 1 addition & 1 deletion
2
...eTestingKitApp.UITests.Windows/_Config.cs → ...App.UITests.XunitTests.Windows/_Config.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.