Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

test: fix config token empty-token scenario

Luigi Agosti946ae4a2e327
diff --git a/dashboard/src/pages/SettingsPage.test.tsx b/dashboard/src/pages/SettingsPage.test.tsx
index 1811abf7..846f5033 100644
--- a/dashboard/src/pages/SettingsPage.test.tsx
+++ b/dashboard/src/pages/SettingsPage.test.tsx
@@ -54,11 +54,13 @@ describe("SettingsPage", () => {
await screen.findByRole("button", { name: /Network & Attach/i }),
);
- expect(
- screen.getByText(
- "Token configured. Manage rotation through the CLI or config file; the current value is never returned by the server.",
- ),
- ).toBeInTheDocument();
+ const tokenHint = screen.getByText("pinchtab config token").parentElement;
+
+ expect(tokenHint).toHaveTextContent(
+ "Token configured. Manage rotation through the CLI or config file; the current value is never returned by the server.",
+ );
+ expect(tokenHint).toHaveTextContent("pinchtab config token");
+ expect(tokenHint).toHaveTextContent("to copy it to your clipboard.");
expect(screen.queryByLabelText("API token")).not.toBeInTheDocument();
expect(
screen.queryByRole("button", { name: "Generate" }),
diff --git a/tests/e2e/scenarios-cli/system-basic.sh b/tests/e2e/scenarios-cli/system-basic.sh
index 24c30a23..9436f923 100644
--- a/tests/e2e/scenarios-cli/system-basic.sh
+++ b/tests/e2e/scenarios-cli/system-basic.sh
@@ -222,15 +222,22 @@ start_test "config token fails with empty token"
config_setup
config_init
-# No token set - should fail
+
+# config init now generates a token; blank it explicitly for this failure case.
+TMP_CFG=$(mktemp)
+jq '.server.token = ""' "$CFG" > "$TMP_CFG"
+mv "$TMP_CFG" "$CFG"
+
+# Empty token should fail.
PINCHTAB_CONFIG="$CFG" pt_fail config token
-# Check error message in stderr or combined output
-if echo "$PT_ERR$PT_OUT" | grep -qi "empty"; then
+
+# Check error message in stderr or stdout
+if printf '%s\n%s\n' "$PT_ERR" "$PT_OUT" | grep -qi "empty"; then
echo -e " ${GREEN}✓${NC} reports empty token error"
((ASSERTIONS_PASSED++)) || true
else
- echo -e " ${YELLOW}⚠${NC} expected empty token error message"
- ((ASSERTIONS_PASSED++)) || true
+ echo -e " ${RED}✗${NC} expected empty token error message"
+ ((ASSERTIONS_FAILED++)) || true
fi
config_cleanup