1 write to TestServices
Microsoft.VisualStudioCode.Razor.IntegrationTests (1)
Services\VSCodeIntegrationTestBase.cs (1)
53TestServices = new IntegrationTestServices(_output, settings);
162 references to TestServices
Microsoft.VisualStudioCode.Razor.IntegrationTests (162)
CodeActionsTests.cs (11)
19await TestServices.Editor.OpenFileAsync("Components/Pages/Counter.razor"); 22await TestServices.Editor.GoToLineAsync(15); 23await TestServices.Input.TypeAsync("StringBuilder sb;"); 24await TestServices.Editor.SaveAsync(); 27await TestServices.Diagnostics.WaitForDiagnosticsAsync(expectErrors: true, timeout: TimeSpan.FromSeconds(10)); 30await TestServices.Editor.GoToWordAsync("StringBuilder"); 33var hasCodeActions = await TestServices.CodeAction.OpenQuickFixMenuAsync(); 37await TestServices.Input.PressAsync(SpecialKey.Enter); 40await TestServices.Editor.WaitForEditorDirtyAsync(); 43var text = await TestServices.Editor.WaitForEditorTextChangeAsync(); 47await TestServices.Diagnostics.WaitForDiagnosticsAsync(expectErrors: false, timeout: TimeSpan.FromSeconds(10));
CompletionTests.cs (24)
19await TestServices.Editor.OpenFileAsync("Components/Pages/Counter.razor"); 23await TestServices.Editor.GoToLineAsync(17); 24await TestServices.Input.PressAsync(SpecialKey.End); // Go to end of line 25await TestServices.Input.PressAsync(SpecialKey.Enter); // New line 28await TestServices.Input.TypeAsync("current"); 31var hasCompletions = await TestServices.Completion.WaitForListAsync(); 35hasCompletions = await TestServices.Completion.TriggerAsync(); 41var items = await TestServices.Completion.GetItemsAsync(); 51await TestServices.Editor.OpenFileAsync("Components/Pages/Counter.razor"); 54await TestServices.Editor.GoToLineAsync(5); 55await TestServices.Input.PressAsync(SpecialKey.End); 56await TestServices.Input.PressAsync(SpecialKey.Enter); 59await TestServices.Input.TypeAsync("<di"); 62var hasCompletions = await TestServices.Completion.WaitForListAsync(); 66await TestServices.Completion.TriggerAsync(); 70var items = await TestServices.Completion.GetItemsAsync(); 82await TestServices.Editor.OpenFileAsync("Components/Pages/Counter.razor"); 85await TestServices.Editor.GoToLineAsync(2); 86await TestServices.Input.PressAsync(SpecialKey.End); 87await TestServices.Input.PressAsync(SpecialKey.Enter); 90await TestServices.Input.TypeAsync("@in"); // Partial "@inject" 93var hasCompletions = await TestServices.Completion.WaitForListAsync(); 97await TestServices.Completion.TriggerAsync(); 101var items = await TestServices.Completion.GetItemsAsync();
DiagnosticsTests.cs (33)
19await TestServices.Editor.OpenFileAsync("Components/Pages/Home.razor"); 20await TestServices.Diagnostics.OpenProblemsPanelAsync(); 23await TestServices.Editor.SelectAllAsync(); 24await TestServices.Input.TypeAsync("@{ int x = 5 }"); // Missing semicolon 27await TestServices.Diagnostics.WaitForProblemAsync("CS1002", timeout: TimeSpan.FromSeconds(5)); 34await TestServices.Editor.OpenFileAsync("Components/Pages/Home.razor"); 35await TestServices.Diagnostics.OpenProblemsPanelAsync(); 38await TestServices.Editor.SelectAllAsync(); 39await TestServices.Input.TypeAsync("@{ int x = }"); // Missing value - CS1525 42await TestServices.Diagnostics.WaitForDiagnosticsAsync(expectErrors: true, timeout: TimeSpan.FromSeconds(5)); 45await TestServices.Input.PressAsync(SpecialKey.Backspace); 46await TestServices.Input.TypeAsync("5; }"); 49await TestServices.Diagnostics.WaitForDiagnosticsAsync(expectErrors: false, timeout: TimeSpan.FromSeconds(5)); 56await TestServices.Editor.OpenFileAsync("Components/Pages/Counter.razor"); 57await TestServices.Diagnostics.OpenProblemsPanelAsync(); 60await TestServices.Diagnostics.WaitForDiagnosticsAsync(expectErrors: false, timeout: TimeSpan.FromSeconds(10)); 63var hasErrors = await TestServices.Diagnostics.HasErrorsAsync(); 72var fileName = Path.Combine(TestServices.Workspace.WorkspacePath, "Components/Pages/Home.razor"); 77await TestServices.Editor.OpenFileAsync("Components/Pages/Home.razor"); 79await TestServices.Diagnostics.OpenProblemsPanelAsync(); 81await TestServices.Diagnostics.WaitForProblemAsync("RZ1034", timeout: TimeSpan.FromSeconds(5)); 83var problems = await TestServices.Diagnostics.GetProblemsAsync(); 92var fileName = Path.Combine(TestServices.Workspace.WorkspacePath, "Components/Pages/Home.razor"); 97await TestServices.Editor.OpenFileAsync("Components/Pages/Home.razor"); 99await TestServices.Diagnostics.OpenProblemsPanelAsync(); 101await TestServices.Diagnostics.WaitForProblemAsync("RZ9980", timeout: TimeSpan.FromSeconds(5)); 103var problems = await TestServices.Diagnostics.GetProblemsAsync(); 110var fileName = Path.Combine(TestServices.Workspace.WorkspacePath, "UnusedDirective.cshtml"); 117await TestServices.Editor.OpenFileAsync("UnusedDirective.cshtml"); 119await TestServices.Diagnostics.WaitForUnnecessaryCodeAsync(timeout: TimeSpan.FromSeconds(10)); 121var hasWarnings = await TestServices.Diagnostics.HasWarningsAsync(); 124await TestServices.Diagnostics.OpenProblemsPanelAsync(); 125var problems = await TestServices.Diagnostics.GetProblemsAsync();
FindReferencesTests.cs (8)
19await TestServices.Editor.OpenFileAsync("Components/Pages/Counter.razor"); 23await TestServices.Editor.GoToLineAsync(13, column: 17); 26await TestServices.Navigation.FindAllReferencesAsync(); 33var referencesCount = await TestServices.Navigation.GetReferencesCountAsync(); 41await TestServices.Editor.OpenFileAsync("Components/Pages/Counter.razor"); 45await TestServices.Editor.GoToLineAsync(15, column: 18); 48await TestServices.Navigation.FindAllReferencesAsync(); 53var referencesCount = await TestServices.Navigation.GetReferencesCountAsync();
FormattingTests.cs (18)
19await TestServices.Editor.OpenFileAsync("Components/Pages/Counter.razor"); 22await TestServices.Editor.GoToLineAsync(14); 23await TestServices.Input.PressAsync(SpecialKey.End); 24await TestServices.Input.PressAsync(SpecialKey.Enter); 25await TestServices.Input.TypeAsync("private string BadlyIndented=\"test\";"); 28await TestServices.Editor.SaveAsync(); 31await TestServices.Formatting.FormatDocumentAsync(); 34var afterFormat = await TestServices.Editor.WaitForEditorTextChangeAsync(); 43await TestServices.Editor.OpenFileAsync("Components/Pages/Counter.razor"); 46await TestServices.Editor.GoToLineAsync(5); 47await TestServices.Input.PressAsync(SpecialKey.End); 48await TestServices.Input.PressAsync(SpecialKey.Enter); 50await TestServices.Input.TypeAsync("<div>"); 52await TestServices.Input.TypeAsync("@"); 55await TestServices.Input.PressAsync(SpecialKey.Escape); 56await TestServices.Input.TypeAsync("{var x=1;}"); 59await TestServices.Formatting.FormatDocumentAsync(); 62var afterFormat = await TestServices.Editor.WaitForEditorTextChangeAsync();
GoToDefinitionTests.cs (17)
19await TestServices.Editor.OpenFileAsync("Components/Pages/Counter.razor"); 23await TestServices.Editor.GoToWordAsync("IncrementCount"); 26var beforePosition = await TestServices.Editor.GetCursorPositionAsync(); 31await TestServices.Navigation.GoToDefinitionAsync(); 34var afterPosition = await TestServices.Editor.GetCursorPositionAsync(); 43await TestServices.Editor.OpenFileAsync("Components/Pages/Counter.razor"); 46await TestServices.Editor.GoToLineAsync(17, column: 9); 48var beforePosition = await TestServices.Editor.GetCursorPositionAsync(); 53await TestServices.Navigation.GoToDefinitionAsync(); 56var afterPosition = await TestServices.Editor.GetCursorPositionAsync(); 65await TestServices.Editor.OpenFileAsync("Components/Pages/Home.razor"); 68await TestServices.Input.PressWithPrimaryModifierAsync(SpecialKey.End); 69await TestServices.Input.TypeAsync("\n<Counter />"); 70await TestServices.Editor.SaveAsync(); 73await TestServices.Editor.GoToWordAsync("Counter"); 76await TestServices.Navigation.GoToDefinitionAsync("Counter.razor"); 79var currentFile = await TestServices.Editor.GetCurrentFileNameAsync();
HoverTests.cs (9)
20await TestServices.Editor.OpenFileAsync("Components/Pages/Counter.razor"); 25await TestServices.Editor.GoToLineAsync(13, 17); 28var hoverContent = await TestServices.Hover.WaitForContentAsync(); 41await TestServices.Editor.OpenFileAsync("Components/Pages/Counter.razor"); 46await TestServices.Editor.GoToLineAsync(15, 18); 49var hoverContent = await TestServices.Hover.WaitForContentAsync(); 62await TestServices.Editor.OpenFileAsync("Components/Pages/Counter.razor"); 67await TestServices.Editor.GoToLineAsync(13, 13); 70var hoverContent = await TestServices.Hover.WaitForContentAsync();
Services\VSCodeIntegrationTestBase.cs (42)
42TestServices.Logger.Log($"Test '{testName}' failed: {ex.Message}"); 43await TestServices.Playwright.TakeScreenshotAsync($"FAILED_{testName}"); 44TestServices.VSCode.CollectLogsOnFailure(testName); 56TestServices.Logger.Log($"Environment: DISPLAY={Environment.GetEnvironmentVariable("DISPLAY") ?? "(not set)"}"); 57TestServices.Logger.Log($"OS: {Environment.OSVersion}"); 58TestServices.Logger.Log($"Initialization timeout: {settings.InitializationTimeout}"); 61TestServices.VSCode.ClearLogs(); 71TestServices.Logger.Log($"{currentStep}..."); 72await TestServices.VSCode.EnsureInstalledAsync().WaitAsync(cts.Token); 73TestServices.Logger.Log($"{currentStep} - Complete"); 77TestServices.Logger.Log($"{currentStep}..."); 78await TestServices.Workspace.CreateAsync().WaitAsync(cts.Token); 79TestServices.Logger.Log($"{currentStep} - Complete"); 83TestServices.Logger.Log($"{currentStep}..."); 84await TestServices.Playwright.InitializeAsync().WaitAsync(cts.Token); 85TestServices.Logger.Log($"{currentStep} - Complete"); 89TestServices.Logger.Log($"{currentStep}..."); 90await TestServices.VSCode.LaunchAsync(TestServices.Workspace.WorkspacePath).WaitAsync(cts.Token); 91TestServices.Logger.Log($"{currentStep} - Complete"); 95TestServices.Logger.Log($"{currentStep}..."); 96await TestServices.Playwright.ConnectAsync( 97TestServices.Settings.RemoteDebuggingPort, 98TestServices.Workspace.Name).WaitAsync(cts.Token); 99TestServices.Logger.Log($"{currentStep} - Complete"); 103TestServices.Logger.Log($"{currentStep}..."); 104await TestServices.VSCode.WaitForReadyAsync().WaitAsync(cts.Token); 105TestServices.Logger.Log($"{currentStep} - Complete"); 109TestServices.Logger.Log($"{currentStep}..."); 110await TestServices.VSCode.WaitForLspReadyAsync().WaitAsync(cts.Token); 111await TestServices.Razor.WaitForReadyAsync().WaitAsync(cts.Token); 112TestServices.Logger.Log($"{currentStep} - Complete"); 114TestServices.Logger.Log("Test initialization completed successfully"); 119TestServices.Logger.Log($"FATAL: {message}"); 121await TestServices.Playwright.TakeScreenshotAsync($"INIT_TIMEOUT_{stepName}"); 122TestServices.VSCode.CollectLogsOnFailure($"INIT_TIMEOUT_{stepName}"); 127TestServices.Logger.Log($"FATAL: Test initialization failed during {currentStep}: {ex.Message}"); 129await TestServices.Playwright.TakeScreenshotAsync($"INIT_FAILED_{stepName}"); 130TestServices.VSCode.CollectLogsOnFailure($"INIT_FAILED_{stepName}"); 137await TestServices.Playwright.DisposeAsync(); 138TestServices.VSCode.Stop(); 139TestServices.Workspace.Cleanup();