Skip to content

Commit

Permalink
Enabled 21st set of Xamarin UI Tests (#19) (#26168)
Browse files Browse the repository at this point in the history
* Migrated Xamarin to Appium for Issue2470, Issue2767 ,Issue2794, Issue2883 and Issue8461

* Migrated Xamarin to Appium for Issue1028 , Issue264, Bugzilla30317, Bugzilla44338 (#18)



* updated the migrated test codes

* reverted the unwanted changes

* updated test category

* Removed unwanted changes

---------

Co-authored-by: Harish <harish.kumar@syncfusion.com>
  • Loading branch information
anandhan-rajagopal and HarishKumarSF4517 authored Nov 30, 2024
1 parent 0ec304f commit d483d70
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 106 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace Maui.Controls.Sample.Issues;


[Issue(IssueTracker.Github, 1028, "ViewCell in TableView raises exception - root page is ContentPage, Content is TableView", PlatformAffected.WinPhone, NavigationBehavior.PushModalAsync)]
[Issue(IssueTracker.Github, 1028, "ViewCell in TableView raises exception - root page is ContentPage, Content is TableView", PlatformAffected.WinPhone)]

public class Issue1028 : TestContentPage
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class AboutPage : ContentPage
public AboutPage()
{
BackgroundColor = Colors.Bisque;
Content = new Button { Text = "Close", Command = new Command(() => Navigation.PopModalAsync()) };
Content = new Button { Text = "CloseMe", Command = new Command(() => Navigation.PopModalAsync()) };

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ protected override void Init()
Content = new StackLayout
{
Orientation = StackOrientation.Vertical,
VerticalOptions = LayoutOptions.Start,
Children = { tableview, listview, listview2 }
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ protected override void Init()

page2.Content = grid;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ public void Bugzilla30317ItemSourceTabbedPage()
}
}
#endif
*/
*/
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ public Issue1028(TestDevice testDevice) : base(testDevice)

public override string Issue => "ViewCell in TableView raises exception - root page is ContentPage, Content is TableView";

// [Test]
// [Category(UITestCategories.TableView)]
// public void ViewCellInTableViewDoesNotCrash()
// {
// // If we can see this element, then we didn't crash.
// App.WaitForElement("Custom Slider View:");
// }
[Test]
[Category(UITestCategories.TableView)]
public void ViewCellInTableViewDoesNotCrash()
{
// If we can see this element, then we didn't crash.
App.WaitForElement("Custom Slider View:");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,56 @@ namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Issue2470 : _IssuesUITest
{
#if ANDROID
const string Generate = "GENERATE";
const string Results = "RESULTS";
#else
const string Generate = "Generate";
const string Results = "Results";
#endif
public Issue2470(TestDevice testDevice) : base(testDevice)
{
}

public override string Issue => "ObservableCollection changes do not update ListView";

//[Test]
//[Category(UITestCategories.ListView)]
//public void OnservableCollectionChangeListView()
//{
// // Tab 1
// App.Tap(q => q.Marked("Switch"));
// App.Screenshot("Switch On");
// App.Tap(q => q.Marked("Results"));

// // Tab 2
// App.WaitForElement(q => q.Marked("Entry 0 of 5"));
// App.WaitForElement(q => q.Marked("Entry 1 of 5"));
// App.WaitForElement(q => q.Marked("Entry 2 of 5"));
// App.WaitForElement(q => q.Marked("Entry 3 of 5"));
// App.WaitForElement(q => q.Marked("Entry 4 of 5"));
// App.Screenshot("Should be 5 elements");
// App.Tap(q => q.Marked("Generate"));

// // Tab 1
// App.Tap(q => q.Marked("Switch"));
// App.Screenshot("Switch Off");
// App.Tap(q => q.Marked("Results"));

// // Tab 2
// App.WaitForElement(q => q.Marked("Entry 0 of 2"));
// App.WaitForElement(q => q.Marked("Entry 1 of 2"));
// App.Screenshot("Should be 2 elements");

// // Tab 1
// App.Tap(q => q.Marked("Generate"));
// App.Tap(q => q.Marked("Switch"));
// App.Screenshot("Switch On");
// App.Tap(q => q.Marked("Results"));

// // Tab 2
// App.WaitForElement(q => q.Marked("Entry 0 of 5"));
// App.WaitForElement(q => q.Marked("Entry 1 of 5"));
// App.WaitForElement(q => q.Marked("Entry 2 of 5"));
// App.WaitForElement(q => q.Marked("Entry 3 of 5"));
// App.WaitForElement(q => q.Marked("Entry 4 of 5"));
// App.Screenshot("Should be 5 elements");
//}
[Test]
[Category(UITestCategories.ListView)]
public void OnservableCollectionChangeListView()
{
App.WaitForElement("Switch");
// Tab 1
App.Tap("Switch");
App.Tap(Results);

// Tab 2
App.WaitForElement("Entry 0 of 5");
App.WaitForElement("Entry 1 of 5");
App.WaitForElement("Entry 2 of 5");
App.WaitForElement("Entry 3 of 5");
App.WaitForElement("Entry 4 of 5");

App.Tap(Generate);

// Tab 1
App.Tap("Switch");
App.Tap(Results);

// Tab 2
App.WaitForElement("Entry 0 of 2");
App.WaitForElement("Entry 1 of 2");


// Tab 1
App.Tap(Generate);
App.Tap("Switch");
App.Tap(Results);

// Tab 2
App.WaitForElement("Entry 0 of 5");
App.WaitForElement("Entry 1 of 5");
App.WaitForElement("Entry 2 of 5");
App.WaitForElement("Entry 3 of 5");
App.WaitForElement("Entry 4 of 5");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,21 @@ public Issue264(TestDevice testDevice) : base(testDevice)

public override string Issue => "PopModal NRE";

// [Test]
// [Category(UITestCategories.DisplayAlert)]
// [FailsOnIOS]
// public void Issue264TestsPushAndPopModal()
// {
// App.WaitForElement(q => q.Marked("Home"));
// App.WaitForElement(q => q.Button("About"));
// App.Screenshot("All elements present");
[Test]
[Category(UITestCategories.Navigation)]
public void Issue264TestsPushAndPopModal()
{
App.WaitForElement("Home");
App.WaitForElement("About");

// App.Tap(q => q.Button("About"));
// App.WaitForElement(q => q.Button("Close"));
// App.Screenshot("Modal pushed");
App.Tap("About");
App.WaitForElement("CloseMe");

// App.Tap(q => q.Button("Close"));
// App.WaitForElement(q => q.Button("About"));
// App.Screenshot("Modal popped");
App.Tap("CloseMe");
App.WaitForElement("About");

// App.Tap(q => q.Button("Pop me"));
// App.WaitForElement(q => q.Marked("Bug Repro's"));
// App.Screenshot("No crash");
// }
// Due to the current architecture of the HostApp, we cannot navigate back to the Bug Repro's page.
// App.Tap("Pop me");
// App.WaitForElement("Bug Repro's");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ public Issue2767(TestDevice testDevice) : base(testDevice)

public override string Issue => "ArgumentException: NaN not valid for height";

// [Test]
// [Category(UITestCategories.Grid)]
// [FailsOnIOS]
// public void Issue2767Test()
// {
// App.WaitForElement("Label 1:1");
// Assert.IsEmpty(App.Query("Collapsed"));
// }
[Test]
[Category(UITestCategories.Layout)]

public void Issue2767Test()
{
App.WaitForElement("Label 1:1");
Assert.That(App.FindElements("Collapsed").Count, Is.EqualTo(0));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,37 @@ public Issue2883(TestDevice testDevice) : base(testDevice)

public override string Issue => "ViewCell IsEnabled set to false does not disable a cell in a TableView";

// [UITests.FailsOnIOSWhenRunningOnXamarinUITest]
// [Test]
// public void Issue2883TestDisabled ()
// {
// App.Screenshot ("I am at Issue 2883");
// App.Tap( c=> c.Marked("btnCustomCellTable"));
// App.WaitForNoElement( c=> c.Marked("Clicked"));
// App.Screenshot ("I dont see the disable cell");
// App.Tap( c=> c.Marked("btnCustomCellListView"));
// App.WaitForNoElement( c=> c.Marked("Clicked"));
// App.Screenshot ("I dont see the disable cell");
// }

// [UITests.FailsOnIOSWhenRunningOnXamarinUITest]
// [Test]
// public void Issue2883TestEnabled ()
// {

// App.Tap( c=> c.Marked("btnCustomCellTableEnabled"));
// App.Screenshot ("I see the cell that is enabled");
// App.WaitForElement( c=> c.Marked("Clicked"));
// App.Tap (c => c.Marked ("ok"));
// App.Tap( c=> c.Marked("btnCustomCellListViewEnabled"));
// App.WaitForElement( c=> c.Marked("Clicked"));
// App.Tap (c => c.Marked ("ok"));
// }
[Test]
public void Issue2883TestDisabled()
{
App.WaitForElement("btnCustomCellTable");
App.Tap("btnCustomCellTable");
App.WaitForNoElement("Clicked");

App.Tap("btnCustomCellListView");
App.WaitForNoElement("Clicked");

}


[Test]
public void Issue2883TestEnabled()
{
App.WaitForElement("btnCustomCellTableEnabled");
App.Tap("btnCustomCellTableEnabled");
App.WaitForElement("Clicked");
#if MACCATALYST // Unable to tap the ok button on the display alert using text. so here using the identifier for Mac.
App.Tap(AppiumQuery.ById("action-button--999"));
#else
App.Tap("ok");
#endif
App.WaitForElement("btnCustomCellListViewEnabled");
App.Tap("btnCustomCellListViewEnabled");
App.WaitForElement("Clicked");
#if MACCATALYST
App.Tap(AppiumQuery.ById("action-button--999"));
#else
App.Tap("ok");
#endif
}
}

0 comments on commit d483d70

Please sign in to comment.