MWPJ test sometimes fails a ui check, add a small wait to allow ui to wrap up, Fixes AB#3537393#3014
MWPJ test sometimes fails a ui check, add a small wait to allow ui to wrap up, Fixes AB#3537393#3014
Conversation
|
✅ Work item link check complete. Description contains link AB#3537393 to an Azure Boards work item. |
1 similar comment
|
✅ Work item link check complete. Description contains link AB#3537393 to an Azure Boards work item. |
|
❌ Work item link check failed. Description contains AB#3537393 but the Bot could not link it to an Azure Boards work item. Click here to learn more. |
1 similar comment
|
❌ Work item link check failed. Description contains AB#3537393 but the Bot could not link it to an Azure Boards work item. Click here to learn more. |
There was a problem hiding this comment.
Pull request overview
This PR aims to reduce flakiness in the Multiple WPJ (MWPJ) UI automation flow by adding additional waiting time after triggering “unregister”, to avoid racing the UI result dialog.
Changes:
- Add a 6-second
ThreadUtils.sleepSafely(...)delay after clicking the unregister button before asserting the “Removed” dialog text.
| launch(); | ||
| selectDeviceRegistrationRecord(identifier); | ||
| clickButton(UNREGISTER_BUTTON_ID); | ||
| ThreadUtils.sleepSafely(6000, "unregister", "Interrupted"); |
There was a problem hiding this comment.
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").
| 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."); | |
| } |
MWPJ test sometimes fails a ui check, add a small wait to allow ui to wrap up
AB#3537393