> For the complete documentation index, see [llms.txt](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/tests/readme_tests.md).

# Tests

The `tests/` directory holds top-level test suites that are not colocated with application or script modules.

Most unit and integration tests live next to the code they cover in `src/**/__tests__/`, `scripts/lib/**/__tests__/`, or `scripts/extensions/**/__tests__/`. See [`docs/testing.md`](/ai-os-and-trend-finder-docs/docs/testing.md) for the full testing policy.

## Structure

| Path            | Purpose                                                                 |
| --------------- | ----------------------------------------------------------------------- |
| `bun/`          | Bun-native runner guard tests scoped by `bunfig.toml`                   |
| `e2e/`          | Playwright browser regression specs                                     |
| `e2e/fixtures/` | Shared Playwright fixtures, browser state helpers, and live-data shapes |

## Commands

| Command            | Purpose                                               |
| ------------------ | ----------------------------------------------------- |
| `bun run test`     | Run the Vitest suite configured in `vitest.config.ts` |
| `bun run test:e2e` | Run Playwright specs from `tests/e2e/`                |
| `bun test`         | Run only the Bun-native guard suite in `tests/bun/`   |

Run a single Playwright spec by passing its path:

```bash
bun run test:e2e -- tests/e2e/trend-finder.spec.ts
```

## Playwright Notes

Playwright uses `playwright.config.ts`, starts the local app through `scripts/playwright-webserver.sh`, and targets `http://127.0.0.1:5189` by default. Set `PLAYWRIGHT_BASE_URL`, `PLAYWRIGHT_PORT`, or `PLAYWRIGHT_REUSE_EXISTING_SERVER=true` when testing an already-running local server.

Browser artifacts such as traces, screenshots, videos, reports, and `test-results/` are local diagnostics and should remain untracked.

## Conventions

* Keep browser tests deterministic and credential-free.
* Use fixtures in `tests/e2e/fixtures/` instead of relying on private `src/data/live-data.json` contents.
* Assert meaningful user-visible behavior rather than implementation details.
* Add top-level tests here only when they genuinely exercise a browser flow or the Bun runner boundary. Prefer colocated `__tests__/` files for module behavior.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/tests/readme_tests.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
