Skip to content

Commit 016cadf

Browse files
authored
Ignore orientation CarV test for Mac (#22934)
* Ignore orientation CarV test for Mac * - don't throw if appium closing code fails * - remove tests causing noise
1 parent afeadc4 commit 016cadf

File tree

3 files changed

+43
-40
lines changed

3 files changed

+43
-40
lines changed

src/Controls/tests/TestCases.Shared.Tests/Tests/CarouselViewUITests.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ public void CarouselViewGoToPreviousCurrentItem()
7070
CheckLabelValue("lblSelected", previousIndex);
7171
}
7272

73+
// Catalyst doesn't support orientation changes
74+
#if !MACCATALYST
7375
[Test]
7476
[Category(UITestCategories.CarouselView)]
7577
public async Task CarouselViewKeepPositionChangingOrientation()
@@ -89,7 +91,9 @@ public async Task CarouselViewKeepPositionChangingOrientation()
8991
CheckLabelValue("lblPosition", index);
9092
CheckLabelValue("lblCurrentItem", index);
9193
}
92-
#if !ANDROID
94+
#endif
95+
96+
#if IOS || WINDOWS
9397
[Test]
9498
[Category(UITestCategories.CarouselView)]
9599
public void NavigateBackWhenLooped()

src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/CollectionViewUITests.CollectionViewItemsUpdatingScrollMode.cs

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,32 @@ public CollectionViewItemsUpdatingScrollModeUITests(TestDevice device)
1313

1414
public override string Issue => "CollectionView ItemsUpdatingScrollMode";
1515

16-
[OneTimeTearDown]
17-
public void CollectionViewItemsUpdatingScrollModeOneTimeTearDown()
18-
{
19-
this.Back();
20-
}
16+
protected override bool ResetAfterEachTest => true;
2117

18+
#if ANDROID
2219
// KeepScrollOffset (src\Compatibility\ControlGallery\src\Issues.Shared\CollectionViewItemsUpdatingScrollMode.cs)
2320
[Test]
2421
[Category(UITestCategories.CollectionView)]
22+
[FailsOnIOS("This test is failing, likely due to product issue")]
23+
[FailsOnMac("This test is failing, likely due to product issue")]
24+
[FailsOnWindows("This test is failing, likely due to product issue")]
2525
public void KeepItemsInView()
2626
{
27-
if (Device == TestDevice.Android)
28-
{
29-
App.WaitForElement("ScrollToMiddle");
30-
App.Click("ScrollToMiddle");
31-
App.WaitForNoElement("Vegetables.jpg, 10");
32-
33-
for (int n = 0; n < 25; n++)
34-
{
35-
App.Click("AddItemAbove");
36-
}
27+
App.WaitForElement("ScrollToMiddle");
28+
App.Click("ScrollToMiddle");
29+
App.WaitForNoElement("Vegetables.jpg, 10");
3730

38-
App.WaitForNoElement("Vegetables.jpg, 10");
39-
}
40-
else
31+
for (int n = 0; n < 25; n++)
4132
{
42-
Assert.Ignore("This test is failing, requires research.");
33+
App.Click("AddItemAbove");
4334
}
35+
36+
App.WaitForNoElement("Vegetables.jpg, 10");
4437
}
38+
#endif
4539

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

6357
// KeepLastItemInView(src\Compatibility\ControlGallery\src\Issues.Shared\CollectionViewItemsUpdatingScrollMode.cs)
64-
[Test]
58+
//[Test]
6559
[Category(UITestCategories.CollectionView)]
6660
[FailsOnAllPlatforms("This test is failing, likely due to product issue")]
6761
public void KeepLastItemInView()

src/TestUtils/src/UITest.Appium/Actions/AppiumLifecycleActions.cs

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -127,36 +127,41 @@ CommandResponse CloseApp(IDictionary<string, object> parameters)
127127
}
128128
catch (Exception)
129129
{
130+
// TODO Pass in logger so we can log these exceptions
131+
130132
// Occasionally the app seems to get so locked up it can't
131133
// even report back the appstate. In that case, we'll just
132134
// try to trigger a reset.
133135
}
134136

135-
if (_app.GetTestDevice() == TestDevice.Mac)
137+
try
136138
{
137-
_app.Driver.ExecuteScript("macos: terminateApp", new Dictionary<string, object>
139+
if (_app.GetTestDevice() == TestDevice.Mac)
138140
{
139-
{ "bundleId", _app.GetAppId() },
140-
});
141-
}
142-
else if (_app.GetTestDevice() == TestDevice.Windows)
143-
{
144-
#pragma warning disable CS0618 // Type or member is obsolete
145-
_app.Driver.CloseApp();
146-
#pragma warning restore CS0618 // Type or member is obsolete
147-
}
148-
else
149-
{
150-
try
141+
_app.Driver.ExecuteScript("macos: terminateApp", new Dictionary<string, object>
142+
{
143+
{ "bundleId", _app.GetAppId() },
144+
});
145+
}
146+
else if (_app.GetTestDevice() == TestDevice.Windows)
151147
{
152-
_app.Driver.TerminateApp(_app.GetAppId());
148+
#pragma warning disable CS0618 // Type or member is obsolete
149+
_app.Driver.CloseApp();
150+
#pragma warning restore CS0618 // Type or member is obsolete
153151
}
154-
catch (Exception)
152+
else
155153
{
156-
// Occasionally the app seems like it's already closed before we get here
157-
// and then this throws an exception
154+
_app.Driver.TerminateApp(_app.GetAppId());
158155
}
159156
}
157+
catch (Exception)
158+
{
159+
// TODO Pass in logger so we can log these exceptions
160+
161+
// Occasionally the app seems like it's already closed before we get here
162+
// and then this throws an exception.
163+
return CommandResponse.FailedEmptyResponse;
164+
}
160165

161166
return CommandResponse.SuccessEmptyResponse;
162167
}

0 commit comments

Comments
 (0)