Skip to content
Closed
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 @@ -184,6 +184,7 @@ public void unregister(@NonNull final String identifier) {
launch();
selectDeviceRegistrationRecord(identifier);
clickButton(UNREGISTER_BUTTON_ID);
ThreadUtils.sleepSafely(6000, "unregister", "Interrupted");
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

Issue: ThreadUtils.sleepSafely(6000, ...) adds a fixed 6s delay before checking/dismissing the result dialog.
Impact: This slows the UI automation suite on every unregister and can still be flaky (if the dialog appears faster we waste time; if it appears slower than 6s + the existing FIND_UI_ELEMENT_TIMEOUT wait inside dismissDialogBoxAndGetText(), the assertion can still fail).
Recommendation: Replace the fixed sleep with an explicit wait on the dialog UI element (e.g., wait for DIALOG_BOX_RESOURCE_ID / the expected text using UiAutomator’s waitForExists/custom timeout such as FIND_UI_ELEMENT_TIMEOUT_LONG) and then call dismissDialogBoxAndAssertContainsText("Removed").

Suggested change
ThreadUtils.sleepSafely(6000, "unregister", "Interrupted");
final UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
final UiObject removedDialogText =
device.findObject(new UiSelector().textContains("Removed"));
final boolean dialogAppeared = removedDialogText.waitForExists(FIND_UI_ELEMENT_TIMEOUT);
if (!dialogAppeared) {
Assert.fail("Dialog with text containing 'Removed' did not appear within timeout.");
}

Copilot uses AI. Check for mistakes.
dismissDialogBoxAndAssertContainsText("Removed");
}

Expand Down
Loading