Fix rename integration test#12634
Merged
davidwengier merged 2 commits intodotnet:mainfrom Jan 5, 2026
Merged
Conversation
ToddGrun
reviewed
Jan 5, 2026
src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/EditorInProcess_Text.cs
Outdated
Show resolved
Hide resolved
ToddGrun
reviewed
Jan 5, 2026
| await TestServices.RazorProjectSystem.WaitForComponentTagNameAsync(RazorProjectConstants.BlazorProjectName, "MyComponent", ControlledHangMitigatingCancellationToken); | ||
| await TestServices.Editor.WaitForComponentClassificationAsync(ControlledHangMitigatingCancellationToken); | ||
|
|
||
| await TestServices.SolutionExplorer.OpenFileAsync(RazorProjectConstants.BlazorProjectName, "MyComponent.cs", ControlledHangMitigatingCancellationToken); |
Contributor
Member
Author
There was a problem hiding this comment.
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.
Contributor
There was a problem hiding this comment.
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.
ToddGrun
reviewed
Jan 5, 2026
|
|
||
| await TestServices.Editor.PlaceCaretAsync(position, ControlledHangMitigatingCancellationToken); | ||
|
|
||
| await Task.Delay(500); |
Contributor
Member
Author
There was a problem hiding this comment.
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.
davidwengier
commented
Jan 5, 2026
src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/EditorInProcess_Text.cs
Outdated
Show resolved
Hide resolved
…nProcess/EditorInProcess_Text.cs
This was referenced Jan 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.