:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(devex): revert opt-in playwright e2e tests (#60154)
Georges-Antoine Assid7ff50ed7a7d
diff --git a/.github/workflows/ci-e2e-playwright.yml b/.github/workflows/ci-e2e-playwright.ymlindex 5aede56edd7f..bf12b1f8ea6b 100644--- a/.github/workflows/ci-e2e-playwright.yml+++ b/.github/workflows/ci-e2e-playwright.yml@@ -6,9 +6,6 @@name: E2E CI Playwrighton:pull_request:- # `labeled` lets developers opt in via the `run-playwright` label.- # Unrelated label changes are filtered out in the `changes` job.- types: [opened, synchronize, reopened, labeled]workflow_dispatch:push:branches:@@ -66,20 +63,14 @@ jobs:changes:runs-on: ubuntu-latesttimeout-minutes: 5- # Run on master push, manual dispatch, and on internal-repo PRs. Skip the- # entire workflow when the only thing that changed is some other label (avoids- # noisy runs on every label add/remove unrelated to Playwright).+ # Run on master push, manual dispatch, and on internal-repo PRs.if: |github.event_name == 'push' ||github.event_name == 'workflow_dispatch' ||- (- github.event.pull_request.head.repo.full_name == github.repository &&- (github.event.action != 'labeled' || github.event.label.name == 'run-playwright')- )+ github.event.pull_request.head.repo.full_name == github.repositoryname: Determine need to run E2E checksoutputs:shouldRun: ${{ steps.decide.outputs.shouldRun }}- shouldSuggest: ${{ steps.changes.outputs.shouldSuggest }}oldest_supported: ${{ steps.read-versions.outputs.oldest_supported }}schema_cache_key: ${{ steps.schema-key.outputs.key }}steps:@@ -101,24 +92,14 @@ jobs:- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1id: changes- # Skip the path filter when the `run-playwright` label is set or on master push —- # both already imply we want to run.- if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'run-playwright')+ if: github.event_name == 'pull_request'with:token: ${{ steps.app-token.outputs.token || github.token }}filters: |- mustRun:- # Real triggers — only this workflow runs Playwright tests, so changes- # to the tests, page models, utils, snapshots, or this workflow itself- # need to validate before merge.+ shouldRun:+ # Any change that could affect E2E behavior triggers a run.- playwright/**- .github/workflows/ci-e2e-playwright.yml- shouldSuggest:- # Wider net — code that *could* affect E2E behavior. We don't auto-run- # Playwright on these (most failures are flakes, real bugs are caught- # elsewhere or fix-forward from master). Instead the `suggest-label` job- # nudges the author to add the `run-playwright` label if they want a- # full sweep before merging.- 'ee/**'- 'posthog/!(temporal/**)/**'- 'bin/*'@@ -135,10 +116,9 @@ jobs:env:IS_PUSH: ${{ github.event_name == 'push' }}IS_DISPATCH: ${{ github.event_name == 'workflow_dispatch' }}- HAS_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'run-playwright') }}- MUST_RUN: ${{ steps.changes.outputs.mustRun }}+ SHOULD_RUN: ${{ steps.changes.outputs.shouldRun }}run: |- if [[ "$IS_PUSH" == "true" || "$IS_DISPATCH" == "true" || "$HAS_LABEL" == "true" || "$MUST_RUN" == "true" ]]; then+ if [[ "$IS_PUSH" == "true" || "$IS_DISPATCH" == "true" || "$SHOULD_RUN" == "true" ]]; thenecho "shouldRun=true" >> "$GITHUB_OUTPUT"elseecho "shouldRun=false" >> "$GITHUB_OUTPUT"@@ -179,76 +159,6 @@ jobs:echo "::notice::merge-base not found (branch too stale?) — schema cache will be skipped"fi- # Nudge the author to add the `run-playwright` label when their PR touches code- # that *could* affect E2E behavior but doesn't trigger a real run on its own.- # Also handles cleanup: if the PR later qualifies for a real run (label added,- # narrow paths matched), remove the suggestion comment so it doesn't linger.- suggest-label:- name: Suggest run-playwright label- needs: [changes]- if: |- github.event_name == 'pull_request' && (- needs.changes.outputs.shouldSuggest == 'true' ||- needs.changes.outputs.shouldRun == 'true'- )- runs-on: ubuntu-latest- timeout-minutes: 5- permissions:- pull-requests: write- steps:- - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0- env:- SHOULD_RUN: ${{ needs.changes.outputs.shouldRun }}- SHOULD_SUGGEST: ${{ needs.changes.outputs.shouldSuggest }}- HAS_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'run-playwright') }}- with:- github-token: ${{ secrets.GITHUB_TOKEN }}- script: |- const marker = '<!-- playwright-suggest-label -->';- const shouldRun = process.env.SHOULD_RUN === 'true';- const shouldSuggest = process.env.SHOULD_SUGGEST === 'true';- const hasLabel = process.env.HAS_LABEL === 'true';- const wantSuggestion = !shouldRun && shouldSuggest && !hasLabel;-- const { data: comments } = await github.rest.issues.listComments({- owner: context.repo.owner,- repo: context.repo.repo,- issue_number: context.issue.number,- });- const existing = comments.find(c => c.body.includes(marker));-- if (wantSuggestion) {- const body = [- marker,- "🎭 **Playwright didn't run on this PR** — your changes touch code that *could* affect E2E behavior, but Playwright is opt-in via label now to keep CI cost down.",- "",- "Add the **`run-playwright`** label if you want an E2E sweep before merging — CI will pick it up automatically.",- "",- "_Most PRs don't need this. Real regressions still get caught on master and fix-forward._",- ].join('\n');- if (existing) {- await github.rest.issues.updateComment({- owner: context.repo.owner,- repo: context.repo.repo,- comment_id: existing.id,- body,- });- } else {- await github.rest.issues.createComment({- owner: context.repo.owner,- repo: context.repo.repo,- issue_number: context.issue.number,- body,- });- }- } else if (existing) {- await github.rest.issues.deleteComment({- owner: context.repo.owner,- repo: context.repo.repo,- comment_id: existing.id,- });- }-playwright:name: Playwright E2E testsneeds: [changes]diff --git a/bin/mprocs-e2e.yaml b/bin/mprocs-e2e.yamlindex 153bd5a7aa72..aaefb6f72946 100644--- a/bin/mprocs-e2e.yaml+++ b/bin/mprocs-e2e.yaml@@ -17,6 +17,7 @@ procs:SKIP_SERVICE_VERSION_REQUIREMENTS: '1'DEBUG: '1'E2E_TESTING: '1'+ PERSON_ON_EVENTS_OVERRIDE: '1'celery-worker:shell: 'uv sync --active && bin/wait-for-docker && ./bin/start-celery worker'@@ -50,6 +51,11 @@ procs:createdb posthog_e2e_test && \echo "DROP DATABASE IF EXISTS posthog_test SYNC" | curl 'http://localhost:8123/' --data-binary @- && \echo "CREATE DATABASE posthog_test" | curl 'http://localhost:8123/' --data-binary @- && \+ echo "=== Detaching conflicting Kafka-engine tables from posthog DB (shared consumer group 'group1') ===" && \+ for tbl in $(echo "SELECT name FROM system.tables WHERE database='posthog' AND engine='Kafka' FORMAT TabSeparated" | curl -s 'http://localhost:8123/' --data-binary @-); do \+ echo " detaching posthog.$tbl"; \+ echo "DETACH TABLE IF EXISTS posthog.\`$tbl\` PERMANENTLY" | curl -s 'http://localhost:8123/' --data-binary @- || true; \+ done && \echo "=== Running migrations ===" && \bin/wait-for-docker && \python manage.py migrate && \diff --git a/playwright/e2e/before-onboarding.spec.ts b/playwright/e2e/before-onboarding.spec.tsindex 81b4d20ff8d8..bb6fff737f74 100644--- a/playwright/e2e/before-onboarding.spec.ts+++ b/playwright/e2e/before-onboarding.spec.ts@@ -17,9 +17,9 @@ test.describe('Before Onboarding', () => {test('Navigate to a settings page even when a product has not been set up', async ({ page }) => {await page.goto('/settings/user')- await expect(page.locator('.scene-tab-row .scene-tab-title')).toContainText('Settings - Profile')+ await expect(page.getByRole('heading', { level: 1 })).toContainText('Settings - Profile')await page.goto('/settings/organization')- await expect(page.locator('.scene-tab-row .scene-tab-title')).toContainText('Settings - General')+ await expect(page.getByRole('heading', { level: 1 })).toContainText('Settings - General')})})diff --git a/playwright/e2e/scene-tabs.spec.ts b/playwright/e2e/scene-tabs.spec.tsdeleted file mode 100644index 52662ea8be0f..000000000000--- a/playwright/e2e/scene-tabs.spec.ts+++ /dev/null@@ -1,71 +0,0 @@-import { expect } from '@playwright/test'--import { test } from '../utils/playwright-test-base'--test.describe('Scene tabs', () => {- test('closing a tab preserves remaining tab widths until mouse leaves', async ({ page }) => {- // Navigate to a few different pages to open multiple tabs- await page.goto('/project/1/activity/explore')- await page.waitForSelector('.scene-tab-row')-- // Open new tabs by clicking the new tab button multiple times- for (let i = 0; i < 3; i++) {- await page.click('[data-attr="scene-tab-new-button"]')- await page.waitForTimeout(300)- }-- // Navigate each new tab to a different page so they have distinct titles- const tabs = page.locator('.scene-tab-row [data-tab-id]')- const tabCount = await tabs.count()-- // Verify we have multiple tabs- expect(tabCount).toBeGreaterThanOrEqual(4)-- // Screenshot: tabs before closing- const tabRow = page.locator('.scene-tab-row')- await expect(tabRow).toHaveScreenshot('tabs-before-close.png')-- // Record the widths of all tabs before closing- const widthsBefore = await tabs.evaluateAll((els) =>- els.map((el) => ({ id: el.getAttribute('data-tab-id'), width: el.getBoundingClientRect().width }))- )-- // Find a non-active, closable tab (not the first or last)- // We'll close the second-to-last tab- const tabToCloseIndex = tabCount - 2- const tabToClose = tabs.nth(tabToCloseIndex)- const tabToCloseId = await tabToClose.getAttribute('data-tab-id')-- // Hover over the tab to reveal close button, then click it- await tabToClose.hover()- const closeButton = tabToClose.locator('button').first()- await closeButton.click()-- // Small wait for the frozen widths to take effect- await page.waitForTimeout(100)-- // Screenshot: tabs immediately after closing (widths should be frozen)- await expect(tabRow).toHaveScreenshot('tabs-after-close-frozen.png')-- // Verify the remaining tabs have frozen widths matching their pre-close sizes- const remainingTabs = page.locator('.scene-tab-row [data-tab-id]')- const widthsAfterClose = await remainingTabs.evaluateAll((els) =>- els.map((el) => ({ id: el.getAttribute('data-tab-id'), width: el.getBoundingClientRect().width }))- )-- // All remaining tabs should have their width frozen to what it was before- for (const afterTab of widthsAfterClose) {- const beforeTab = widthsBefore.find((b) => b.id === afterTab.id)- if (beforeTab && afterTab.id !== tabToCloseId) {- expect(Math.abs(afterTab.width - beforeTab.width)).toBeLessThan(2)- }- }-- // Move the mouse out of the tab row to unfreeze widths- await page.mouse.move(0, 400)- await page.waitForTimeout(100)-- // Screenshot: tabs after mouse leaves (widths should be natural/recalculated)- await expect(tabRow).toHaveScreenshot('tabs-after-mouse-leave.png')- })-})diff --git a/playwright/e2e/surveys/quickcreate.spec.ts b/playwright/e2e/surveys/quickcreate.spec.tsindex 36aa440c8486..dd1f9752a3d4 100644--- a/playwright/e2e/surveys/quickcreate.spec.ts+++ b/playwright/e2e/surveys/quickcreate.spec.ts@@ -69,7 +69,7 @@ const launchSurvey = async (page: Page, name: string): Promise<void> => {await createButton.click()await responsePromiseawait page.waitForURL(/project\/(\d+)\/surveys\/([\w-]+)/)- await expect(page.locator('.scene-tab-title').first()).toContainText(name)+ await expect(page.locator('[data-attr="scene-name"]').first()).toContainText(name)await expect(page.locator('[data-attr="stop-survey"]')).toBeVisible()}@@ -222,7 +222,7 @@ test.describe('Quick create survey from feature flag', () => {await saveAsDraftButton.click()await responsePromiseawait page.waitForURL(/project\/(\d+)\/surveys\/([\w-]+)/)- await expect(page.locator('.scene-tab-title').first()).toContainText(name)+ await expect(page.locator('[data-attr="scene-name"]').first()).toContainText(name)await expect(page.locator('[data-attr="launch-survey"]').getByText('Launch', { exact: true })).toBeVisible()})diff --git a/posthog/test/playwright_setup_functions.py b/posthog/test/playwright_setup_functions.pyindex 64fea8a505da..f53a7fe65b1f 100644--- a/posthog/test/playwright_setup_functions.py+++ b/posthog/test/playwright_setup_functions.py@@ -211,6 +211,10 @@ def create_organization_with_team()api_key._value = api_key_value # type: ignore+ # Skip the post-login /account/credential-review interstitial that fires for users with unreviewed PersonalAPIKey+ user.credentials_reviewed_at = timezone.now()+ user.save(update_fields=["credentials_reviewed_at"])+# Skip all onboarding tasks if requested (prevents Quick Start popover in tests)if data.skip_onboarding:team.onboarding_tasks = {@@ -488,7 +492,8 @@ def _create_events_and_persons(data: PlaywrightWorkspaceSetupData, team: Team) -# Populate event/property definitions so the taxonomic filter worksfrom posthog.demo.matrix.taxonomy_inference import infer_taxonomy_for_team- infer_taxonomy_for_team(team.pk)+ with tags_context(product=Product.INTERNAL, feature=Feature.MANAGEMENT_COMMAND):+ infer_taxonomy_for_team(team.pk)@dataclass(frozen=True)