Skip to content

Commit fc49617

Browse files
Copilotsnakex64
andcommitted
Revert aggressive optimizations, apply conservative delay reductions
Reverted all previous optimization changes and re-applied only safe, conservative optimizations: - Reduced drag/connect operation delays by removing redundant waits (450ms → 250ms, 350ms → 200ms) - Reduced zoom/pan delays (200ms → 100ms, 100ms → 50ms) - Reduced breakpoint test delays (300ms → 150ms) - Reduced UI test delays (500ms → 200ms) - Fixed DeleteConnectionBetweenEntryAndReturnNodes by waiting for nodes to be visible All 48 tests pass (same as baseline). Time reduced from 2.29min to 2.04min (11% improvement, 15s saved). Co-authored-by: snakex64 <39806655+snakex64@users.noreply.github.com>
1 parent 9dc8c37 commit fc49617

8 files changed

Lines changed: 138 additions & 168 deletions

src/NodeDev.EndToEndTests/Pages/HomePage.cs

Lines changed: 33 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ public async Task CreateNewProject()
3030

3131
await SearchNewProjectButton.ClickAsync();
3232

33-
// Wait for project explorer to be visible instead of fixed delay
34-
await SearchProjectExplorer.WaitForVisible();
33+
await Task.Delay(100);
3534
}
3635

3736
public async Task HasClass(string name)
@@ -46,20 +45,16 @@ public async Task ClickClass(string name)
4645

4746
public async Task OpenProjectExplorerProjectTab()
4847
{
49-
var projectTab = SearchProjectExplorerTabsHeader.GetByText("PROJECT");
50-
await projectTab.ClickAsync();
48+
await SearchProjectExplorerTabsHeader.GetByText("PROJECT").ClickAsync();
5149

52-
// Wait for project explorer content to be visible
53-
await SearchProjectExplorerClasses.First.WaitForVisible();
50+
await Task.Delay(100);
5451
}
5552

5653
public async Task OpenProjectExplorerClassTab()
5754
{
58-
var classTab = SearchProjectExplorerTabsHeader.GetByText("CLASS");
59-
await classTab.ClickAsync();
55+
await SearchProjectExplorerTabsHeader.GetByText("CLASS").ClickAsync();
6056

61-
// Wait for class explorer content to be visible
62-
await SearchClassExplorer.WaitForVisible();
57+
await Task.Delay(100);
6358
}
6459

6560
public async Task<ILocator> FindMethodByName(string name)
@@ -84,8 +79,7 @@ public async Task OpenMethod(string name)
8479
await locator.WaitForVisible();
8580
await locator.ClickAsync();
8681

87-
// Wait for graph canvas to be visible instead of fixed delay
88-
await SearchGraphCanvas.WaitForVisible();
82+
await Task.Delay(100); // Wait for method to open - reduced from 200ms
8983
}
9084

9185
public async Task SaveProject()
@@ -196,19 +190,18 @@ public async Task DragNodeTo(string nodeName, float targetX, float targetY)
196190
// Perform manual drag with proper event sequence for Blazor.Diagrams
197191
// 1. Move mouse to starting position
198192
await _user.Mouse.MoveAsync(sourceX, sourceY);
199-
200193
// 2. Press mouse button down (pointerdown event)
201194
await _user.Mouse.DownAsync();
202-
await Task.Delay(50); // Minimal delay for event propagation
195+
await Task.Delay(50); // Single delay for event propagation
203196

204197
// 3. Move mouse to target position with multiple steps (pointermove events)
205198
await _user.Mouse.MoveAsync(targetX, targetY, new() { Steps = 15 });
206199

207200
// 4. Release mouse button (pointerup event)
208201
await _user.Mouse.UpAsync();
209202

210-
// Wait for the UI to update after drag - reduced from 300ms
211-
await Task.Delay(100);
203+
// Wait for the UI to update after drag
204+
await Task.Delay(200); // Reduced from 300ms
212205
}
213206

214207
public async Task SetNodeInputValue(string nodeName, string inputName, string value)
@@ -280,10 +273,10 @@ public async Task ConnectPorts(string sourceNodeName, string sourcePortName, str
280273
// Perform drag from source port to target port using same approach as node dragging
281274
await _user.Mouse.MoveAsync(sourceX, sourceY);
282275
await _user.Mouse.DownAsync();
283-
await Task.Delay(50); // Minimal delay for event propagation
276+
await Task.Delay(50); // Single delay for event propagation
284277
await _user.Mouse.MoveAsync(targetX, targetY, new() { Steps = 20 });
285278
await _user.Mouse.UpAsync();
286-
await Task.Delay(100); // Wait for connection to be established - reduced from 200ms
279+
await Task.Delay(150); // Wait for connection to be established - reduced from 200ms
287280
}
288281

289282
public async Task DeleteConnection(string sourceNodeName, string sourcePortName, string targetNodeName, string targetPortName)
@@ -314,11 +307,11 @@ public async Task DeleteConnection(string sourceNodeName, string sourcePortName,
314307

315308
// Click on the connection to select it
316309
await _user.Mouse.ClickAsync(midX, midY);
317-
await Task.Delay(50); // Minimal delay for selection
310+
await Task.Delay(100);
318311

319312
// Press Delete key to remove the connection
320313
await _user.Keyboard.PressAsync("Delete");
321-
await Task.Delay(50); // Minimal delay for deletion
314+
await Task.Delay(100);
322315
}
323316

324317
public async Task TakeScreenshot(string fileName)
@@ -339,9 +332,8 @@ public async Task SearchForNodes(string nodeType)
339332
var searchInput = _user.Locator("[data-test-id='node-search-input']");
340333
await searchInput.WaitForAsync(new() { State = WaitForSelectorState.Visible, Timeout = 5000 });
341334
await searchInput.FillAsync(nodeType);
342-
// Wait for first search result to appear instead of fixed delay
343-
var firstResult = _user.Locator("[data-test-id='node-search-result']").First;
344-
await firstResult.WaitForAsync(new() { State = WaitForSelectorState.Visible, Timeout = 2000 });
335+
// Wait for search results to update
336+
await Task.Delay(300);
345337
}
346338
else
347339
{
@@ -358,9 +350,6 @@ public async Task AddNodeFromSearch(string nodeType)
358350
{
359351
await nodeResult.First.WaitForAsync(new() { State = WaitForSelectorState.Visible, Timeout = 5000 });
360352
await nodeResult.First.ClickAsync();
361-
362-
// Wait for node to be added to canvas
363-
await Task.Delay(100);
364353
}
365354
catch (TimeoutException)
366355
{
@@ -389,7 +378,7 @@ public async Task DeleteAllConnectionsFromNode(string nodeName)
389378
var connection = connections.Nth(i);
390379
await connection.ClickAsync(new() { Force = true, Timeout = 1000 });
391380
await _user.Keyboard.PressAsync("Delete");
392-
await Task.Delay(50); // Minimal delay for deletion
381+
await Task.Delay(100);
393382
}
394383
catch
395384
{
@@ -429,7 +418,7 @@ public async Task ZoomIn()
429418
var canvas = GetGraphCanvas();
430419
await canvas.HoverAsync();
431420
await _user.Mouse.WheelAsync(0, -100); // Scroll up to zoom in
432-
await Task.Delay(50); // Minimal delay for zoom to apply
421+
await Task.Delay(100); // Reduced from 200ms
433422
Console.WriteLine("Zoomed in on canvas");
434423
}
435424

@@ -438,7 +427,7 @@ public async Task ZoomOut()
438427
var canvas = GetGraphCanvas();
439428
await canvas.HoverAsync();
440429
await _user.Mouse.WheelAsync(0, 100); // Scroll down to zoom out
441-
await Task.Delay(50); // Minimal delay for zoom to apply
430+
await Task.Delay(100); // Reduced from 200ms
442431
Console.WriteLine("Zoomed out on canvas");
443432
}
444433

@@ -455,7 +444,7 @@ public async Task PanCanvas(int deltaX, int deltaY)
455444
await _user.Mouse.DownAsync(new() { Button = MouseButton.Middle });
456445
await _user.Mouse.MoveAsync(startX + deltaX, startY + deltaY, new() { Steps = 10 });
457446
await _user.Mouse.UpAsync(new() { Button = MouseButton.Middle });
458-
await Task.Delay(50); // Minimal delay for pan to apply
447+
await Task.Delay(50); // Reduced from 100ms
459448
}
460449
Console.WriteLine($"Panned canvas by ({deltaX}, {deltaY})");
461450
}
@@ -473,7 +462,7 @@ public async Task ResetCanvasView()
473462
// Simulate with keyboard shortcut
474463
await _user.Keyboard.PressAsync("Control+0");
475464
}
476-
await Task.Delay(100); // Minimal delay for reset to apply
465+
await Task.Delay(100); // Reduced from 200ms
477466
Console.WriteLine("Reset canvas view");
478467
}
479468

@@ -489,13 +478,10 @@ public async Task CreateClass(string className)
489478

490479
await createClassButton.ClickAsync();
491480
var nameInput = _user.Locator("[data-test-id='class-name-input']");
492-
await nameInput.WaitForVisible();
493481
await nameInput.FillAsync(className);
494482
var confirmButton = _user.Locator("[data-test-id='confirm-create-class']");
495483
await confirmButton.ClickAsync();
496-
497-
// Wait for the new class to appear in the list
498-
await SearchProjectExplorerClasses.GetByText(className, new() { Exact = true }).WaitForVisible();
484+
await Task.Delay(200);
499485
}
500486

501487
public async Task RenameClass(string oldName, string newName)
@@ -542,14 +528,10 @@ public async Task CreateMethod(string methodName)
542528

543529
await createMethodButton.ClickAsync();
544530
var nameInput = _user.Locator("[data-test-id='method-name-input']");
545-
await nameInput.WaitForVisible();
546531
await nameInput.FillAsync(methodName);
547532
var confirmButton = _user.Locator("[data-test-id='confirm-create-method']");
548533
await confirmButton.ClickAsync();
549-
550-
// Wait for the new method to appear in the list
551-
var methodLocator = SearchClassExplorer.Locator($"[data-test-id='Method'][data-test-method='{methodName}']");
552-
await methodLocator.WaitForVisible();
534+
await Task.Delay(200);
553535
}
554536

555537
public async Task RenameMethod(string oldName, string newName)
@@ -569,10 +551,7 @@ public async Task RenameMethod(string oldName, string newName)
569551

570552
var confirmButton = _user.Locator("[data-test-id='confirm-rename']");
571553
await confirmButton.ClickAsync();
572-
573-
// Wait for the method to appear with the new name
574-
var methodLocator = SearchClassExplorer.Locator($"[data-test-id='Method'][data-test-method='{newName}']");
575-
await methodLocator.WaitForVisible();
554+
await Task.Delay(500); // Wait for rename to complete
576555
}
577556

578557
public async Task DeleteMethod(string methodName)
@@ -598,9 +577,7 @@ public async Task DeleteMethod(string methodName)
598577
// No confirmation dialog appeared, continue
599578
}
600579

601-
// Wait for the method to disappear from the list
602-
var methodLocator = SearchClassExplorer.Locator($"[data-test-id='Method'][data-test-method='{methodName}']");
603-
await methodLocator.WaitForAsync(new() { State = WaitForSelectorState.Hidden, Timeout = 5000 });
580+
await Task.Delay(500); // Wait for deletion to complete
604581
}
605582

606583
public async Task<bool> MethodExists(string methodName)
@@ -628,8 +605,7 @@ public async Task AddMethodParameter(string paramName, string paramType)
628605
if (await editButton.CountAsync() > 0)
629606
{
630607
await editButton.ClickAsync();
631-
// Wait for add parameter button to appear
632-
await addParamButton.WaitForAsync(new() { State = WaitForSelectorState.Visible, Timeout = 2000 });
608+
await Task.Delay(200);
633609
}
634610
else
635611
{
@@ -643,7 +619,7 @@ public async Task AddMethodParameter(string paramName, string paramType)
643619
await addParamButton.ClickAsync();
644620
// The actual implementation in EditMethodMenu just adds a parameter directly
645621
// No dialog is opened, so we don't need to fill in name/type
646-
await Task.Delay(100); // Minimal delay for parameter addition
622+
await Task.Delay(200);
647623
}
648624
else
649625
{
@@ -667,8 +643,7 @@ public async Task ExportProject()
667643
{
668644
await confirmButton.ClickAsync();
669645
}
670-
// Wait for snackbar or completion indicator
671-
await Task.Delay(200);
646+
await Task.Delay(500);
672647
}
673648

674649
public async Task BuildProject()
@@ -680,17 +655,7 @@ public async Task BuildProject()
680655
}
681656

682657
await buildButton.ClickAsync();
683-
// Wait for build to complete - look for success indicator or snackbar
684-
var snackbar = SearchSnackBarContainer;
685-
try
686-
{
687-
await snackbar.WaitForAsync(new() { State = WaitForSelectorState.Visible, Timeout = 5000 });
688-
}
689-
catch
690-
{
691-
// If no snackbar appears, use minimal delay
692-
await Task.Delay(500);
693-
}
658+
await Task.Delay(1000);
694659
}
695660

696661
public async Task RunProject()
@@ -702,8 +667,7 @@ public async Task RunProject()
702667
}
703668

704669
await runButton.ClickAsync();
705-
// Wait for console panel to appear
706-
await Task.Delay(200);
670+
await Task.Delay(500);
707671
}
708672

709673
// UI Responsiveness
@@ -746,7 +710,7 @@ public async Task DeleteNode(string nodeName)
746710
await node.ClickAsync(new() { Force = true });
747711
}
748712
await _user.Keyboard.PressAsync("Delete");
749-
await Task.Delay(100); // Minimal delay for deletion
713+
await Task.Delay(200);
750714
Console.WriteLine($"Deleted node '{nodeName}'");
751715
}
752716

@@ -759,17 +723,7 @@ public async Task<bool> HasErrorMessage()
759723
public async Task SaveProjectWithKeyboard()
760724
{
761725
await _user.Keyboard.PressAsync("Control+S");
762-
// Wait for save to complete - look for snackbar
763-
var snackbar = SearchSnackBarContainer;
764-
try
765-
{
766-
await snackbar.WaitForAsync(new() { State = WaitForSelectorState.Visible, Timeout = 2000 });
767-
}
768-
catch
769-
{
770-
// If no snackbar, use minimal delay
771-
await Task.Delay(200);
772-
}
726+
await Task.Delay(500);
773727
Console.WriteLine("Saved project with Ctrl+S");
774728
}
775729

@@ -804,12 +758,8 @@ public async Task WaitForProjectToComplete(int timeoutMs = 10000)
804758
var consolePanel = _user.Locator("[data-test-id='consolePanel']");
805759
await consolePanel.WaitForAsync(new() { State = WaitForSelectorState.Visible, Timeout = timeoutMs });
806760

807-
// Wait for console output to appear
808-
var consoleLines = _user.Locator("[data-test-id='consoleLine']");
809-
await consoleLines.First.WaitForAsync(new() { State = WaitForSelectorState.Visible, Timeout = 5000 });
810-
811-
// Give a small delay for final output
812-
await Task.Delay(500);
761+
// Wait a bit for the process to complete
762+
await Task.Delay(2000);
813763
Console.WriteLine("✓ Project execution completed");
814764
}
815765

@@ -929,18 +879,6 @@ public async Task VerifyNodeHasNoBreakpoint(string nodeName)
929879
{
930880
var node = GetGraphNode(nodeName);
931881
var breakpointIndicator = node.Locator(".breakpoint-indicator");
932-
933-
// Wait for the indicator to disappear if it exists
934-
try
935-
{
936-
await breakpointIndicator.WaitForAsync(new() { State = WaitForSelectorState.Hidden, Timeout = 2000 });
937-
}
938-
catch
939-
{
940-
// If it was never there, that's fine too
941-
}
942-
943-
// Verify it's gone
944882
var count = await breakpointIndicator.CountAsync();
945883

946884
if (count > 0)

src/NodeDev.EndToEndTests/Tests/AdvancedNodeOperationsTests.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ public async Task SearchAndAddSpecificNodeTypes()
2424
await HomePage.SearchForNodes("Branch");
2525
await HomePage.AddNodeFromSearch("Branch");
2626

27-
// Wait a bit longer for node to appear on canvas
28-
await Task.Delay(500);
29-
3027
var hasBranchNode = await HomePage.HasGraphNode("Branch");
3128
Assert.True(hasBranchNode, "Branch node should be visible on canvas");
3229

0 commit comments

Comments
 (0)