
See interfaces like a human. E2E testing in natural language.
Bring AI vision to E2E testing with a newly designed test framework for web, mobile, and desktop apps.
Website · English / 简体中文
## Write a test in natural language
Midscene.js brings AI vision to E2E testing. Describe UI steps and expected results in natural language, then use the visual GUI Agent to carry them out and verify what users see. Organize tests with Midscene Test, or integrate the Agent APIs into your existing testing framework.
### YAML test cases with Midscene Test
After [creating a Midscene Test project](https://www.midscenejs.com/midscene-test/use) and configuring a model and the Web runtime, write a case like this. Replace the example URL with your app's address:
```yaml
beforeEach:
- gotoUrl: https://your-shop.example
cases:
- name: Find headphones under $100
steps:
- aiAct: Search for headphones and filter the results to prices under $100
- aiWaitFor: The filtered search results are visible
- aiAssert: There are products in the search results, and each costs less than $100
```
### JavaScript in your existing tests
You can also use the Agent directly in your existing tests. Configure a model and open your app in a Playwright `page`, then describe the same steps in code:
```javascript
import { PlaywrightAgent } from '@midscene/web/playwright';
const agent = new PlaywrightAgent(page);
await agent.aiAct('Search for headphones and filter the results to prices under $100');
await agent.aiWaitFor('The filtered search results are visible');
await agent.aiAssert('There are products in the search results, and each costs less than $100');
```
For mobile and desktop apps, use the platform Agent with [Rstest](https://www.midscenejs.com/sdk/rstest) or [Vitest](https://www.midscenejs.com/sdk/vitest). Open the generated HTML report to inspect screenshots, element locations, the AI decision process, and action and assertion results.
## 👁️ See, act, and verify like a human
E2E testing verifies complete workflows from the user's perspective, so Midscene tests the way a user does: **observe the screen, act on what you see, and verify the visible result**.
### Locate and act from screenshots
Midscene locates elements by their appearance and position, then clicks, types, or scrolls to carry out your instructions. You can target icon-only buttons, custom controls, `