From b4c0474f306b36c652c635a6441aaa52eb3b8e54 Mon Sep 17 00:00:00 2001 From: Ryan Bahan Date: Thu, 26 Feb 2026 18:13:58 -0700 Subject: [PATCH] add tests for deploy --- packages/e2e/fixtures/cli-process.ts | 8 ++--- packages/e2e/tests/app-deploy.spec.ts | 44 +++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 packages/e2e/tests/app-deploy.spec.ts diff --git a/packages/e2e/fixtures/cli-process.ts b/packages/e2e/fixtures/cli-process.ts index 2bf965c7fd..5ea61182b1 100644 --- a/packages/e2e/fixtures/cli-process.ts +++ b/packages/e2e/fixtures/cli-process.ts @@ -121,11 +121,11 @@ export const cliFixture = envFixture.extend<{cli: CLIProcess}>({ process.stdout.write(data) } - // Check if any waiters are satisfied + // Check if any waiters are satisfied (check both raw and stripped output) const stripped = stripAnsi(output) for (let i = outputWaiters.length - 1; i >= 0; i--) { const waiter = outputWaiters[i]! - if (stripped.includes(waiter.text)) { + if (stripped.includes(waiter.text) || output.includes(waiter.text)) { waiter.resolve() outputWaiters.splice(i, 1) } @@ -151,8 +151,8 @@ export const cliFixture = envFixture.extend<{cli: CLIProcess}>({ ptyProcess, waitForOutput(text: string, timeoutMs = 3 * 60 * 1000) { - // Check if already in output - if (stripAnsi(output).includes(text)) { + // Check if already in output (raw or stripped) + if (stripAnsi(output).includes(text) || output.includes(text)) { return Promise.resolve() } diff --git a/packages/e2e/tests/app-deploy.spec.ts b/packages/e2e/tests/app-deploy.spec.ts new file mode 100644 index 0000000000..bdb25ed9b1 --- /dev/null +++ b/packages/e2e/tests/app-deploy.spec.ts @@ -0,0 +1,44 @@ +import {appScaffoldFixture as test} from '../fixtures/app-scaffold.js' +import {requireEnv} from '../fixtures/env.js' +import {expect} from '@playwright/test' + +test.describe('App deploy @phase1', () => { + test('deploy and verify version exists', async ({appScaffold, cli, env}) => { + requireEnv(env, 'partnersToken', 'clientId') + + // Step 1: Create an app + const initResult = await appScaffold.init({ + template: 'reactRouter', + flavor: 'javascript', + packageManager: 'npm', + }) + expect(initResult.exitCode).toBe(0) + + // Step 2: Deploy with a tagged version + const versionTag = `e2e-v-${Date.now()}` + const deployResult = await cli.exec( + [ + 'app', 'deploy', + '--path', appScaffold.appDir, + '--force', + '--version', versionTag, + '--message', 'E2E test deployment', + ], + {timeout: 5 * 60 * 1000}, + ) + const deployOutput = deployResult.stdout + deployResult.stderr + expect(deployResult.exitCode, `deploy failed:\n${deployOutput}`).toBe(0) + + // Step 3: Verify the version exists via versions list + const listResult = await cli.exec( + ['app', 'versions', 'list', '--path', appScaffold.appDir, '--json'], + {timeout: 60 * 1000}, + ) + const listOutput = listResult.stdout + listResult.stderr + expect(listResult.exitCode, `versions list failed:\n${listOutput}`).toBe(0) + + // Check that our version tag appears in the output + const allOutput = listResult.stdout + listResult.stderr + expect(allOutput).toContain(versionTag) + }) +})