> ## Documentation Index
> Fetch the complete documentation index at: https://docs.testdriver.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Assert Test Example

> Example test that uses assert to verify a page loads.

## Demo Test Run

Watch this test execute in a real sandbox environment:

<iframe src="https://console-test.testdriver.ai/replay/6a05252355bee649aff42dd9?share=raPRX9PDXxsDqirVJgXeeg&embed=true" width="100%" height="390" style={{ border: "1px solid #333", borderRadius: "8px" }} allow="fullscreen" />

## Source Code

```javascript title="assert.test.mjs" {22-24} theme={null}
/**
 * TestDriver SDK - Assert Test (Vitest)
 * Converted from: testdriver/acceptance/assert.yaml
 */

import { describe, expect, it } from "vitest";
import { TestDriver } from "testdriverai/vitest/hooks";

describe("Assert Test", () => {
  it("should assert the testdriver login page shows", async (context) => {
    const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP,
    });
    
    // provision.chrome() automatically calls ready() and starts dashcam
    await testdriver.provision.chrome({
      url: 'http://testdriver-sandbox.vercel.app/login',
    });

    // Take a screenshot
    await testdriver.screenshot();

    // Assert the TestDriver.ai Sandbox login page is displayed
    const result = await testdriver.assert(
      "the TestDriver.ai Sandbox login page is displayed",
    );

    expect(result).toBeTruthy();
  });
  // it("should assert the testdriver login page shows 2", async (context) => {
  //   const testdriver = TestDriver(context);
    
  //   // provision.chrome() automatically calls ready() and starts dashcam
  //   await testdriver.provision.chrome({
  //     url: 'http://testdriver-sandbox.vercel.app/login',
  //   });

  //   // Assert the TestDriver.ai Sandbox login page is displayed
  //   const result = await testdriver.assert(
  //     "the TestDriver.ai Sandbox login page is displayed",
  //   );

  //   expect(result).toBeTruthy();
  // });
});
```

## Running This Example

```bash theme={null}
# Clone the TestDriver repository
git clone https://github.com/testdriverai/testdriverai

# Install dependencies
cd testdriverai
npm install

# Run this specific example
npx vitest run examples/assert.test.mjs
```

<Note>
  Make sure you have `TD_API_KEY` set in your environment. Get one at [testdriver.ai](https://testdriver.ai).
</Note>
