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 - 31 #26379

Merged
merged 1 commit into from
Dec 6, 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
38 changes: 15 additions & 23 deletions src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue1704.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public OnLoadAnimationPage()

_referenceImage = new Image
{
Source = "GifTwo.gif",
Source = "giftwo.gif",
HorizontalOptions = LayoutOptions.Start
};

Expand All @@ -57,7 +57,7 @@ public OnLoadAnimationPage()

_animatedImage = new Image
{
Source = "GifTwo.gif",
Source = "giftwo.gif",
HorizontalOptions = LayoutOptions.Start
};

Expand Down Expand Up @@ -101,7 +101,7 @@ public OnStartAnimationPage()

_referenceImage = new Image
{
Source = "GifOne.gif",
Source = "gifone.gif",
HorizontalOptions = LayoutOptions.Start
};

Expand All @@ -115,7 +115,7 @@ public OnStartAnimationPage()

_animatedImage = new Image
{
Source = "GifOne.gif",
Source = "gifone.gif",
HorizontalOptions = LayoutOptions.Start
};

Expand Down Expand Up @@ -306,9 +306,8 @@ static void OnLoadImageComplete(Object state)
context.LoadButton = null;
context.LoadIndicator = null;

#pragma warning disable CS0618 // Type or member is obsolete
#pragma warning disable CS0612 // Type or member is obsolete
Device.BeginInvokeOnMainThread(() =>

MainThread.BeginInvokeOnMainThread(() =>
{
if (loadButton != null)
loadButton.IsEnabled = true;
Expand All @@ -327,8 +326,6 @@ static void OnLoadImageComplete(Object state)
animationImage.IsAnimationPlaying = true;
}
});
#pragma warning restore CS0612 // Type or member is obsolete
#pragma warning restore CS0618 // Type or member is obsolete
}
}
}
Expand Down Expand Up @@ -375,6 +372,8 @@ public MiscPage()
_noAnimationFallbackImage = new Image
{
Source = "coffee.png",
HeightRequest = 60,
WidthRequest = 60,
HorizontalOptions = LayoutOptions.Start
};

Expand All @@ -388,7 +387,7 @@ public MiscPage()

_initNoAnimationImage = new Image
{
Source = "GifTwo.gif",
Source = "giftwo.gif",
HorizontalOptions = LayoutOptions.Start
};

Expand Down Expand Up @@ -436,7 +435,7 @@ public MiscPage()

_stressTestImage = new Image
{
Source = "GifTwo.gif",
Source = "giftwo.gif",
HorizontalOptions = LayoutOptions.Start,
IsVisible = false
};
Expand Down Expand Up @@ -504,25 +503,22 @@ async void runStressTest()
{
for (int i = 0; i < _stressTestIterationCount && !_abortStressTest; i++)
{
#pragma warning disable CS0618 // Type or member is obsolete
#pragma warning disable CS0612 // Type or member is obsolete
Device.BeginInvokeOnMainThread(() =>

MainThread.BeginInvokeOnMainThread(() =>
{
if (i % 2 == 0)
{
_stressTestImage.Source = "GifTwo.gif";
_stressTestImage.Source = "giftwo.gif";
}
else
{
_stressTestImage.Source = "GifOne.gif";
_stressTestImage.Source = "gifone.gif";
}

_stressTestProgressBar.Progress = (double)i / (double)_stressTestIterationCount;

_nextStressTest.Set();
});
#pragma warning restore CS0612 // Type or member is obsolete
#pragma warning restore CS0618 // Type or member is obsolete

_nextStressTest.WaitOne();

Expand All @@ -532,17 +528,13 @@ async void runStressTest()
await Task.Delay(10).ConfigureAwait(false);
}

#pragma warning disable CS0618 // Type or member is obsolete
#pragma warning disable CS0612 // Type or member is obsolete
Device.BeginInvokeOnMainThread(() =>
MainThread.BeginInvokeOnMainThread(() =>
{
_startStressTestButton.Text = "Run Stress Test";
_startStressTestButton.IsEnabled = true;
_stopStressTestButton.IsEnabled = false;
if (!_abortStressTest)
_stressTestProgressBar.Progress = 1;
});
#pragma warning restore CS0612 // Type or member is obsolete
#pragma warning restore CS0618 // Type or member is obsolete
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ protected override void Init()
Children.Add(navigationPageThree);
Children.Add(navigationPageFour);
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,42 @@ namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Issue1704 : _IssuesUITest
{
#if ANDROID
const string OnLoad="ON LOAD";
const string OnStart ="ON START";
const string Source="SOURCE";
const string Misc="MISC";
#else
const string OnLoad="On Load";
const string OnStart ="On Start";
const string Source="Source";
const string Misc="Misc";
#endif
public Issue1704(TestDevice testDevice) : base(testDevice)
{
}

public override string Issue => "[Enhancement] Basic GIF animation features";

// [Test]
// [Category(UITestCategories.TabbedPage)]
// [Category(UITestCategories.ManualReview)]
// public void Issue1704Test()
// {
// App.WaitForElement("On Load");
// App.WaitForElement("On Start");
// App.WaitForElement("Source");
// App.WaitForElement("Misc");

// App.Tap(q => q.Marked("On Load"));
// App.Tap(q => q.Marked("On Start"));
// App.WaitForElement(q => q.Marked("Start Animation"));
// App.Tap(q => q.Marked("Start Animation"));
// App.Tap(q => q.Marked("Stop Animation"));

// App.Tap(q => q.Marked("Misc"));
// App.WaitForElement(q => q.Marked("Start Animation"));
// App.Tap(q => q.Marked("Start Animation"));
// App.Tap(q => q.Marked("Stop Animation"));
// }
[Test]
[Category(UITestCategories.TabbedPage)]
[Category(UITestCategories.ManualReview)]
public void Issue1704Test()
{
App.WaitForElement(OnLoad);
App.FindElement(OnStart);
App.FindElement(Source);
App.FindElement(Misc);
App.Tap(OnLoad);
App.Tap(OnStart);
App.WaitForElement("Start Animation");
App.Tap("Start Animation");
App.Tap("Stop Animation");
App.Tap(Misc);
App.WaitForElement("Start Animation");
App.Tap("Start Animation");
App.Tap("Stop Animation");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,37 @@ namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Issue198 : _IssuesUITest
{
#if ANDROID
const string PageOne = "PAGE ONE";
const string PageThree = "PAGE THREE";
#else
const string PageOne = "Page One";
const string PageThree = "Page Three";
#endif
public Issue198(TestDevice testDevice) : base(testDevice)
{
}

public override string Issue => "TabbedPage shouldn't proxy content of NavigationPage";

// [Test]
// [Category(UITestCategories.TabbedPage)]
// [FailsOnIOSWhenRunningOnXamarinUITest]
// public void Issue198TestsNREWithPopModal()
// {
// App.WaitForElement(q => q.Marked("Page One"));
// App.WaitForElement(q => q.Button("Leave"));
// App.Screenshot("All Elements Present");

// App.Tap(q => q.Marked("Leave"));
// App.Screenshot("Clicked Leave");

// App.WaitForElement(q => q.Marked("Bug Repro's"));
// #if !__MACOS__
// App.ClearText(q => q.Raw("* marked:'SearchBarGo'"));
// App.EnterText(q => q.Raw("* marked:'SearchBarGo'"), "G198");
// #endif
// App.Tap(q => q.Marked("SearchButton"));
// App.Screenshot("Navigate into gallery again");

// App.WaitForElement(q => q.Marked("Page Three"));
// App.Tap(q => q.Marked("Page Three"));

// App.WaitForElement(q => q.Marked("No Crash"));
// App.Screenshot("App did not crash");
// }
}
[Test]
[Category(UITestCategories.TabbedPage)]
public void Issue198TestsNREWithPopModal()
{
App.WaitForElement(PageOne);
App.WaitForElement("Leave");

App.Tap("Leave");

// Due to the current architecture of the HostApp, we cannot navigate back to the Bug Repro's page.
// Also it's not recommended to place a TabbedPage into a NavigationPage.
// App.WaitForElement("Bug Repro's");
// App.EnterText("SearchBarGo", "G198");
// App.Tap("SearchButton");

App.WaitForElement(PageThree);
App.Tap(PageThree);

App.WaitForElement("No Crash");
}
}
Loading