Skip to content

Comments

Fix rename integration test#12634

Merged
davidwengier merged 2 commits intodotnet:mainfrom
davidwengier:FixIntegrationTest
Jan 5, 2026
Merged

Fix rename integration test#12634
davidwengier merged 2 commits intodotnet:mainfrom
davidwengier:FixIntegrationTest

Conversation

@davidwengier
Copy link
Member

One of these tests was trying to rename in a .cs file using a position from a Razor file, so that was never going to work.

The other one seemed to sometimes just not run the rename command, so I added a small delay. Hopefully that will help.

@davidwengier davidwengier requested a review from a team as a code owner January 5, 2026 03:18
await TestServices.RazorProjectSystem.WaitForComponentTagNameAsync(RazorProjectConstants.BlazorProjectName, "MyComponent", ControlledHangMitigatingCancellationToken);
await TestServices.Editor.WaitForComponentClassificationAsync(ControlledHangMitigatingCancellationToken);

await TestServices.SolutionExplorer.OpenFileAsync(RazorProjectConstants.BlazorProjectName, "MyComponent.cs", ControlledHangMitigatingCancellationToken);
Copy link
Contributor

Choose a reason for hiding this comment

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

OpenFileAsync

I'm a little confused, why doesn't the razor file need to be opened explicitly before the caret is moved?

Copy link
Member Author

Choose a reason for hiding this comment

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

The Razor is already open, because of the open: true in the above AddFileAsync call. This line was a bad copy-paste from a test that was trying to test rename from the C# file.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh, I didn't see the open parameter to AddFileAsync. Now it seems like the cs file's call to AddFileAsync should specify to not open the file, but it doesn't really matter.


await TestServices.Editor.PlaceCaretAsync(position, ControlledHangMitigatingCancellationToken);

await Task.Delay(500);
Copy link
Contributor

Choose a reason for hiding this comment

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

await Task.Delay(500);

never a fan of blanket delays. Is there any way we can poll or do something else to determine things are good to go?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is definitely worthy of follow up. Triggering a rename is just executing a VS command via DTE, so the only things we can probably wait for, that I'm aware of, are internal to Roslyn at the moment.

Copy link
Contributor

@ToddGrun ToddGrun left a comment

Choose a reason for hiding this comment

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

:shipit:

@davidwengier davidwengier merged commit 153e938 into dotnet:main Jan 5, 2026
10 checks passed
@davidwengier davidwengier deleted the FixIntegrationTest branch January 5, 2026 23:23
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jan 5, 2026
@davidwengier davidwengier modified the milestones: Next, 18.3 Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants