All questions

How do I stop my e2e tests from sending real Croct events in CI?

Asked by qa_nathan on

Qqa_nathan

Our Playwright suite runs against a preview build in CI, and I do not want those runs doing two things:

  • polluting real event data with synthetic test traffic
  • hitting the live event transport at all

Is there a proper test mode I can flip for CI so the rest of the flow still runs but nothing is actually sent

Was this helpful?

2 answers

DLDevon Lane

yeah, set NEXT_PUBLIC_CROCT_TEST in your CI environment. it switches the SDK to a mock event transport, so events are not sent for real but everything else in the flow still behaves normally, which is what you want for e2e. under the hood it is driving the plug test option, which defaults to false, the env var is just how you flip it in Next.

Was this helpful?
SLSofia Lindqvist

One clarification so you do not reach for the wrong flag: NEXT_PUBLIC_CROCT_DEBUG is a separate thing, it turns on verbose logging, it does not mute events. If you set debug expecting quiet CI you will still be sending real events, just noisier. The one that actually stops the sending is the test flag. Debug is covered in this debug-in-production thread.

Was this helpful?
Still have questions?