Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

ci(e2e): run the e2e suite against staging after each deploy (#16877)

Othman Abu Ajamieh444c40e1ce62
diff --git a/.github/workflows/continuous-delivery-stg.yml b/.github/workflows/continuous-delivery-stg.yml
index fcf3a3db5a3..fef83c3a989 100644
--- a/.github/workflows/continuous-delivery-stg.yml
+++ b/.github/workflows/continuous-delivery-stg.yml
@@ -15,6 +15,12 @@ on:
- deploy-staging # Re-deploy to staging (e.g., after infra change)
- deploy-staging-skip-freeze # Deploy to staging, ignoring the freeze window
+# One deploy run at a time, so e2e always tests the SHA it reports on. A newer
+# pending run replaces an older pending one: the latest merge still wins.
+concurrency:
+ group: staging-${{ github.event_name == 'schedule' && 'release-candidate' || 'deploy' }}
+ cancel-in-progress: false
+
jobs:
detect-hotfix-merge:
if: github.event_name == 'push'
@@ -64,9 +70,6 @@ jobs:
((github.event_name == 'push' && needs.check-freeze.outputs.frozen == 'false') ||
(github.event_name == 'workflow_dispatch' && (github.event.inputs.action == 'deploy-staging' || github.event.inputs.action == 'deploy-staging-skip-freeze')))
runs-on: ubuntu-24.04
- concurrency:
- group: deploy-staging
- cancel-in-progress: true # Latest merge wins
outputs:
image_tag: ${{ steps.set-tag.outputs.image_tag }}
steps:
@@ -151,6 +154,72 @@ jobs:
run: |
ssh ops -t -t 'bash -ic "cd mrsk/stg && kamal deploy --version ${{ needs.build-image.outputs.image_tag }} --config-file=config/worker.yml --skip-push; exit"'
+ # Runs the Playwright suite against staging once both deploys finish. The job's
+ # check run on the commit SHA is the result the candidate cut reads.
+ # Report-only for now (continue-on-error): it never fails the workflow.
+ # Global setup deletes every flow of the E2E account, so the account must hold nothing else.
+ e2e-staging:
+ needs: [deploy-staging-app, deploy-staging-workers]
+ if: always() && needs.deploy-staging-app.result == 'success' && needs.deploy-staging-workers.result == 'success'
+ runs-on: ubuntu-latest
+ timeout-minutes: 30
+ continue-on-error: true
+ env:
+ CI: true
+ E2E_INSTANCE_URL: https://stg.activepieces.com
+ E2E_EMAIL: ${{ secrets.STAGING_E2E_EMAIL }}
+ E2E_PASSWORD: ${{ secrets.STAGING_E2E_PASSWORD }}
+ PLAYWRIGHT_JSON_OUTPUT_FILE: packages/tests-e2e/test-results/results.json
+ steps:
+ - name: Check test account secrets
+ run: |
+ if [ -z "$E2E_EMAIL" ] || [ -z "$E2E_PASSWORD" ]; then
+ echo "::error::STAGING_E2E_EMAIL and STAGING_E2E_PASSWORD must be set. Without them the suite tries to sign up on staging."
+ exit 1
+ fi
+
+ - uses: actions/checkout@v5
+
+ - name: Cache dependencies
+ uses: actions/cache@v5
+ with:
+ path: ~/.bun/install/cache
+ key: bun-${{ hashFiles('bun.lock', 'package.json') }}
+ restore-keys: bun-
+
+ - uses: actions/setup-node@v6
+ with:
+ node-version: 24
+
+ - uses: oven-sh/setup-bun@v2
+ with:
+ bun-version: latest
+
+ - name: Install dependencies
+ run: bun install
+
+ - name: Install Playwright browsers
+ run: npx playwright install --with-deps chromium
+
+ - name: Run E2E tests against staging
+ run: npx playwright test --config=packages/tests-e2e/playwright.config.ts --reporter=github,json
+
+ - name: Summarize results
+ if: always()
+ run: |
+ if [ -f "$PLAYWRIGHT_JSON_OUTPUT_FILE" ]; then
+ jq -r '.stats | "| passed | failed | flaky | skipped |\n|---|---|---|---|\n| \(.expected) | \(.unexpected) | \(.flaky) | \(.skipped) |"' "$PLAYWRIGHT_JSON_OUTPUT_FILE" >> "$GITHUB_STEP_SUMMARY"
+ fi
+
+ # Only the JSON report: traces hold the test account's password and token, and artifacts are public.
+ - name: Upload test results
+ uses: actions/upload-artifact@v6
+ if: always()
+ with:
+ name: e2e-staging-results
+ path: packages/tests-e2e/test-results/results.json
+ retention-days: 30
+
# Thursday 5 PM UTC: tag current staging image + commit as release-candidate.
# Also runs when a hotfix branch is merged to main — staging still holds the
# hotfix image at that point (multi-arch build takes 10–15 min), so the SSH
diff --git a/packages/tests-e2e/README.md b/packages/tests-e2e/README.md
index 87aa004e30e..b2e28ec43ce 100644
--- a/packages/tests-e2e/README.md
+++ b/packages/tests-e2e/README.md
@@ -32,7 +32,7 @@ npx turbo run deploy-checkly --filter=tests-e2e
Required environment variables:
-- `E2E_INSTANCE_URL` — target Activepieces URL (defaults to a local `localhost` value when unset)
+- `E2E_INSTANCE_URL` — target Activepieces URL (defaults to `http://localhost:4200` and starts the dev server when unset). When set, global setup deletes every flow of the signed-in account, so use an account that exists only for E2E.
- `E2E_EMAIL` — test user email
- `E2E_PASSWORD` — test user password
diff --git a/packages/tests-e2e/global-setup.ts b/packages/tests-e2e/global-setup.ts
index cfca480894a..66d14f8d76c 100644
--- a/packages/tests-e2e/global-setup.ts
+++ b/packages/tests-e2e/global-setup.ts
@@ -1,16 +1,16 @@
-import { chromium } from '@playwright/test';
+import { chromium, FullConfig, Page } from '@playwright/test';
import { AuthenticationPage } from './pages/authentication.page';
import { AutomationsPage } from './pages/automations.page';
export const DEFAULT_EMAIL = '[email protected]';
export const DEFAULT_PASSWORD = 'TestPassword123!@#';
-async function globalSetup() {
+async function globalSetup(config: FullConfig) {
console.log('🔧 Running global setup...');
const browser = await chromium.launch({ headless: true });
const context = await browser.newContext({
- baseURL: process.env.AP_FRONTEND_URL,
+ baseURL: config.projects[0].use.baseURL,
});
const page = await context.newPage();
@@ -35,6 +35,10 @@ async function globalSetup() {
await new AutomationsPage(page).open();
+ if (process.env.E2E_INSTANCE_URL) {
+ await deleteAllFlows(page);
+ }
+
console.log('✓ Global setup completed successfully');
} catch (error) {
console.error('❌ Global setup failed:', error);
@@ -47,3 +51,31 @@ async function globalSetup() {
export default globalSetup;
+async function deleteAllFlows(page: Page) {
+ const { token, projectId } = await page.evaluate(() => ({
+ token: localStorage.getItem('token'),
+ projectId: localStorage.getItem('projectId'),
+ }));
+ const headers = { Authorization: `Bearer ${token}` };
+
+ while (true) {
+ const listResponse = await page.request.get('/api/v1/flows', {
+ headers,
+ params: { projectId: projectId ?? '', limit: 100 },
+ });
+ if (!listResponse.ok()) {
+ throw new Error(`Listing flows to clean up failed with ${listResponse.status()}`);
+ }
+ const { data }: { data: { id: string }[] } = await listResponse.json();
+ if (data.length === 0) {
+ return;
+ }
+ console.log(`✓ Deleting ${data.length} flows left by earlier runs`);
+ for (const flow of data) {
+ const deleteResponse = await page.request.delete(`/api/v1/flows/${flow.id}`, { headers });
+ if (!deleteResponse.ok()) {
+ throw new Error(`Deleting flow ${flow.id} failed with ${deleteResponse.status()}`);
+ }
+ }
+ }
+}
diff --git a/packages/tests-e2e/playwright.config.ts b/packages/tests-e2e/playwright.config.ts
index 13cfbeba89b..fb9fb7f9141 100644
--- a/packages/tests-e2e/playwright.config.ts
+++ b/packages/tests-e2e/playwright.config.ts
@@ -9,6 +9,8 @@ if (!process.env.CI) {
}
const AP_EDITION = process.env.AP_EDITION || 'ce';
+const LOCAL_URL = 'http://localhost:4200';
+const E2E_INSTANCE_URL = process.env.E2E_INSTANCE_URL || undefined;
const editionConfigs = {
ce: {
@@ -39,7 +41,7 @@ const config: PlaywrightTestConfig = {
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
- baseURL: 'http://localhost:4200',
+ baseURL: E2E_INSTANCE_URL ?? LOCAL_URL,
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
@@ -60,13 +62,13 @@ const config: PlaywrightTestConfig = {
},
],
- /* Run your local dev server before starting the tests */
- webServer: {
+ /* Run your local dev server before starting the tests, unless they target a deployed instance */
+ webServer: E2E_INSTANCE_URL ? undefined : {
command: process.env.CI
? 'npm run dev'
: 'export $(cat packages/tests-e2e/.env.e2e | xargs) && npm run dev',
cwd: path.resolve(__dirname, '../..'),
- url: 'http://localhost:4200/api/v1/flags',
+ url: `${LOCAL_URL}/api/v1/flags`,
reuseExistingServer: !process.env.CI,
timeout: 300000,
stdout: 'pipe',