Skip to content

Commit

Permalink
chore: Retry calendar open/close test
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Oct 4, 2024
1 parent 81d69be commit da9268b
Showing 1 changed file with 33 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -276,46 +276,50 @@ public async Task CanOpenCloseFlyoutBySettingIsCalendarOpen()
{
TestCleanupWrapper cleanup;

Grid rootPanel = null;
CalendarDatePickerHelper helper = new CalendarDatePickerHelper();
await helper.PrepareLoadedEvent();
Microsoft.UI.Xaml.Controls.CalendarDatePicker cp = await helper.GetCalendarDatePicker();
// This test may be unstable on iOS
await TestHelper.RetryAssert(async () =>
{
Grid rootPanel = null;
CalendarDatePickerHelper helper = new CalendarDatePickerHelper();
await helper.PrepareLoadedEvent();
Microsoft.UI.Xaml.Controls.CalendarDatePicker cp = await helper.GetCalendarDatePicker();

rootPanel = await CreateTestResources();
rootPanel = await CreateTestResources();

// load into visual tree
await RunOnUIThread(() =>
{
rootPanel.Children.Append(cp);
});
// load into visual tree
await RunOnUIThread(() =>
{
rootPanel.Children.Append(cp);
});

await helper.WaitForLoaded();
await helper.WaitForLoaded();

await TestServices.WindowHelper.WaitForIdle();
await TestServices.WindowHelper.WaitForIdle();

await helper.PrepareOpenedEvent();
await helper.PrepareOpenedEvent();

await RunOnUIThread(() =>
{
cp.IsCalendarOpen = true;
});
await helper.WaitForOpened();
await RunOnUIThread(() =>
{
cp.IsCalendarOpen = true;
});
await helper.WaitForOpened();

await helper.PrepareClosedEvent();
await helper.PrepareClosedEvent();

await RunOnUIThread(() =>
{
cp.IsCalendarOpen = false;
});
await RunOnUIThread(() =>
{
cp.IsCalendarOpen = false;
});

await helper.WaitForClosed();
await helper.WaitForClosed();

await RunOnUIThread(() =>
{
// disable CP to make sure input pane is not open during clean up.
cp.IsEnabled = false;
await RunOnUIThread(() =>
{
// disable CP to make sure input pane is not open during clean up.
cp.IsEnabled = false;
});
await TestServices.WindowHelper.WaitForIdle();
});
await TestServices.WindowHelper.WaitForIdle();
}

[TestMethod]
Expand Down

0 comments on commit da9268b

Please sign in to comment.