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

# Core Concepts

> Understand the fundamentals of Plugwright.

## Writing Tests

In Plugwright, every test runs with a pre-configured context. You use `test()` to define a scenario and `expect()` to make assertions.

```javascript theme={null}
import { expect, test } from '@drownek/plugwright';

test('Basic test', async ({ player }) => {
    // Your test logic here
});
```

## Locators

Locators are your secret weapon. Plugwright allows you to precisely find and interact with GUIs, something no other framework does effectively!

```javascript theme={null}
test('Click an item in GUI', async ({ player }) => {
    player.chat('/openmenu');
    
    // Wait for the GUI to open and get a live handle
    const gui = await player.gui({ title: 'Menu' });
    
    // Find an item by its internal name or display name
    const shopItem = gui.locator(i => i.getDisplayName().includes('Shop'));
    await shopItem.click();
    
    await expect(player).toHaveReceivedMessage('You opened the shop!');
});
```

## Multi-Bot

Testing economy, trading, or PvP? You can easily spawn multiple bots to test interactions between players.

```javascript theme={null}
test('Players can trade', async ({ player, createPlayer }) => {
    const friend = await createPlayer({ username: 'TraderBot' });
    
    player.chat(`/pay ${friend.username} 100`);
    
    await expect(friend).toHaveReceivedMessage('You received 100 coins!');
});
```
