Fix instability issue in e2e testing#10106
Conversation
commit: |
|
No changes needing a change description found. |
|
You can try these changes here
|
There was a problem hiding this comment.
I don't think this will solve both issue if they are not the same thing underneth. The 2nd one crash before any of the code changes are
packages/typespec-vscode test:e2e: FAIL create-typespec.test.ts > CreateTypespecProject > CreateTypespecProject GenericRestAPI Trigger CommandPalette EmptyFolder
packages/typespec-vscode test:e2e: Error: electronApplication.firstWindow: Target page, context or browser has been closed
There was a problem hiding this comment.
Thanks for the feedback! You're right that these are two different errors with different root causes.
-
Error (Execution context was destroyed at mock-dialogs.ts:56) — Fixed by adding retry logic in
stubMultipleDialogsand waiting for VS Code UI readiness (waitForLoadState+waitForSelector) before mocking dialogs. -
Error (Target page, context or browser has been closed at
firstWindow()) — I think this is caused by the oldapp.close()calls not being awaited. The previous code had bareapp.close()(without await) at the end of each test, which means Electron could still be shutting down when the next test launches a new instance — causing a race condition that makesfirstWindow()fail. I've moved cleanup into the teardown with awaitapp.close()to ensure each Electron process is fully closed before the next test starts.
If this turns out to be insufficient (e.g., Electron crashes on startup for other reasons in CI), I can add retry logic around firstWindow() as well. Let me know what you think.
There was a problem hiding this comment.
do you think maybe then error 1 is also due to the same missing await when calling close then? I don't like retries it's just a cheap way to try to mitigate the real issue. Looking online I couldn't really find much other people having that issue which does indicate we probably did something wrong
Fix #9938.
Some optimization steps have been added to handle instability errors.
@timotheeguerin for notification.