Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,24 @@ public void PullToRefreshWorksWhenEnabled()
{
// Find the scroll view content to perform pull gesture on
App.WaitForElement(ScrollViewContent);

// Perform pull-to-refresh
App.ScrollUp(ScrollViewContent);
App.WaitForTextToBePresentInElement(StatusLabel, "Refreshing...", timeout: TimeSpan.FromSeconds(5));

// Wait for refresh to complete and verify it worked
Assert.That(App.WaitForTextToBePresentInElement(StatusLabel, "Refresh completed", timeout: TimeSpan.FromSeconds(5)), Is.True);
bool refreshSucceeded = false;
for (int i = 0; i < 3 && !refreshSucceeded; i++)
{
// Perform pull-to-refresh
App.ScrollUp(ScrollViewContent, ScrollStrategy.Gesture, swipePercentage: 0.90, swipeSpeed: 1000);
try
{
// Wait for refresh to complete and verify it worked
App.WaitForTextToBePresentInElement(StatusLabel, "Refreshing...", timeout: TimeSpan.FromSeconds(5));
refreshSucceeded = App.WaitForTextToBePresentInElement(StatusLabel, "Refresh completed", timeout: TimeSpan.FromSeconds(5));
}

catch (Exception)
{
// Refresh not completed yet, will retry
}
Comment on lines +134 to +137
Copy link

Copilot AI Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Catching all exceptions with a generic Exception handler can mask important errors. Consider catching specific exceptions related to timeout or element not found scenarios, or at minimum log the exception details for debugging purposes.

Suggested change
catch (Exception)
{
// Refresh not completed yet, will retry
}
catch (WebDriverTimeoutException ex)
{
// Refresh not completed yet, will retry
TestContext.WriteLine($"Timeout waiting for refresh: {ex.Message}");
}
catch (NoSuchElementException ex)
{
// Element not found, will retry
TestContext.WriteLine($"Element not found during refresh: {ex.Message}");
}
catch (Exception ex)
{
// Unexpected exception, log details
TestContext.WriteLine($"Unexpected exception during refresh: {ex}");
}

Copilot uses AI. Check for mistakes.
}
Assert.That(refreshSucceeded, Is.True, "Pull-to-refresh did not complete after multiple attempts");
}

[Test]
Expand Down
Loading