Files
probo/e2e/CLAUDE.md
Bryan Frimin 7a4101185b Add per-folder CLAUDE.md for key packages
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-15 15:04:27 +01:00

1.2 KiB

e2e

End-to-end tests against a running bin/probod instance.

Prerequisites

Build the binary first: make build (or SKIP_APPS=1 make build for backend-only).

Running

make test-e2e

Test setup

testutil.Setup() starts bin/probod as a subprocess (once per test run) and waits for the GraphQL endpoint to be healthy.

Client

c := testutil.NewClient(t, testutil.RoleOwner)

The client carries organization/tenant context and provides:

  • c.Execute(query, variables, &result) — GraphQL queries
  • c.ExecuteConnect(query, variables, &result) — Connect API queries
  • c.GetOrganizationID() — current org

Factory pattern

Test data created via factory.Create* functions:

vendorID := factory.CreateVendor(c, factory.Attrs{"name": "Acme"})
userID := factory.CreateUser(c)
  • factory.SafeName(prefix) — random unique names
  • factory.SafeEmail() — random unique emails
  • factory.Attrs map for overriding defaults

Test structure

  • Always t.Parallel() at the test function level
  • Inline GraphQL queries as string constants
  • Typed result structs per query
  • require.NoError for mutation/query errors, assert.Equal for value checks