1.2 KiB
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 queriesc.ExecuteConnect(query, variables, &result)— Connect API queriesc.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 namesfactory.SafeEmail()— random unique emailsfactory.Attrsmap 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.NoErrorfor mutation/query errors,assert.Equalfor value checks