Skip to content

MWPJ test sometimes fails a ui check, add a small wait to allow ui to wrap up, Fixes AB#3537393#3014

Open
fadidurah wants to merge 1 commit intodevfrom
fadi/fix-mwpj
Open

MWPJ test sometimes fails a ui check, add a small wait to allow ui to wrap up, Fixes AB#3537393#3014
fadidurah wants to merge 1 commit intodevfrom
fadi/fix-mwpj

Conversation

@fadidurah
Copy link
Contributor

@fadidurah fadidurah commented Mar 12, 2026

MWPJ test sometimes fails a ui check, add a small wait to allow ui to wrap up

AB#3537393

@fadidurah fadidurah added the No-Changelog This Pull-Request has no associated changelog entry. label Mar 12, 2026
@fadidurah fadidurah requested a review from a team as a code owner March 12, 2026 18:37
Copilot AI review requested due to automatic review settings March 12, 2026 18:37
@github-actions
Copy link

✅ Work item link check complete. Description contains link AB#3537393 to an Azure Boards work item.

1 similar comment
@github-actions
Copy link

✅ Work item link check complete. Description contains link AB#3537393 to an Azure Boards work item.

@github-actions
Copy link

❌ 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
@github-actions
Copy link

❌ 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.

@github-actions github-actions bot changed the title MWPJ test sometimes fails a ui check, add a small wait to allow ui to wrap up MWPJ test sometimes fails a ui check, add a small wait to allow ui to wrap up, Fixes AB#3537393 Mar 12, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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");
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

No-Changelog This Pull-Request has no associated changelog entry.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants