How this command is triggered — by the user, by Claude, or both
Slash command
/steel-forge:steel-testThe summary Claude sees in its command listing — used to decide when to auto-load this command
# Steel Testing Assistant Help the user write effective tests for Steel automation using standard testing frameworks. ## Test Approaches ### Unit Tests Test individual functions and utilities: ### Integration Tests Test Steel session management: ### E2E Tests Test complete automation workflows: ## Test Best Practices 1. **Always Clean Up Sessions**: 2. **Use Longer Timeouts**: Steel automation can take time 3. **Handle Errors Gracefully**: 4. **Test with Live Sessions**: Use `sessionViewerUrl` to debug test failures 5. **Mock External Services**: Don't test third-p...
Help the user write effective tests for Steel automation using standard testing frameworks.
Test individual functions and utilities:
// tests/utils.test.ts
import { generateSelector } from '../src/utils';
describe('generateSelector', () => {
it('should create optimal selector', () => {
const element = { id: 'submit', class: 'btn' };
expect(generateSelector(element)).toBe('#submit');
});
});
Test Steel session management:
// tests/session.test.ts
import { Steel } from 'steel-sdk';
describe('Steel Session', () => {
let client: Steel;
beforeAll(() => {
client = new Steel({ steelAPIKey: process.env.STEEL_API_KEY! });
});
it('should create session', async () => {
const session = await client.sessions.create();
expect(session.id).toBeDefined();
await client.sessions.release(session.id);
});
it('should connect with Playwright', async () => {
const session = await client.sessions.create();
const browser = await chromium.connectOverCDP(
`${session.websocketUrl}?apiKey=${process.env.STEEL_API_KEY}`
);
expect(browser.contexts().length).toBeGreaterThan(0);
await browser.close();
await client.sessions.release(session.id);
});
});
Test complete automation workflows:
// tests/e2e/scraping.test.ts
describe('Product Scraping', () => {
it('should scrape product data', async () => {
const client = new Steel({ steelAPIKey: process.env.STEEL_API_KEY! });
const session = await client.sessions.create();
const browser = await chromium.connectOverCDP(
`${session.websocketUrl}?apiKey=${process.env.STEEL_API_KEY}`
);
const page = browser.contexts()[0].pages()[0];
await page.goto('https://example.com/products');
const title = await page.locator('h1').first().textContent();
expect(title).toBeTruthy();
await browser.close();
await client.sessions.release(session.id);
});
});
Always Clean Up Sessions:
afterEach(async () => {
if (session) {
await client.sessions.release(session.id);
}
});
Use Longer Timeouts: Steel automation can take time
jest.setTimeout(30000); // 30 seconds
Handle Errors Gracefully:
try {
await page.goto('https://example.com');
} catch (error) {
console.log('Session viewer:', session.sessionViewerUrl);
throw error;
}
Test with Live Sessions: Use sessionViewerUrl to debug test failures
Mock External Services: Don't test third-party APIs, focus on your Steel code
it('should create session within timeout', async () => {
const start = Date.now();
const session = await client.sessions.create();
const duration = Date.now() - start;
expect(duration).toBeLessThan(5000); // Should be fast
await client.sessions.release(session.id);
});
it('should find element with selector', async () => {
const session = await client.sessions.create();
const browser = await chromium.connectOverCDP(/*...*/);
const page = browser.contexts()[0].pages()[0];
await page.goto('https://example.com');
const element = await page.waitForSelector('[data-testid="target"]');
expect(element).toBeTruthy();
});
it('should extract correct data', async () => {
// Setup session and page
const data = await page.evaluate(() => {
return {
title: document.querySelector('h1')?.textContent,
price: document.querySelector('.price')?.textContent
};
});
expect(data.title).toBeTruthy();
expect(data.price).toMatch(/\$\d+/);
});
Guide users to use standard test runners:
npm test or jestvitest runpytest tests/Always provide working test examples they can copy and modify.
npx claudepluginhub nibzard/steel-marketplace --plugin steel-forge/recordRecords browser interactions to generate test YAML files; also supports AI-assisted editing of existing tests.
/e2eGenerates Playwright end-to-end tests for critical user flows like authentication, CRUD operations, and checkout, with setup structure and best practices.
/test-planCreates a structured test plan from feature artifacts — queries test types, environment, and credentials, auto-detects the test framework, generates test cases mapped to user stories, and saves them under features/<name>/testing/.
/testWrites and runs unit, integration, or E2E tests for provided code, acceptance criteria, and critical flows. Ensures coverage of happy paths, errors, edge cases; documents gaps.
/flowsTests end-to-end user flows (login, registration, checkout) on web app at <base-url> using Playwright, verifying test plan and app accessibility first.