-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Testing] Reenable test ported from Xamarin.UITest (#25624)
* Reenable test ported from Xamarin.UITest * Added Category * Updated test * More changes
- Loading branch information
1 parent
6a65d5e
commit e720f1e
Showing
1 changed file
with
48 additions
and
44 deletions.
There are no files selected for viewing
92 changes: 48 additions & 44 deletions
92
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue3809.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 |
---|---|---|
@@ -1,67 +1,71 @@ | ||
using NUnit.Framework; | ||
#if TEST_FAILS_ON_WINDOWS | ||
using NUnit.Framework; | ||
using NUnit.Framework.Legacy; | ||
using UITest.Appium; | ||
using UITest.Core; | ||
|
||
namespace Microsoft.Maui.TestCases.Tests.Issues | ||
{ | ||
public class Issue3809 : _IssuesUITest | ||
{ | ||
const string SetPagePadding = "Set Page Padding"; | ||
const string SafeAreaText = "Safe Area Enabled: "; | ||
const string PaddingLabel = "paddingLabel"; | ||
const string SafeAreaAutomationId = "SafeAreaAutomation"; | ||
|
||
public Issue3809(TestDevice testDevice) : base(testDevice) | ||
{ | ||
} | ||
|
||
public override string Issue => "SetUseSafeArea is wiping out Page Padding "; | ||
|
||
// TODO: The _ variables need to be AutomationId values | ||
//void AssertSafeAreaText(string text) | ||
//{ | ||
// var element = | ||
// RunningApp | ||
// .WaitForFirstElement(_safeAreaAutomationId); | ||
|
||
// element.AssertHasText(text); | ||
//} | ||
|
||
//[Test] | ||
//[Category(UITestCategories.Layout)] | ||
//public void SafeAreaInsetsBreaksAndroidPadding() | ||
//{ | ||
// // ensure initial paddings are honored | ||
// AssertSafeAreaText($"{_safeAreaText}{true}"); | ||
// var element = App.WaitForFirstElement(_paddingLabel); | ||
void AssertSafeAreaText(string text) | ||
{ | ||
var element = App.WaitForFirstElement(SafeAreaAutomationId); | ||
|
||
// bool usesSafeAreaInsets = false; | ||
// if (element.ReadText() != "25, 25, 25, 25") | ||
// usesSafeAreaInsets = true; | ||
ClassicAssert.AreEqual(element.GetText(), text); | ||
} | ||
|
||
// Assert.AreNotEqual(element.ReadText(), "0, 0, 0, 0"); | ||
// if (!usesSafeAreaInsets) | ||
// Assert.AreEqual(element.ReadText(), "25, 25, 25, 25"); | ||
[Test] | ||
[Category(UITestCategories.Layout)] | ||
[Category(UITestCategories.Page)] | ||
public void SafeAreaInsetsBreaksAndroidPadding() | ||
{ | ||
// Ensure initial paddings are honored | ||
AssertSafeAreaText($"{SafeAreaText}{true}"); | ||
var element = App.WaitForFirstElement(PaddingLabel); | ||
|
||
// // disable Safe Area Insets | ||
// App.Tap(_safeAreaAutomationId); | ||
// AssertSafeAreaText($"{_safeAreaText}{false}"); | ||
// element = App.WaitForFirstElement(_paddingLabel); | ||
bool usesSafeAreaInsets = false; | ||
if (element.ReadText() != "25, 25, 25, 25") | ||
usesSafeAreaInsets = true; | ||
|
||
// Assert.AreEqual(element.ReadText(), "25, 25, 25, 25"); | ||
ClassicAssert.AreNotEqual(element.ReadText(), "0, 0, 0, 0"); | ||
if (!usesSafeAreaInsets) | ||
ClassicAssert.AreEqual(element.ReadText(), "25, 25, 25, 25"); | ||
|
||
// // enable Safe Area insets | ||
// App.Tap(_safeAreaAutomationId); | ||
// AssertSafeAreaText($"{_safeAreaText}{true}"); | ||
// element = App.WaitForFirstElement(_paddingLabel); | ||
// Assert.AreNotEqual(element.ReadText(), "0, 0, 0, 0"); | ||
// Disable Safe Area Insets | ||
App.Tap(SafeAreaAutomationId); | ||
AssertSafeAreaText($"{SafeAreaText}{false}"); | ||
element = App.WaitForFirstElement(PaddingLabel); | ||
|
||
// if (!usesSafeAreaInsets) | ||
// Assert.AreEqual(element.ReadText(), "25, 25, 25, 25"); | ||
ClassicAssert.AreEqual(element.ReadText(), "25, 25, 25, 25"); | ||
|
||
// Enable Safe Area insets | ||
App.Tap(SafeAreaAutomationId); | ||
AssertSafeAreaText($"{SafeAreaText}{true}"); | ||
element = App.WaitForFirstElement(PaddingLabel); | ||
ClassicAssert.AreNotEqual(element.ReadText(), "0, 0, 0, 0"); | ||
|
||
// // Set Padding and then disable safe area insets | ||
// App.Tap(_setPagePadding); | ||
// App.Tap(_safeAreaAutomationId); | ||
// AssertSafeAreaText($"{_safeAreaText}{false}"); | ||
// element = App.WaitForFirstElement(_paddingLabel); | ||
// Assert.AreEqual(element.ReadText(), "25, 25, 25, 25"); | ||
if (!usesSafeAreaInsets) | ||
ClassicAssert.AreEqual(element.ReadText(), "25, 25, 25, 25"); | ||
|
||
//} | ||
// Set Padding and then disable safe area insets | ||
App.Tap(SetPagePadding); | ||
App.Tap(SafeAreaAutomationId); | ||
AssertSafeAreaText($"{SafeAreaText}{false}"); | ||
element = App.WaitForFirstElement(PaddingLabel); | ||
ClassicAssert.AreEqual(element.ReadText(), "25, 25, 25, 25"); | ||
} | ||
} | ||
} | ||
} | ||
#endif |