Skip to content

Commit 5b80786

Browse files
[Testing] Enabling some UITests from Issues folder in Appium-3 (#27065)
* Migrated the eight issues * Updated Issue7338.cs
1 parent 4b51243 commit 5b80786

File tree

10 files changed

+81
-94
lines changed

10 files changed

+81
-94
lines changed

src/Controls/tests/TestCases.HostApp/Issues/Issue2929.cs

-47
Original file line numberDiff line numberDiff line change
@@ -25,51 +25,4 @@ protected override void Init()
2525
};
2626
}
2727
}
28-
29-
30-
[Issue(IssueTracker.None, 99, "Make sure setting ItemSource to null doesn't blow up",
31-
PlatformAffected.UWP)]
32-
public class SetListViewItemSourceToNull : TestContentPage
33-
{
34-
const string Success = "Success";
35-
const string Go = "Go";
36-
37-
protected override void Init()
38-
{
39-
var lv = new ListView();
40-
var itemSource = new List<string>
41-
{
42-
"One",
43-
"Two",
44-
"Three"
45-
};
46-
lv.ItemsSource = itemSource;
47-
48-
var result = new Label();
49-
50-
var button = new Button { AutomationId = Go, Text = Go };
51-
52-
button.Clicked += (sender, args) =>
53-
{
54-
lv.ItemsSource = null;
55-
result.Text = Success;
56-
};
57-
58-
var instructions = new Label
59-
{
60-
Text = $"Tap the '{Go}' button. If the '{Success}' label is visible, this test has passed."
61-
};
62-
63-
Content = new StackLayout
64-
{
65-
Children =
66-
{
67-
instructions,
68-
button,
69-
result,
70-
lv
71-
}
72-
};
73-
}
74-
}
7528
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
namespace Maui.Controls.Sample.Issues
2+
{
3+
[Issue(IssueTracker.None, 99, "Make sure setting ItemSource to null doesn't blow up",
4+
PlatformAffected.UWP)]
5+
public class SetListViewItemSourceToNull : TestContentPage
6+
{
7+
const string Success = "Success";
8+
const string Go = "Go";
9+
10+
protected override void Init()
11+
{
12+
var lv = new ListView();
13+
var itemSource = new List<string>
14+
{
15+
"One",
16+
"Two",
17+
"Three"
18+
};
19+
lv.ItemsSource = itemSource;
20+
21+
var result = new Label();
22+
23+
var button = new Button { AutomationId = Go, Text = Go };
24+
25+
button.Clicked += (sender, args) =>
26+
{
27+
lv.ItemsSource = null;
28+
result.Text = Success;
29+
};
30+
31+
var instructions = new Label
32+
{
33+
Text = $"Tap the '{Go}' button. If the '{Success}' label is visible, this test has passed."
34+
};
35+
36+
Content = new StackLayout
37+
{
38+
Children =
39+
{
40+
instructions,
41+
button,
42+
result,
43+
lv
44+
}
45+
};
46+
}
47+
}
48+
}

src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2929.cs

-19
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ namespace Microsoft.Maui.TestCases.Tests.Issues
77
public class Issue2929 : _IssuesUITest
88
{
99
const string Success = "Success";
10-
const string Go = "Go";
11-
1210
public Issue2929(TestDevice testDevice) : base(testDevice)
1311
{
1412
}
@@ -17,27 +15,10 @@ public Issue2929(TestDevice testDevice) : base(testDevice)
1715

1816
[Test]
1917
[Category(UITestCategories.ListView)]
20-
[Category(UITestCategories.Compatibility)]
21-
[FailsOnAndroidWhenRunningOnXamarinUITest]
22-
[FailsOnIOSWhenRunningOnXamarinUITest]
23-
[FailsOnMacWhenRunningOnXamarinUITest]
2418
public void NullItemSourceDoesNotCrash()
2519
{
2620
// If we can see the Success label, it means we didn't crash.
2721
App.WaitForElement(Success);
2822
}
29-
30-
[Test]
31-
[Category(UITestCategories.ListView)]
32-
[Category(UITestCategories.Compatibility)]
33-
[FailsOnAllPlatformsWhenRunningOnXamarinUITest]
34-
public void SettingItemsSourceToNullDoesNotCrash()
35-
{
36-
App.WaitForElement(Go);
37-
App.Tap(Go);
38-
39-
// If we can see the Success label, it means we didn't crash.
40-
App.WaitForElement(Success);
41-
}
4223
}
4324
}

src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2963.cs

+2-6
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,11 @@ public Issue2963(TestDevice testDevice) : base(testDevice)
1818

1919
[Test]
2020
[Category(UITestCategories.Compatibility)]
21-
[FailsOnAndroidWhenRunningOnXamarinUITest]
22-
[FailsOnIOSWhenRunningOnXamarinUITest]
23-
[FailsOnMacWhenRunningOnXamarinUITest]
2421
public void Issue2963Test()
2522
{
26-
App.Screenshot("I am at Issue 2963");
23+
App.WaitForElement(EditorId);
2724
App.Tap(EditorId);
28-
ClassicAssert.AreEqual("False", App.FindElement(FocusedLabelId).GetText());
29-
App.Screenshot("Label should still be false");
25+
Assert.That(App.FindElement(FocusedLabelId).GetText(), Is.EqualTo("False"));
3026
}
3127
}
3228
}

src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3273.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,11 @@ public Issue3273(TestDevice testDevice) : base(testDevice)
1414

1515
[Test]
1616
[Category(UITestCategories.Gestures)]
17-
[Category(UITestCategories.Compatibility)]
18-
[FailsOnAndroidWhenRunningOnXamarinUITest]
19-
[FailsOnIOSWhenRunningOnXamarinUITest]
20-
[FailsOnMacWhenRunningOnXamarinUITest]
2117
public void Issue3273Test()
2218
{
2319
App.WaitForElement("Move items");
2420
App.Tap("Move items");
25-
App.WaitForNoElement("Success");
21+
App.WaitForElement("Success");
2622
}
2723
}
2824
}

src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue465.cs

-4
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,12 @@ public Issue465(TestDevice testDevice) : base(testDevice)
1414

1515
[Test]
1616
[Category(UITestCategories.Navigation)]
17-
[Category(UITestCategories.Compatibility)]
18-
[FailsOnAndroidWhenRunningOnXamarinUITest]
1917
public void Issue465TestsPushPopModal()
2018
{
2119
App.WaitForElement("PopPage");
22-
App.Screenshot("All elements exist");
2320

2421
App.Tap("PopPage");
2522
App.WaitForElement("Popppppped");
26-
App.Screenshot("Popped modal successful");
2723
}
2824
}
2925
}

src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue6260.cs

-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ public Issue6260(TestDevice testDevice) : base(testDevice)
1717

1818
[Test]
1919
[Category(UITestCategories.Layout)]
20-
[Category(UITestCategories.Compatibility)]
21-
[FailsOnAndroidWhenRunningOnXamarinUITest]
22-
[FailsOnMacWhenRunningOnXamarinUITest]
23-
[FailsOnWindowsWhenRunningOnXamarinUITest]
2420
public void NonAppCompatBasicSwitchTest()
2521
{
2622
App.WaitForElement(success);

src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue7338.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ public Issue7338(TestDevice testDevice) : base(testDevice)
1616

1717
[Test]
1818
[Category(UITestCategories.CollectionView)]
19-
[Category(UITestCategories.Compatibility)]
20-
[FailsOnAndroidWhenRunningOnXamarinUITest]
21-
[FailsOnMacWhenRunningOnXamarinUITest]
22-
[FailsOnWindowsWhenRunningOnXamarinUITest]
23-
public void Issue3273Test()
19+
public void Issue7338Test()
2420
{
2521
// If the instructions are visible at all, then this has succeeded
2622
App.WaitForElement(Success);

src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue7371.cs

-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ public Issue7371(TestDevice testDevice) : base(testDevice)
1414

1515
[Test]
1616
[Category(UITestCategories.RefreshView)]
17-
[Category(UITestCategories.Compatibility)]
18-
[FailsOnAndroidWhenRunningOnXamarinUITest]
19-
[FailsOnMacWhenRunningOnXamarinUITest]
20-
[FailsOnWindowsWhenRunningOnXamarinUITest]
2117
public async Task RefreshingListViewCrashesWhenDisposedTest()
2218
{
2319
await Task.Delay(500);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using NUnit.Framework;
2+
using UITest.Appium;
3+
using UITest.Core;
4+
5+
namespace Microsoft.Maui.TestCases.Tests.Issues
6+
{
7+
public class SetListViewItemSourceToNull : _IssuesUITest
8+
{
9+
const string Success = "Success";
10+
const string Go = "Go";
11+
12+
public SetListViewItemSourceToNull(TestDevice testDevice) : base(testDevice)
13+
{
14+
}
15+
16+
public override string Issue => "Make sure setting ItemSource to null doesn't blow up";
17+
18+
[Test]
19+
[Category(UITestCategories.ListView)]
20+
public void SettingItemsSourceToNullDoesNotCrash()
21+
{
22+
App.WaitForElement(Go);
23+
App.Tap(Go);
24+
25+
// If we can see the Success label, it means we didn't crash.
26+
App.WaitForElement(Success);
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)