139 references to TestServices
Microsoft.VisualStudioCode.Razor.IntegrationTests (139)
Services\CodeActionService.cs (3)
20
await
TestServices
.Input.PressWithPrimaryModifierAsync('.');
35
timeout ??=
TestServices
.Settings.LspTimeout;
41
await
TestServices
.Playwright.Page.Locator(".action-widget, .context-view.monaco-menu-container")
Services\CompletionServices.cs (8)
21
await
TestServices
.Input.PressWithPrimaryModifierAsync(SpecialKey.Space);
36
timeout ??=
TestServices
.Settings.LspTimeout;
41
await
TestServices
.Playwright.Page.Locator(".suggest-widget.visible")
67
var itemTexts = await
TestServices
.Playwright.Page.EvaluateAsync<string[]>(@"
105
TestServices
.Logger.Log($"Found {results.Count} completion items via JS");
108
TestServices
.Logger.Log($"First few items: {string.Join(", ", results.Take(5))}");
115
var debugInfo = await
TestServices
.Playwright.Page.EvaluateAsync<string>(@"
140
TestServices
.Logger.Log($"Suggest widget debug: {debugInfo}");
Services\DiagnosticsServices.cs (10)
18
var errorCount = await
TestServices
.Playwright.Page.Locator(".squiggly-error").CountAsync();
27
var warningCount = await
TestServices
.Playwright.Page.Locator(".squiggly-warning").CountAsync();
36
var unnecessaryCount = await
TestServices
.Playwright.Page.Locator(".monaco-editor .squiggly-inline-unnecessary").CountAsync();
45
timeout ??=
TestServices
.Settings.LspTimeout;
58
timeout ??=
TestServices
.Settings.LspTimeout;
71
await
TestServices
.Editor.ExecuteCommandAsync("View: Toggle Problems");
74
await
TestServices
.Playwright.Page.Locator(".markers-panel")
92
var problemItems = await
TestServices
.Playwright.Page.EvaluateAsync<string[]>(@"
110
TestServices
.Logger.Log($"Found {problems.Count} problems: {string.Join("; ", problems.Take(5))}");
121
timeout ??=
TestServices
.Settings.LspTimeout;
Services\EditorService.cs (42)
26
TestServices
.Logger.Log("WaitForEditorTextChangeAsync: No file currently open");
30
var filePath = Path.Combine(
TestServices
.Workspace.WorkspacePath, _currentOpenFile);
37
TestServices
.Logger.Log($"WaitForEditorTextChangeAsync: BEFORE contents ({originalContents.Length} chars):\n{originalContents}");
41
TestServices
.Logger.Log($"WaitForEditorTextChangeAsync: Failed to read original file: {ex.Message}");
68
TestServices
.Logger.Log($"WaitForEditorTextChangeAsync: AFTER contents ({currentContents.Length} chars):\n{currentContents}");
74
TestServices
.Logger.Log($"WaitForEditorTextChangeAsync: Timeout waiting for contents change, returning current contents");
84
TestServices
.Logger.Log($"WaitForEditorTextChangeAsync: AFTER contents (fallback, {currentContents.Length} chars):\n{currentContents}");
124
await
TestServices
.Playwright.Page.Locator(".quick-input-widget .quick-input-box input")
140
await
TestServices
.Playwright.Page.Locator(".quick-input-widget")
158
var activeTabLocator =
TestServices
.Playwright.Page.Locator(".tab.active .monaco-icon-label-container");
175
var statusText = await
TestServices
.Playwright.Page.EvaluateAsync<string?>(@"
232
await
TestServices
.Input.PressWithControlAsync('g');
235
await
TestServices
.Input.TypeAsync($"{line}:{column}");
236
await
TestServices
.Input.PressAsync(SpecialKey.Enter);
253
await
TestServices
.Input.PressWithPrimaryModifierAsync('a');
263
TestServices
.Logger.Log("Saving document.");
264
await
TestServices
.Input.PressWithPrimaryModifierAsync('s');
286
var dirtyCount = await
TestServices
.Playwright.Page.Locator(".tab.active.dirty").CountAsync();
288
TestServices
.Logger.Log("Dirty indicator: " + (isDirty ? "present" : "not present"));
299
await
TestServices
.Input.PressWithShiftPrimaryModifierAsync('p');
309
await
TestServices
.Input.TypeAsync(command);
315
var itemCount = await
TestServices
.Playwright.Page.Locator(".quick-input-list .monaco-list-row").CountAsync();
320
await
TestServices
.Input.PressAsync(SpecialKey.Enter);
333
await
TestServices
.Input.PressWithPrimaryModifierAsync('f');
336
await
TestServices
.Playwright.Page.Locator(".editor-widget.find-widget")
343
await
TestServices
.Input.TypeAsync(word);
349
await
TestServices
.Input.PressAsync(SpecialKey.Escape);
351
await
TestServices
.Input.PressAsync(SpecialKey.Escape);
356
await
TestServices
.Playwright.Page.Locator(".editor-widget.find-widget.visible")
366
await
TestServices
.Input.PressAsync(SpecialKey.Escape);
368
await
TestServices
.Playwright.TakeScreenshotAsync($"GoToWord_{word}_StillVisible");
378
await
TestServices
.Input.PressWithShiftAsync(SpecialKey.ArrowLeft);
384
await
TestServices
.Input.PressAsync(SpecialKey.ArrowLeft);
393
TestServices
.Logger.Log($"Opening file: {relativePath}");
396
await
TestServices
.Input.PressWithPrimaryModifierAsync('p');
399
await
TestServices
.Playwright.Page.Locator(".quick-input-widget .quick-input-box input")
406
await
TestServices
.Input.TypeAsync(relativePath);
412
var listItemCount = await
TestServices
.Playwright.Page.Locator(".quick-input-list .monaco-list-row").CountAsync();
417
await
TestServices
.Input.PressAsync(SpecialKey.Enter);
424
var activeTabLocator =
TestServices
.Playwright.Page.Locator(".tab.active .monaco-icon-label-container");
430
TestServices
.Settings.LspTimeout);
435
TestServices
.Logger.Log($"File opened: {relativePath}");
Services\FormattingServices.cs (6)
17
await
TestServices
.Editor.SaveAsync();
18
TestServices
.Logger.Log("Formatting document via command palette...");
19
await
TestServices
.Editor.ExecuteCommandAsync("Format Document");
20
TestServices
.Logger.Log("Format Document command executed");
21
await
TestServices
.Editor.WaitForEditorDirtyAsync();
22
TestServices
.Logger.Log("Editor is dirty after formatting");
Services\HoverServices.cs (5)
22
var cursorLocator =
TestServices
.Playwright.Page.Locator(".cursor");
34
await
TestServices
.Playwright.Page.Mouse.MoveAsync(box.X + (box.Width / 2), box.Y + (box.Height / 2));
49
timeout ??=
TestServices
.Settings.LspTimeout;
54
await
TestServices
.Playwright.Page.Locator(".monaco-hover-content").First
73
var hoverLocator =
TestServices
.Playwright.Page.Locator(".monaco-hover-content");
Services\InputService.cs (7)
32
await
TestServices
.Playwright.Page.Keyboard.TypeAsync(text, new Microsoft.Playwright.KeyboardTypeOptions { Delay = delayMs });
40
await
TestServices
.Playwright.Page.Keyboard.PressAsync(GetKeyString(key));
49
await
TestServices
.Playwright.Page.Keyboard.PressAsync($"Shift+{GetKeyString(key)}");
58
await
TestServices
.Playwright.Page.Keyboard.PressAsync($"{s_primaryModifier}+{key}");
67
await
TestServices
.Playwright.Page.Keyboard.PressAsync($"{s_primaryModifier}+{GetKeyString(key)}");
76
await
TestServices
.Playwright.Page.Keyboard.PressAsync($"{s_primaryModifier}+Shift+{key}");
86
await
TestServices
.Playwright.Page.Keyboard.PressAsync($"Control+{key}");
Services\NavigationServices.cs (14)
18
timeout ??=
TestServices
.Settings.LspTimeout;
19
var originalFile = await
TestServices
.Editor.GetCurrentFileNameAsync();
20
var originalPosition = await
TestServices
.Editor.GetCursorPositionAsync();
22
await
TestServices
.Input.PressAsync(SpecialKey.F12);
28
TestServices
.Editor.GetCurrentFileNameAsync,
38
var currentFile = await
TestServices
.Editor.GetCurrentFileNameAsync();
39
var currentPosition = await
TestServices
.Editor.GetCursorPositionAsync();
40
var peekVisible = await
TestServices
.Playwright.Page.Locator(".peekview-widget").CountAsync() > 0;
59
timeout ??=
TestServices
.Settings.LspTimeout;
61
await
TestServices
.Input.PressWithShiftAsync(SpecialKey.F12);
67
var peekViewCount = await
TestServices
.Playwright.Page.Locator(".peekview-widget").CountAsync();
68
var referencesPanelCount = await
TestServices
.Playwright.Page.Locator("[id='workbench.panel.referencesView']").CountAsync();
80
var peekItemsCount = await
TestServices
.Playwright.Page.Locator(".peekview-widget .monaco-list-row").CountAsync();
87
var panelItemsCount = await
TestServices
.Playwright.Page.Locator("[id='workbench.panel.referencesView'] .monaco-list-row").CountAsync();
Services\PlaywrightService.cs (20)
35
TestServices
.Logger.Log("Cannot take screenshot - page not connected");
39
var screenshotsDir =
TestServices
.Settings.ScreenshotsDir;
42
TestServices
.Logger.Log("Cannot take screenshot - ScreenshotsDir not configured");
62
TestServices
.Logger.Log($"Screenshot saved: {filepath}");
67
TestServices
.Logger.Log($"Failed to take screenshot: {ex.Message}");
78
TestServices
.Logger.Log("Ensuring Playwright browsers are installed...");
96
TestServices
.Logger.Log($"Connecting to VS Code via CDP: {cdpUrl}");
105
TestServices
.Logger.Log($"CDP connection attempt ({11 - retries}/10)...");
119
TestServices
.Logger.Log("CDP connection established, looking for workspace page...");
127
TestServices
.Logger.Log("Connected to VS Code workspace window successfully");
134
TestServices
.Logger.Log("Connected to VS Code (fallback to first page)");
139
TestServices
.Logger.Log($"Failed to connect (attempt {11 - retries}), retrying... ({ex.GetType().Name}: {ex.Message})");
150
TestServices
.Logger.Log($"Looking for workspace page with folder: {workspaceName}");
170
TestServices
.Logger.Log($"Found VS Code page with title: {title}");
174
TestServices
.Logger.Log("Matched workspace by title");
183
TestServices
.Logger.Log($"Explorer shows: {explorerText}");
186
TestServices
.Logger.Log("Matched workspace by explorer");
193
TestServices
.Logger.Log($"Error checking page: {ex.Message}");
200
TestServices
.Logger.Log("Only one VS Code page found, using it");
204
TestServices
.Logger.Log($"Found {pagesWithWorkbench.Count} VS Code pages, could not determine correct one");
Services\RazorService.cs (17)
20
TestServices
.Logger.Log("Waiting for Razor language server to be ready (checking semantic tokens)...");
26
TestServices
.Logger.Log($"Razor ready check attempt {attempt}...");
31
await
TestServices
.Editor.OpenFileAsync("Components/Pages/Home.razor");
35
await
TestServices
.Editor.GoToWordAsync("PageTitle", selectWord: false);
38
await
TestServices
.Editor.ExecuteCommandAsync("Developer: Inspect Editor Tokens and Scopes");
50
TestServices
.Logger.Log("Token inspector did not show razorComponentElement");
54
await
TestServices
.Input.PressAsync(SpecialKey.Escape);
57
await
TestServices
.Input.PressWithPrimaryModifierAsync('w');
61
var fileName = await
TestServices
.Editor.GetCurrentFileNameAsync();
68
TestServices
.Logger.Log($"Razor language server is ready - semantic tokens verified (attempt {attempt})");
72
TestServices
.Logger.Log($"Razor tokens not yet available (attempt {attempt}), retrying...");
80
TestServices
.Logger.Log($"Razor ready check attempt {attempt} failed: {ex.Message}");
85
await
TestServices
.Input.PressAsync(SpecialKey.Escape);
86
await
TestServices
.Input.PressWithPrimaryModifierAsync('w');
108
var tokenContent = await
TestServices
.Playwright.Page.EvaluateAsync<string?>(@"
147
TestServices
.Logger.Log("Token inspector content not found or no razorComponentElement");
151
TestServices
.Logger.Log($"Found razorComponentElement in token inspector");
Services\WorkspaceService.cs (7)
33
TestServices
.Logger.Log($"Creating test workspace at: {_workspacePath}");
57
TestServices
.Logger.Log($"dotnet new output: {output}");
58
TestServices
.Logger.Log($"dotnet new error: {error}");
62
TestServices
.Logger.Log("Test workspace created successfully");
65
TestServices
.Logger.Log("Restoring packages...");
92
TestServices
.Logger.Log("Packages restored");
105
TestServices
.Logger.Log("Workspace cleaned up");