Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Testing] Enabling ported UITests from Xamarin.UITests to Appium - 48 #26607

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ protected override void Init()
Content = new StackLayout
{
Spacing = 10,
VerticalOptions = LayoutOptions.Start,
Children = { userNameEditor }
};
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="104"
android:viewportHeight="97"
android:width="104dp"
android:height="97dp">
<path
android:pathData="M14 85l3 9 72 0c0 0 5 -9 4 -10 -2 -2 -79 0 -79 1"
android:fillColor="#7c4e32" />
<path
android:pathData="M19 47c0 0 -9 7 -13 14 -5 6 3 7 3 7l1 14c0 0 10 8 23 8 14 0 26 1 28 0 2 -1 9 -2 9 -4 1 -1 27 1 27 -9C97 67 104 57 86 48 69 39 19 47 19 47"
android:fillColor="#e30000" />
<path
android:pathData="M17 32C14 80 97 75 88 29L53 14"
android:fillColor="#ffe1c4" />
<path
android:pathData="M17 32C26 -4 78 0 88 29 68 20 48 20 17 32"
android:fillColor="#8ed8f8" />
<path
android:pathData="M54 35a10 8 60 1 1 0 0.1zm-17 3a10 8 -60 1 1 0 0.1z"
android:fillColor="#ffffff" />
<path
android:pathData="M41 6c1 -1 4 -3 8 -3 3 0 9 -1 14 3L62 8 60 8 58 8C58 8 55 9 53 8 51 7 52 7 52 7L49 8 47 7 46 7c0 0 -1 2 -3 2 0 0 -2 -1 -2 -3m-24 28l0 -2c0 0 35 -20 71 -3l0 2C88 31 53 14 17 34M5 62c3 -2 5 -2 8 0 3 2 13 6 8 11 -2 2 -6 0 -8 0 -1 1 -4 2 -6 1C3 71 1 66 5 62m94 -3c0 0 -9 -2 -11 4l-3 5c0 1 -2 3 3 3 5 0 5 2 7 2 3 0 7 -1 7 -4 0 -4 -1 -11 -3 -10"
android:fillColor="#fff200" />
<path
android:pathData="M56 78l0 1m-1 -10l0 1m0 17l0 1"
android:strokeWidth="1"
android:fillColor="#000000"
android:strokeColor="#000000"
android:strokeLineCap="round" />
<path
android:pathData="M60 36a1 1 0 1 1 0 -0.1M49 36a1 1 0 1 1 0 -0.1M57 55a2 3 0 1 1 0 -0.1M12 94c0 0 20 -4 42 0 0 0 27 -4 39 0z"
android:fillColor="#000000" />
<path
android:pathData="M50 59c0 0 4 3 10 0m-4 7l2 12 -2 12M25 50c0 0 10 12 23 12 13 0 24 0 35 -15"
android:strokeWidth="0.5"
android:strokeColor="#000000" />
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="356dp"
android:height="508dp"
android:viewportWidth="356"
android:viewportHeight="508">
<path android:fillColor="#000000" android:pathData="M330.4 0H25.6C11.6 0 .2 11.4.2 25.4v457.2c0 14 11.4 25.4 25.4 25.4h304.8c14 0 25.4-11.4 25.4-25.4V25.4c0-14-11.4-25.4-25.4-25.4zM178 482.6c-14 0-25.4-11.4-25.4-25.4 0-14 11.4-25.4 25.4-25.4 14 0 25.4 11.4 25.4 25.4 0 14-11.4 25.4-25.4 25.4zm127-86.4c0 5.6-4.5 10.2-10.2 10.2H61.2c-5.6 0-10.2-4.6-10.2-10.2V61c0-5.6 4.5-10.2 10.2-10.2h233.7c5.6 0 10.2 4.6 10.2 10.2v335.2h-.1z"/>
<path android:fillColor="#000000" android:pathData="M178 101.6c-14 0-25.4 11.4-25.4 25.4 0 14 11.4 25.4 25.4 25.4 14 0 25.4-11.4 25.4-25.4 0-14-11.4-25.4-25.4-25.4zM178 203.2c-14 0-25.4 11.4-25.4 25.4v101.6c0 14 11.4 25.4 25.4 25.4 14 0 25.4-11.4 25.4-25.4V228.6c0-14-11.4-25.4-25.4-25.4z"/>
</vector>
17 changes: 17 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Resources/Images/heart.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!-- res/drawable/heart.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="256dp"
android:width="256dp"
android:viewportWidth="32"
android:viewportHeight="32">

<!-- draw a path -->
<path android:fillColor="#8fff"
android:pathData="M20.5,9.5
c-1.955,0,-3.83,1.268,-4.5,3
c-0.67,-1.732,-2.547,-3,-4.5,-3
C8.957,9.5,7,11.432,7,14
c0,3.53,3.793,6.257,9,11.5
c5.207,-5.242,9,-7.97,9,-11.5
C25,11.432,23.043,9.5,20.5,9.5z" />
</vector>
Original file line number Diff line number Diff line change
@@ -1,43 +1,35 @@
#if WINDOWS
using NUnit.Framework;
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Bugzilla43663 : _IssuesUITest
{
const string PushModal = "Push Modal";

const string PopModal = "Pop Modal";

const string Modal = "Modal";
#if MACCATALYST
const string AlertCancelButton = "action-button--999";
#else
const string AlertCancelButton = "Cancel";
#endif

public Bugzilla43663(TestDevice testDevice) : base(testDevice)
{
}

public override string Issue => "ModalPushed and ModalPopped not working on WinRT";

// [Test]
// [Category(UITestCategories.Navigation)]
// public void ModalNavigation()
// {
// var i = 0;
// while(App.GetAlerts().Count == 0 && i < 3)
// {
// i++;
// Task.Delay(1000);
// }

// App.GetAlert()?.DismissAlert();
// App.WaitForElement(PushModal);
// App.Tap(PushModal);
// App.GetAlert()?.DismissAlert();
// App.WaitForElement(Modal);
// App.Tap(PopModal);
// App.GetAlert()?.DismissAlert();
// App.WaitForElement(PushModal);
// }
}
#endif
[Test]
[Category(UITestCategories.Navigation)]
public void ModalNavigation()
{
App.WaitForElement("Click to push Modal");
App.Tap("Click to push Modal");
App.WaitForElementTillPageNavigationSettled(AlertCancelButton);
App.Tap(AlertCancelButton);
App.WaitForElement("Modal");
App.Tap("Click to dismiss modal");
App.WaitForElementTillPageNavigationSettled(AlertCancelButton);
App.Tap(AlertCancelButton);
App.WaitForElement("Click to push Modal");
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if ANDROID
#if TEST_FAILS_ON_WINDOWS && TEST_FAILS_ON_IOS && TEST_FAILS_ON_CATALYST// This test uses a platform-specific API relevant only to Android.
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;
Expand All @@ -7,33 +7,33 @@ namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Bugzilla44044 : _IssuesUITest
{
//string _btnToggleSwipe = "btnToggleSwipe";
//string _btnDisplayAlert = "btnDisplayAlert";
string _btnToggleSwipe = "btnToggleSwipe";
string _btnDisplayAlert = "btnDisplayAlert";

public Bugzilla44044(TestDevice testDevice) : base(testDevice)
{
}

public override string Issue => "TabbedPage steals swipe gestures";

// [Test]
// [Category(UITestCategories.TabbedPage)]
// public void Bugzilla44044Test()
// {
// App.WaitForElement(_btnToggleSwipe);

// App.SwipeRightToLeft();
// App.WaitForNoElement(_btnToggleSwipe);
// App.WaitForElement(_btnDisplayAlert);

// App.SwipeLeftToRight();
// App.WaitForNoElement(_btnDisplayAlert);
// App.WaitForElement(_btnToggleSwipe);

// App.Tap(_btnToggleSwipe);
// App.SwipeRightToLeft();
// App.WaitForNoElement(_btnDisplayAlert);
// App.WaitForElement(_btnToggleSwipe);
// }
[Test]
[Category(UITestCategories.TabbedPage)]
public void Bugzilla44044Test()
{
App.WaitForElement(_btnToggleSwipe);

App.SwipeRightToLeft();
App.WaitForNoElement(_btnToggleSwipe);
App.WaitForElement(_btnDisplayAlert);

App.SwipeLeftToRight();
App.WaitForNoElement(_btnDisplayAlert);
App.WaitForElement(_btnToggleSwipe);

App.Tap(_btnToggleSwipe);
App.SwipeRightToLeft();
App.WaitForNoElement(_btnDisplayAlert);
App.WaitForElement(_btnToggleSwipe);
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
using NUnit.Framework;
# if TEST_FAILS_ON_WINDOWS && TEST_FAILS_ON_IOS && TEST_FAILS_ON_CATALYST // This test uses a vector image resources which applicable only for Android.
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Bugzilla47923 : _IssuesUITest
{
public Bugzilla47923(TestDevice testDevice) : base(testDevice)
{
}

public override string Issue => "TapGestureRecognizer blocks List View Context Actions1";
public override string Issue => "Vectors don\'t work in Images, and work badly in Buttons";

// [FailsOnAndroidWhenRunningOnXamarinUITest]
// [FailsOnIOSWhenRunningOnXamarinUITest]
// [Test]
// public void Bugzilla47923Test()
// {
// foreach (var testString in new[] { "AspectFit", "AspectFill", "Fill", "Test cell views" })
// {
// App.WaitForElement(q => q.Marked(testString));
// App.Tap(q => q.Marked(testString));
// App.Back();
// }
// }
}

[Test]
[Category(UITestCategories.ListView)]
public void Bugzilla47923Test()
{
foreach (var testString in new[] { "AspectFit", "AspectFill", "Fill", "Test cell views" })
{
App.WaitForElement((testString));
App.Tap((testString));
App.Back();
}
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using NUnit.Framework;
# if TEST_FAILS_ON_CATALYST //While invoking EnterText("1") results in the text being cleared before appending "1", leading to test fails on Catalyst.
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

Expand All @@ -10,32 +11,18 @@ public Issue2272(TestDevice testDevice) : base(testDevice)
{
}

public override string Issue => "Setting a different Detail page from a FlyoutPage after 2nd time on MainPage";
public override string Issue => "Entry text updating set focus on the beginning of text not the end of it";

// [Test]
// [Category(UITestCategories.Navigation)]
// [FailsOnIOSWhenRunningOnXamarinUITest]
// #if MACCATALYST // Check if this is still try for MAUI?
// [Ignore("EnterText problems in UITest Desktop")]
// #endif
// public void TestFocusIsOnTheEndAfterSettingText ()
// {
// App.WaitForElement("userNameEditorEmptyString");
// App.Tap (c => c.Marked ("userNameEditorEmptyString"));
// App.EnterText ("1");
// PressEnter ();
// var q = App.Query(c => c.Marked("userNameEditorEmptyString"));
// Assert.AreEqual("focused1", q[0].Text);
// }

// void PressEnter ()
// {
// var androidApp = RunningApp as AndroidApp;
// if (androidApp != null) {
// androidApp.PressUserAction (UserAction.Done);
// }
// else {
// App.PressEnter ();
// }
// }
[Test]
[Category(UITestCategories.Entry)]
public void TestFocusIsOnTheEndAfterSettingText()
{
App.WaitForElement("userNameEditorEmptyString");
App.Tap("userNameEditorEmptyString");
App.EnterText("userNameEditorEmptyString", "1");
App.PressEnter();
var q = App.FindElement("userNameEditorEmptyString");
Assert.That("focused1", Is.EqualTo(q.GetText()));
}
}
#endif
Loading