Skip to content

Port Angular E2E test apps to span streaming #23811

Description

@andreiborza

Port these E2E test applications to span streaming (5 apps).

angular-19 already has a streamed variant from #23548 and is the reference. The other five are byte-identical to each other apart from the app name, so one port replays across the rest.

Apps

  • angular-17
  • angular-18
  • angular-20
  • angular-21
  • angular-22

What to do

For each app:

  1. Remove the traceLifecycle: 'static' pin added in test(e2e): Disable span streaming in e2e test applications #22590 from src/main.ts. Angular cannot read process.env in the browser bundle, so if a per-variant lifecycle is wanted, follow the fileReplacements approach angular-19 uses.
  2. Rewrite tests/performance.test.ts and tests/errors.test.ts from transaction envelopes to span v2:
    • waitForTransaction becomes waitForStreamedSpan / waitForStreamedSpans
    • event.transaction becomes span.name
    • contexts.trace.op becomes getSpanOp(span) plus span.is_segment
    • contexts.trace.data['x'] becomes span.attributes['x'], which has the shape { value, type }
    • transaction_info.source becomes the sentry.segment.name.source attribute
  3. The TraceDirective, TraceClass and TraceMethod specs all assert on child spans, so they need collectStreamedSpans rather than a single envelope.

Angular router spans lose their /users/123 name and become Router under streaming (#23547), so those assertions have to change. The pageload and navigation segment names survive, because ResolveEnd renames the root span to the parameterized route.

Reference app: angular-19 (streamed variant). Worked example: #23797.

Keep static trace lifecycle coverage

Before porting this group, duplicate angular-20 as-is into angular-20-static and leave that copy on the current transaction-based specs. That keeps the static trace lifecycle covered once the rest of the group moves to streaming.

The copy is verbatim; only the app name changes:

  • package.json -> name
  • start-event-proxy.mjs -> proxyServerName
  • every waitForTransaction / waitForError / waitForSession call in tests/

Keep traceLifecycle: 'static' in the copy's Sentry.init calls. The e2e matrix discovers apps by directory, so no CI config change is needed.

angular-19 already runs both lifecycles through sentryTest.variants (#23548), so this copy may be redundant for Angular; check that before adding it.

Metadata

Metadata

Assignees

Labels

TaskjavascriptPull requests that update javascript code

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions