Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2E: Handle VSCode AMD -> ESM migration #5941

Open
wants to merge 2 commits into
base: rnauta/ci-enable-e2e-v2/wait-for-client-config
Choose a base branch
from

Conversation

RXminuS
Copy link
Contributor

@RXminuS RXminuS commented Oct 17, 2024

Before the E2E framework leveraged the fact that we could import vscode.workbench from the browser page to gain access to a basic VSCode api. This was used to help execute commands which was foundational for things like running commands and macros using the vscode test-utils extension.

But since VSCode 1.94 the workbench uses ESM instead of AMD which means that the require hack doesn't work anymore. This broke all E2E tests as no commands/macros could be executed anymore.

Now we leverage the VScode Test Utils extension to directly expose a websocket server. The E2E test framework connects to this endpoint and directly sends commands and macros. This has the additional benefit that the execution is more reliable as the previous implementation would dispatch scheduled commands together with other UI event-loop items.

Finally the tests were updated to pass again.

Additionally the following changes were made while updating the tests:

  • Ensure we use the VSCode bundled Node instetad of the one specified in our package.json

Warning: We are several versions behind the actual Node version used by VSCode and this was the first time this led to issues as the version we use does not properly support ESM. This probably needs a follow up action.

  • Moved the incorrectly placed recordings in the vscode dir to the root dir
  • Simplify the pre-authenticated VSCode initialization as per @dominiccooney previous suggestion
  • Update at-metion telemetry tests to expand the matrix of variants. In addition to the private/public git repos we now combine those with dotcom/enterprise sg instances as they should provide different telemetry events`

Test plan

  • Ran all tests with retry-each 10 to ensure there was no flake
  • E2E v2 tests pass with full parallelism

Copy link
Contributor Author

RXminuS commented Oct 17, 2024

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@RXminuS RXminuS changed the title Ensure we use vscode bundled node version E2E: Handle VSCode AMD -> ESM migration Oct 17, 2024
@RXminuS RXminuS requested a review from a team October 17, 2024 22:44
@RXminuS RXminuS marked this pull request as ready for review October 17, 2024 22:48
@RXminuS RXminuS force-pushed the rnauta/ci-enable-e2e-v2/wait-for-client-config branch from 0a93319 to 9a0cebc Compare October 20, 2024 15:57
@RXminuS RXminuS force-pushed the rnauta/ci-enable-e2e-v2/framework-fixes-1 branch from 80d03aa to cfef0a5 Compare October 20, 2024 15:57
Copy link
Contributor

@dominiccooney dominiccooney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some feedback inline.

But let's keep PRs focused on one purpose so they are easier to review. You could break this up into:

  • Import change to cope with AMD/ESM change
  • Simplified initialization
  • Add a proxy test (which appears incomplete rn? The scope of the TODO is unclear to me... and it doesn't use the simplified initialization?)

In general, skimming the TODOs, use TODO: what when. For example TODO: make a nice UIX class for this doesn't add a ton of value unless it explains what's blocking that so someone later can easily understand, OK, NOW the time is right to fix this TODO. (And if it is not blocked... just do it. In a small focused change related to that purpose.)

HasErrors = '\u200C',
HasLoaders = '\u200D',
IsIgnored = '\u2060',
IsAuthenticated = '\u2061',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Evidently \u2061 no longer unassigned

@@ -5,3 +5,4 @@ packages:
- lib/*
- vscode
- web
- vscode/e2e/utils/extension
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep sorted

- name: content-length
value: "101"
- name: accept
value: "*/*"
- name: user-agent
value: vscode/1.38.1 (Node.js v20.16.0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this relevant to this patch? Why did the user agent change if we are just changing some imports?

test('normal auth flow - desktop', async ({
page,
vscodeUI,
mitmProxy,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit concerned that mitm = man in the middle is gendered language. So I'm going to read that as "machine in the middle".

@@ -0,0 +1,56 @@
// import { writeFile } from 'node:fs/promises'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's delete the commented out imports.

@RXminuS RXminuS force-pushed the rnauta/ci-enable-e2e-v2/wait-for-client-config branch from 9a0cebc to 7409630 Compare October 22, 2024 18:36
@RXminuS RXminuS force-pushed the rnauta/ci-enable-e2e-v2/framework-fixes-1 branch from cfef0a5 to 8c8d046 Compare October 22, 2024 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants