1- .PHONY : test test-unit test-e2e test-go test-file test-run build clean tidy help \
1+ .PHONY : test test-unit test-e2e e2e test-go test-file e2e-file test-run e2e -run build clean tidy help \
22 check-toolchain fmt fmt-check vet lint tidy-check race-test vuln secrets \
33 replace-check security check release-check release tools \
44 surface-snapshot surface-check lint-actions
55
66BINARY := $(CURDIR ) /bin/fizzy
7+
8+ # Load local test credentials if present (file is git-excluded via .git/info/exclude).
9+ -include .env.test
10+ export FIZZY_TEST_TOKEN FIZZY_TEST_ACCOUNT FIZZY_TEST_API_URL
711VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
812LDFLAGS := -X main.version=$(VERSION )
913
@@ -20,10 +24,13 @@ help:
2024 @echo " Usage:"
2125 @echo " make build Build the CLI"
2226 @echo " make test-unit Run unit tests (no API required)"
23- @echo " make test-e2e Run e2e tests (requires API credentials)"
24- @echo " make test Alias for test-e2e"
25- @echo " make test-file Run a specific e2e test file"
26- @echo " make test-run Run a specific e2e test by name"
27+ @echo " make e2e Run owner-only CLI contract e2e tests"
28+ @echo " make test-e2e Alias for e2e"
29+ @echo " make test Alias for e2e"
30+ @echo " make e2e-file Run a specific CLI contract e2e test file"
31+ @echo " make test-file Alias for e2e-file"
32+ @echo " make e2e-run Run a specific CLI contract e2e test by name"
33+ @echo " make test-run Alias for e2e-run"
2734 @echo " make clean Remove build artifacts"
2835 @echo " make tidy Tidy dependencies"
2936 @echo " "
@@ -45,17 +52,19 @@ help:
4552 @echo " make tools Install dev tools"
4653 @echo " "
4754 @echo " Environment variables (required for e2e tests):"
48- @echo " FIZZY_TEST_TOKEN API token"
49- @echo " FIZZY_TEST_ACCOUNT Account slug"
50- @echo " FIZZY_TEST_API_URL API base URL (default: https://app.fizzy.do)"
51- @echo " FIZZY_TEST_USER_ID User ID for user update/deactivate tests (optional)"
55+ @echo " FIZZY_TEST_TOKEN API token"
56+ @echo " FIZZY_TEST_ACCOUNT Account slug"
57+ @echo " FIZZY_TEST_API_URL API base URL (default: https://app.fizzy.do)"
58+ @echo " FIZZY_TEST_BINARY Prebuilt binary path (optional)"
59+ @echo " FIZZY_E2E_KEEP_FIXTURE Set to 1 to skip final fixture teardown"
60+ @echo " FIZZY_E2E_TEARDOWN_DELAY Delay teardown by N seconds"
5261 @echo " "
5362 @echo " Examples:"
5463 @echo " make build"
5564 @echo " make test-unit"
5665 @echo " export FIZZY_TEST_TOKEN=your-token"
5766 @echo " export FIZZY_TEST_ACCOUNT=your-account"
58- @echo " make test- e2e"
67+ @echo " make e2e"
5968
6069# Toolchain guard — fails fast when PATH go and GOROOT go disagree
6170check-toolchain :
@@ -80,28 +89,33 @@ test-unit: check-toolchain
8089 go test -v ./internal/...
8190
8291# Run e2e tests (requires API credentials)
83- test- e2e : build
92+ e2e : build
8493 @if [ -z " $$ FIZZY_TEST_TOKEN" ]; then echo " Error: FIZZY_TEST_TOKEN not set" ; exit 1; fi
8594 @if [ -z " $$ FIZZY_TEST_ACCOUNT" ]; then echo " Error: FIZZY_TEST_ACCOUNT not set" ; exit 1; fi
86- FIZZY_TEST_BINARY=$(BINARY ) go test -v ./e2e/tests/...
95+ FIZZY_TEST_BINARY=$(BINARY ) go test -v -timeout 10m ./e2e/cli_tests/...
96+
97+ test-e2e : e2e
8798
88- # Alias for test-e2e
89- test : test-e2e
90- test-go : test-e2e
99+ test : e2e
100+ test-go : e2e
91101
92- # Run a single test file (e.g., make test -file FILE=board )
93- test -file : build
94- @if [ -z " $( FILE) " ]; then echo " Usage: make test -file FILE=board " ; exit 1; fi
102+ # Run a single test file (e.g., make e2e -file FILE=crud_board )
103+ e2e -file : build
104+ @if [ -z " $( FILE) " ]; then echo " Usage: make e2e -file FILE=crud_board " ; exit 1; fi
95105 @if [ -z " $$ FIZZY_TEST_TOKEN" ]; then echo " Error: FIZZY_TEST_TOKEN not set" ; exit 1; fi
96106 @if [ -z " $$ FIZZY_TEST_ACCOUNT" ]; then echo " Error: FIZZY_TEST_ACCOUNT not set" ; exit 1; fi
97- FIZZY_TEST_BINARY=$(BINARY ) go test -v ./e2e/tests /$(FILE ) _test.go
107+ FIZZY_TEST_BINARY=$(BINARY ) go test -v ./e2e/cli_tests /$(FILE ) _test.go
98108
99- # Run a single test by name (e.g., make test-run NAME=TestBoardCRUD)
100- test-run : build
101- @if [ -z " $( NAME) " ]; then echo " Usage: make test-run NAME=TestBoardCRUD" ; exit 1; fi
109+ test-file : e2e-file
110+
111+ # Run a single test by name (e.g., make e2e-run NAME=TestBoardList)
112+ e2e-run : build
113+ @if [ -z " $( NAME) " ]; then echo " Usage: make e2e-run NAME=TestBoardList" ; exit 1; fi
102114 @if [ -z " $$ FIZZY_TEST_TOKEN" ]; then echo " Error: FIZZY_TEST_TOKEN not set" ; exit 1; fi
103115 @if [ -z " $$ FIZZY_TEST_ACCOUNT" ]; then echo " Error: FIZZY_TEST_ACCOUNT not set" ; exit 1; fi
104- FIZZY_TEST_BINARY=$(BINARY ) go test -v -run $(NAME ) ./e2e/tests/...
116+ FIZZY_TEST_BINARY=$(BINARY ) go test -v -run $(NAME ) ./e2e/cli_tests/...
117+
118+ test-run : e2e-run
105119
106120# Format Go source
107121fmt :
0 commit comments