Skip to content

Commit e5db23c

Browse files
authored
Reference dist/ in examples and evals (#418)
* fix types in evals * fix examples * build stagehand in ci
1 parent 0df1e23 commit e5db23c

File tree

95 files changed

+274
-325
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+274
-325
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ jobs:
9898
- name: Install Playwright browsers
9999
run: npm exec playwright install --with-deps
100100

101+
- name: Build Stagehand
102+
run: npm run build
103+
101104
- name: Run E2E Tests (Deterministic Playwright)
102105
run: npm run e2e
103106

@@ -132,6 +135,9 @@ jobs:
132135
- name: Install Playwright browsers
133136
run: npm exec playwright install --with-deps
134137

138+
- name: Build Stagehand
139+
run: npm run build
140+
135141
- name: Run E2E Tests (browserbase)
136142
run: npm run e2e:bb
137143

@@ -160,6 +166,9 @@ jobs:
160166
- name: Install dependencies
161167
run: npm install --no-frozen-lockfile
162168

169+
- name: Build Stagehand
170+
run: npm run build
171+
163172
- name: Install Playwright browsers
164173
run: npm exec playwright install --with-deps
165174

@@ -211,6 +220,9 @@ jobs:
211220
- name: Install Playwright browsers
212221
run: npm exec playwright install --with-deps
213222

223+
- name: Build Stagehand
224+
run: npm run build
225+
214226
- name: Run Act Evals
215227
run: npm run evals category act
216228

@@ -258,6 +270,9 @@ jobs:
258270
- name: Install dependencies
259271
run: npm install --no-frozen-lockfile
260272

273+
- name: Build Stagehand
274+
run: npm run build
275+
261276
- name: Install Playwright browsers
262277
run: npm exec playwright install --with-deps
263278

@@ -323,6 +338,9 @@ jobs:
323338
- name: Install Playwright browsers
324339
run: npm exec playwright install --with-deps
325340

341+
- name: Build Stagehand
342+
run: npm run build
343+
326344
# 1. Run text_extract category with textExtract first
327345
- name: Run text_extract Evals (textExtract)
328346
run: npm run evals category text_extract -- --extract-method=textExtract
@@ -386,6 +404,9 @@ jobs:
386404
- name: Install Playwright browsers
387405
run: npm exec playwright install --with-deps
388406

407+
- name: Build Stagehand
408+
run: npm run build
409+
389410
- name: Run Observe Evals
390411
run: npm run evals category observe
391412

evals/args.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import process from "process";
2-
import { EvalCategorySchema } from "../types/evals";
2+
import { EvalCategorySchema } from "@/types/evals";
33

44
// Extract command-line arguments passed to this script.
55
const args = process.argv.slice(2);
Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,16 @@
1-
import type { ConstructorParams, LogLine } from "../../lib";
1+
import { default as DefaultStagehandConfig } from "@/stagehand.config";
2+
import type { ConstructorParams } from "@/dist";
23
import dotenv from "dotenv";
34
dotenv.config({ path: "../../.env" });
45

56
const StagehandConfig: ConstructorParams = {
7+
...DefaultStagehandConfig,
68
env: "LOCAL" /* Environment to run Stagehand in */,
7-
apiKey: process.env.BROWSERBASE_API_KEY /* API key for authentication */,
8-
projectId: process.env.BROWSERBASE_PROJECT_ID /* Project identifier */,
99
verbose: 1 /* Logging verbosity level (0=quiet, 1=normal, 2=verbose) */,
10-
debugDom: true /* Enable DOM debugging features */,
1110
headless: true /* Run browser in headless mode */,
12-
logger: (message: LogLine) =>
13-
console.log(
14-
`[stagehand::${message.category}] ${message.message}`,
15-
) /* Custom logging function */,
16-
domSettleTimeoutMs: 30_000 /* Timeout for DOM to settle in milliseconds */,
1711
browserbaseSessionCreateParams: {
1812
projectId: process.env.BROWSERBASE_PROJECT_ID,
1913
},
2014
enableCaching: false /* Enable caching functionality */,
21-
browserbaseSessionID:
22-
undefined /* Session ID for resuming browserbase sessions */,
23-
modelName: "gpt-4o" /* Name of the model to use */,
24-
modelClientOptions: {
25-
apiKey: process.env.OPENAI_API_KEY,
26-
} /* Configuration options for the model client */,
2715
};
2816
export default StagehandConfig;

evals/deterministic/tests/BrowserContext/addInitScript.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { test, expect } from "@playwright/test";
2-
import { Stagehand } from "../../../../lib";
3-
import StagehandConfig from "../../stagehand.config";
2+
import { Stagehand } from "@/dist";
3+
import StagehandConfig from "@/evals/deterministic/stagehand.config";
44

55
test.describe("StagehandContext - addInitScript", () => {
66
test("should inject a script on the context before pages load", async () => {

evals/deterministic/tests/BrowserContext/cookies.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { test, expect } from "@playwright/test";
2-
import { Stagehand } from "../../../../lib"; // Adjust the relative path as needed
3-
import StagehandConfig from "../../stagehand.config";
2+
import { Stagehand } from "@/dist";
3+
import StagehandConfig from "@/evals/deterministic/stagehand.config";
44

55
test.describe("StagehandContext - Cookies", () => {
66
let stagehand: Stagehand;

evals/deterministic/tests/BrowserContext/page.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { test, expect } from "@playwright/test";
2-
import { Stagehand } from "../../../../lib";
3-
import StagehandConfig from "../../stagehand.config";
2+
import { Stagehand } from "@/dist";
3+
import StagehandConfig from "@/evals/deterministic/stagehand.config";
44

55
import http from "http";
66
import express from "express";

evals/deterministic/tests/BrowserContext/routing.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { test, expect } from "@playwright/test";
2-
import { Stagehand } from "../../../../lib";
3-
import StagehandConfig from "../../stagehand.config";
2+
import { Stagehand } from "@/dist";
3+
import StagehandConfig from "@/evals/deterministic/stagehand.config";
44

55
import http from "http";
66
import express from "express";

evals/deterministic/tests/Errors/apiKeyError.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { test, expect } from "@playwright/test";
2-
import { Stagehand } from "../../../../lib";
3-
import StagehandConfig from "../../stagehand.config";
2+
import { Stagehand } from "@/dist";
3+
import StagehandConfig from "@/evals/deterministic/stagehand.config";
44
import { z } from "zod";
55

66
test.describe("API key/LLMClient error", () => {

evals/deterministic/tests/browserbase/contexts.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Browserbase from "@browserbasehq/sdk";
2-
import { Stagehand } from "../../../../lib";
32
import { expect, test } from "@playwright/test";
4-
import StagehandConfig from "../../stagehand.config";
3+
import StagehandConfig from "@/evals/deterministic/stagehand.config";
4+
import { Stagehand } from "@/dist";
55

66
// Configuration
77
const CONTEXT_TEST_URL = "https://docs.browserbase.com";

evals/deterministic/tests/browserbase/downloads.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { test, expect } from "@playwright/test";
22
import AdmZip from "adm-zip";
3-
import StagehandConfig from "../../stagehand.config";
4-
import { Stagehand } from "../../../../lib";
3+
import StagehandConfig from "@/evals/deterministic/stagehand.config";
4+
import { Stagehand } from "@/dist";
55
import Browserbase from "@browserbasehq/sdk";
66

77
const downloadRe = /sandstorm-(\d{13})+\.mp3/;

0 commit comments

Comments
 (0)