Skip to content

Commit

Permalink
Ignore orientation CarV test for Mac (#22934)
Browse files Browse the repository at this point in the history
* Ignore orientation CarV test for Mac

* - don't throw if appium closing code fails

* - remove tests causing noise
  • Loading branch information
PureWeen authored Jun 8, 2024
1 parent afeadc4 commit 016cadf
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ public void CarouselViewGoToPreviousCurrentItem()
CheckLabelValue("lblSelected", previousIndex);
}

// Catalyst doesn't support orientation changes
#if !MACCATALYST
[Test]
[Category(UITestCategories.CarouselView)]
public async Task CarouselViewKeepPositionChangingOrientation()
Expand All @@ -89,7 +91,9 @@ public async Task CarouselViewKeepPositionChangingOrientation()
CheckLabelValue("lblPosition", index);
CheckLabelValue("lblCurrentItem", index);
}
#if !ANDROID
#endif

#if IOS || WINDOWS
[Test]
[Category(UITestCategories.CarouselView)]
public void NavigateBackWhenLooped()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,32 @@ public CollectionViewItemsUpdatingScrollModeUITests(TestDevice device)

public override string Issue => "CollectionView ItemsUpdatingScrollMode";

[OneTimeTearDown]
public void CollectionViewItemsUpdatingScrollModeOneTimeTearDown()
{
this.Back();
}
protected override bool ResetAfterEachTest => true;

#if ANDROID
// KeepScrollOffset (src\Compatibility\ControlGallery\src\Issues.Shared\CollectionViewItemsUpdatingScrollMode.cs)
[Test]
[Category(UITestCategories.CollectionView)]
[FailsOnIOS("This test is failing, likely due to product issue")]
[FailsOnMac("This test is failing, likely due to product issue")]
[FailsOnWindows("This test is failing, likely due to product issue")]
public void KeepItemsInView()
{
if (Device == TestDevice.Android)
{
App.WaitForElement("ScrollToMiddle");
App.Click("ScrollToMiddle");
App.WaitForNoElement("Vegetables.jpg, 10");

for (int n = 0; n < 25; n++)
{
App.Click("AddItemAbove");
}
App.WaitForElement("ScrollToMiddle");
App.Click("ScrollToMiddle");
App.WaitForNoElement("Vegetables.jpg, 10");

App.WaitForNoElement("Vegetables.jpg, 10");
}
else
for (int n = 0; n < 25; n++)
{
Assert.Ignore("This test is failing, requires research.");
App.Click("AddItemAbove");
}

App.WaitForNoElement("Vegetables.jpg, 10");
}
#endif

// KeepScrollOffset (src\Compatibility\ControlGallery\src\Issues.Shared\CollectionViewItemsUpdatingScrollMode.cs)
[Test]
//[Test]
[Category(UITestCategories.CollectionView)]
[FailsOnAllPlatforms("This test is failing, likely due to product issue")]
public void KeepScrollOffset()
Expand All @@ -61,7 +55,7 @@ public void KeepScrollOffset()
}

// KeepLastItemInView(src\Compatibility\ControlGallery\src\Issues.Shared\CollectionViewItemsUpdatingScrollMode.cs)
[Test]
//[Test]
[Category(UITestCategories.CollectionView)]
[FailsOnAllPlatforms("This test is failing, likely due to product issue")]
public void KeepLastItemInView()
Expand Down
41 changes: 23 additions & 18 deletions src/TestUtils/src/UITest.Appium/Actions/AppiumLifecycleActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,36 +127,41 @@ CommandResponse CloseApp(IDictionary<string, object> parameters)
}
catch (Exception)
{
// TODO Pass in logger so we can log these exceptions

// Occasionally the app seems to get so locked up it can't
// even report back the appstate. In that case, we'll just
// try to trigger a reset.
}

if (_app.GetTestDevice() == TestDevice.Mac)
try
{
_app.Driver.ExecuteScript("macos: terminateApp", new Dictionary<string, object>
if (_app.GetTestDevice() == TestDevice.Mac)
{
{ "bundleId", _app.GetAppId() },
});
}
else if (_app.GetTestDevice() == TestDevice.Windows)
{
#pragma warning disable CS0618 // Type or member is obsolete
_app.Driver.CloseApp();
#pragma warning restore CS0618 // Type or member is obsolete
}
else
{
try
_app.Driver.ExecuteScript("macos: terminateApp", new Dictionary<string, object>
{
{ "bundleId", _app.GetAppId() },
});
}
else if (_app.GetTestDevice() == TestDevice.Windows)
{
_app.Driver.TerminateApp(_app.GetAppId());
#pragma warning disable CS0618 // Type or member is obsolete
_app.Driver.CloseApp();
#pragma warning restore CS0618 // Type or member is obsolete
}
catch (Exception)
else
{
// Occasionally the app seems like it's already closed before we get here
// and then this throws an exception
_app.Driver.TerminateApp(_app.GetAppId());
}
}
catch (Exception)
{
// TODO Pass in logger so we can log these exceptions

// Occasionally the app seems like it's already closed before we get here
// and then this throws an exception.
return CommandResponse.FailedEmptyResponse;
}

return CommandResponse.SuccessEmptyResponse;
}
Expand Down

0 comments on commit 016cadf

Please sign in to comment.