Add e2e test infrastructure with Playwright + node-pty#6899
Add e2e test infrastructure with Playwright + node-pty#6899ryancbahan wants to merge 4 commits intomainfrom
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
ad0ad81 to
a55826d
Compare
a55826d to
c19eb9e
Compare
Coverage report
Test suite run success3791 tests passing in 1448 suites. Report generated by 🧪jest coverage report action from 6e1ad36 |
| @@ -0,0 +1,19 @@ | |||
| # Required: Client ID of the primary test app (must be in the genghis account's org) | |||
| # CI secret: E2E_CLIENT_ID | |||
| SHOPIFY_FLAG_CLIENT_ID= | |||
There was a problem hiding this comment.
For initial E2E tests, we won't create new apps but instead use existing ones. We should 100% evolve this, but we need a starting point to monitor and observe stability of this job.
|
🤖 Code Review · #projects-dev-ai for questions ✅ Complete - No issues 📋 History✅ 1 findings → ✅ 1 findings → ✅ No issues |
|
|
||
| test.describe('PTY smoke test', () => { | ||
| test('shopify version runs via PTY', async ({cli}) => { | ||
| const proc = await cli.spawn(['version']) |
There was a problem hiding this comment.
I wasn't able to execute this test initially, i was getting a Error: posix_spawnp failed.
Apparently (and according to claude) pnpm strips the execution permission of binaries installed through it, so the spawn-helper in node-pty didn't have enough permissions. Fixing that this worked, but probably something to account for.
There was a problem hiding this comment.
how did you fix? i didn't run into this problem
There was a problem hiding this comment.
Claude found the spawn-helper binary inside node_modules and suggested to add execution permission (chmod +x), after that everything worked. Not sure why it happened though, i've installed binaries other times and didn't have this problem. Maybe because I ran pnpm i inside the e2e folder? :thinking_face:
I ran pnpm iagain from the root and it worked fine this time, so maybe we can ignore this
| /** | ||
| * Polls until a TCP connection to host:port succeeds, or timeout is reached. | ||
| */ | ||
| export async function waitForPort(port: number, host = '127.0.0.1', timeoutMs = 30_000): Promise<void> { |
There was a problem hiding this comment.
Am I wrong or this isn't used anywhere?
packages/e2e/helpers/file-edit.ts
Outdated
| /** | ||
| * Replaces text in a file. Useful for modifying source files to trigger hot reload. | ||
| */ | ||
| export function replaceInFile(filePath: string, search: string | RegExp, replacement: string): void { |
There was a problem hiding this comment.
Same for these functions, they are not used right?
Rename the fixtures directory to setup/ to clearly distinguish Playwright fixture definitions from static test data. Rename cli-process.ts to cli.ts for brevity. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

WHY are these changes introduced?
The CLI team manually runs a ~30-step QA checklist before every release. This is time-consuming and error-prone. The Cucumber suite tests CLI commands non-interactively but cannot handle interactive CLI prompts, long-running dev servers, auth, or browser verification. We need e2e test infra that automates QA and provides regression testing for CLI features.
WHAT is this pull request doing?
Introduces a new
packages/e2e/package with Playwright + node-pty infrastructure for automated end-to-end testing.Directory structure:
Key design decisions:
setup/to distinguish Playwright fixture definitions from static test datacli.tsprovides bothexec()(non-interactive via execa) andspawn()(interactive via node-pty with output matching, key sending, process lifecycle)helpers/contains stateless utility functions with no Playwright dependencySubsequent PRs in this stack add OAuth login, app scaffold/deploy/dev tests, CI integration, and TOML config regression tests.
How to test your changes?
Measuring impact
n/a - this is test infrastructure