Test Python venv auto-creation (e2e)#13742
Open
rodrigosf672 wants to merge 3 commits into
Open
Conversation
Covers the user-visible flow: notification appears when workspace has requirements.txt without .venv, no notification when .venv exists, and clicking Yes creates the environment. Requires workspace fixtures in qa-example-content/workspaces/python-venv-creation/. Closes #13437 (e2e test layer)
|
E2E Tests 🚀 |
Signed-off-by: Rodrigo Silva Ferreira <129895386+rodrigosf672@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a minimal Playwright e2e spec under the existing test/e2e harness to cover the Python “auto-create .venv” notification flow when dependency files (e.g. requirements.txt) are present.
Changes:
- Adds an interpreter-focused e2e test suite asserting the auto-create prompt appears for a workspace with
requirements.txt. - Adds coverage for the “no prompt when
.venvalready exists” case. - Adds coverage for accepting the prompt (“Yes”) and verifying a
.venvdirectory is created.
Comment on lines
+30
to
+32
| }, async function ({ app, openFolder }) { | ||
| await openFolder(path.join(fixtureBase, 'with-requirements')); | ||
|
|
Comment on lines
+39
to
+42
| // Reload to reset the run-once guard from prior test | ||
| await hotKeys.reloadWindow(true); | ||
| await openFolder(path.join(fixtureBase, 'with-existing-venv')); | ||
|
|
Comment on lines
+50
to
+53
|
|
||
| const tempWorkspace = '/tmp/vscsmoke/qa-example-content/venv-creation-test'; | ||
| await fs.mkdir(tempWorkspace, { recursive: true }); | ||
| await fs.writeFile(path.join(tempWorkspace, 'requirements.txt'), 'requests\n'); |
| await app.workbench.toasts.expectToastWithTitleNotToAppear(/requirements\.txt/); | ||
| }); | ||
|
|
||
| test('Clicking Yes creates venv and installs deps', { |
Address review feedback: - Replace path.join with template literals for openFolder paths to avoid backslashes on Windows (openFolder splits on '/') - Use os.tmpdir() instead of hardcoded /tmp for cross-platform support - Rename test to match actual assertions (venv creation, not deps install) - Add test.slow() and increase notification timeout to 60s for CI stability Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
requirements.txtand no.venv.venvalready existsDepends on posit-dev/qa-example-content#138.
Addresses #13437 (e2e layer). I focused on writing less e2e tests here to prevent furthering pressure against the CI, hence why this e2e test suite is quite minimal.
Test plan
qa-example-contentfixtures firstnpx playwright test python-venv-creation --project e2e-electronpasses locally@:interpreter @:win @:web