Skip to content

Stabilize ServerFormsTest.CanWireUpINotifyPropertyChangedToEditContext Quarantine test - #68166

Closed
vendasankarsf3945 wants to merge 2 commits into
dotnet:mainfrom
vendasankarsf3945:62386-serverforms-test
Closed

Stabilize ServerFormsTest.CanWireUpINotifyPropertyChangedToEditContext Quarantine test#68166
vendasankarsf3945 wants to merge 2 commits into
dotnet:mainfrom
vendasankarsf3945:62386-serverforms-test

Conversation

@vendasankarsf3945

Copy link
Copy Markdown
Contributor

Stabilize ServerFormsTest.CanWireUpINotifyPropertyChangedToEditContext Quarantine test

Description

This PR addresses failures in Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests.ServerFormsTest.CanWireUpINotifyPropertyChangedToEditContext.

The test could fail after mounting the NotifyPropertyChangedValidationComponent because child elements (.user-name) were looked up immediately after the component mount completed, before the component's render output had finished painting child nodes. This resulted in OpenQA.Selenium.NoSuchElementException being thrown for the .user-name selector instead of the test reaching its assertions.

To ensure the form's child inputs are present before subsequent FindElement calls, the test now waits explicitly for the .user-name element to exist after mounting the component.

Validation / Investigation

  1. The failure was analyzed and determined to occur in the test's CanWireUpINotifyPropertyChangedToEditContext scenario under high CI load.
  2. The original sequence called Browser.MountTestComponent<NotifyPropertyChangedValidationComponent>() and immediately invoked appElement.FindElement(By.ClassName("user-name")).
  3. MountTestComponent only waits for the <app> tag to exist, not for child elements. On slower machines, the component's child render output was not yet in the DOM when the FindElement call ran.
  4. Selenium's default 1-second implicit wait was insufficient under CI contention, producing the intermittent NoSuchElementException.
  5. Inserting Browser.Exists(By.ClassName("user-name")) between the mount call and the subsequent FindElement calls restores deterministic synchronization, matching the pattern used by other working tests in the same file.

Changes

  1. Added an explicit Browser.Exists(By.ClassName("user-name")) wait after Browser.MountTestComponent<NotifyPropertyChangedValidationComponent>() in the CanWireUpINotifyPropertyChangedToEditContext test.
  2. Ensured subsequent FindElement calls operate against a DOM that has finished rendering the form's child nodes.
  3. Preserved the existing test flow while stabilizing the lookup sequence against intermittent CI failures.
  4. Removed the QuarantinedTest attribute now that the test is stabilized.

Fixes #62386.

@vendasankarsf3945
vendasankarsf3945 requested a review from a team as a code owner August 3, 2026 12:11
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Aug 3, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Thanks for your PR, @vendasankarsf3945. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@ilonatommy

Copy link
Copy Markdown
Member

Interesting, this test is not blocked. @vendasankarsf3945, what was the failure rate before the fix? I am suspecting the issue you're trying to fix might be stale

@vendasankarsf3945

Copy link
Copy Markdown
Contributor Author

Hi @ilonatommy,

We tried to reproduce the issue by running the test 100 times locally but couldn't replicate it. Based on the details in #62386 and the failure in build #1070994 with NoSuchElementException for .user-name, I applied an assumption-based fix. The root cause is that MountTestComponent only waits for the tag, not child elements. Under CI load, rendering can be slower than the 1-second implicit wait, causing the race condition. The fix adds an explicit Browser.Exists wait to ensure child elements are rendered before FindElement calls, matching the pattern used by other tests in the same file. The change is minimal and uses existing infrastructure.

@ilonatommy

Copy link
Copy Markdown
Member

If there is not reproduction neither on CI nor on local machine, let's close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quarantine ServerFormsTest.CanWireUpINotifyPropertyChangedToEditContext

2 participants