@apmantza/greedysearch-pi 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/test.sh +79 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apmantza/greedysearch-pi",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Pi extension: browser-automation tool that searches Perplexity, Bing Copilot, and Google AI in parallel, extracts answers and sources via CDP, with optional Gemini synthesis — grounded AI answers from real browser interactions.",
5
5
  "type": "module",
6
6
  "keywords": [
package/test.sh CHANGED
@@ -25,9 +25,14 @@ NC='\033[0m'
25
25
 
26
26
  PASS=0
27
27
  FAIL=0
28
+ FAILURES=() # Array to store failure details for report
28
29
 
29
30
  pass() { PASS=$((PASS+1)); echo -e " ${GREEN}✓${NC} $1"; }
30
- fail() { FAIL=$((FAIL+1)); echo -e " ${RED}✗${NC} $1"; }
31
+ fail() {
32
+ FAIL=$((FAIL+1));
33
+ echo -e " ${RED}✗${NC} $1"
34
+ FAILURES+=("$1")
35
+ }
31
36
 
32
37
  check_no_errors() {
33
38
  local file="$1"
@@ -73,7 +78,7 @@ echo -e "\n${YELLOW}═══ GreedySearch Test Suite ═══${NC}\n"
73
78
  if [[ "$1" != "parallel" ]]; then
74
79
  echo "Test 1: Single engine mode"
75
80
 
76
- for engine in perplexity bing google; do
81
+ for engine in perplexity bing google gemini; do
77
82
  outfile="$RESULTS_DIR/single_${engine}.json"
78
83
  node search.mjs "$engine" "explain $engine attention mechanism" --out "$outfile" 2>/dev/null
79
84
  if [[ $? -eq 0 && -f "$outfile" ]]; then
@@ -212,10 +217,82 @@ if [[ "$1" != "parallel" && "$1" != "quick" ]]; then
212
217
  fi
213
218
 
214
219
  # ─────────────────────────────────────────────────────────
220
+ # Generate test report
221
+ REPORT_FILE="$RESULTS_DIR/REPORT.md"
222
+
223
+ cat > "$REPORT_FILE" << EOF
224
+ # GreedySearch Test Report
225
+
226
+ **Date:** $(date)
227
+ **Test run:** $RESULTS_DIR
228
+
229
+ ## Summary
230
+
231
+ | Result | Count |
232
+ |--------|-------|
233
+ | ✅ Passed | $PASS |
234
+ | ❌ Failed | $FAIL |
235
+ | Total | $((PASS + FAIL)) |
236
+
237
+ ## Failures
238
+
239
+ EOF
240
+
241
+ if [[ ${#FAILURES[@]} -eq 0 ]]; then
242
+ echo "No failures — all tests passed! 🎉" >> "$REPORT_FILE"
243
+ else
244
+ for i in "${!FAILURES[@]}"; do
245
+ echo "$((i+1)). ${FAILURES[$i]}" >> "$REPORT_FILE"
246
+ done
247
+
248
+ cat >> "$REPORT_FILE" << 'EOF'
249
+
250
+ ## Common Issues
251
+
252
+ ### Bing Copilot "copy button did not appear"
253
+ This usually means:
254
+ - **Verification challenge appeared** — Cloudflare Turnstile or Microsoft auth
255
+ - **Page didn't load** — network issue or Copilot slow to respond
256
+ - **UI changed** — selector no longer matches Copilot's DOM
257
+
258
+ To debug: check the result JSON file for the full error message.
259
+
260
+ ### Google "verification required"
261
+ Google sometimes shows CAPTCHAs that can't be auto-solved.
262
+ Manual intervention required in the Chrome window.
263
+
264
+ ### Perplexity "Clipboard interceptor returned empty text"
265
+ Perplexity's UI may have changed. Check if the copy button selector still works.
266
+
267
+ EOF
268
+ fi
269
+
270
+ cat >> "$REPORT_FILE" << EOF
271
+
272
+ ## Result Files
273
+
274
+ \`\`\`
275
+ $(ls -la "$RESULTS_DIR"/*.json 2>/dev/null | awk '{print $NF}' | xargs -I{} basename {})
276
+ \`\`\`
277
+
278
+ ---
279
+ *Generated by test.sh*
280
+ EOF
281
+
215
282
  echo -e "\n${YELLOW}═══ Results ═══${NC}"
216
283
  echo -e " ${GREEN}Passed: $PASS${NC}"
217
284
  [[ $FAIL -gt 0 ]] && echo -e " ${RED}Failed: $FAIL${NC}" || echo " Failed: 0"
218
285
  echo " Results in: $RESULTS_DIR"
286
+ echo " Report: $REPORT_FILE"
219
287
  echo ""
220
288
 
289
+ # Print failure details to console too
290
+ if [[ ${#FAILURES[@]} -gt 0 ]]; then
291
+ echo -e "${RED}Failures:${NC}"
292
+ for f in "${FAILURES[@]}"; do
293
+ echo -e " ${RED}•${NC} $f"
294
+ done
295
+ echo ""
296
+ fi
297
+
221
298
  [[ $FAIL -eq 0 ]] && exit 0 || exit 1