本文へ移動
cccskills
無料GitHub で公開

testdriver:performing-actions

Perform actions and handle dynamic, async UI so tests adapt to change

インストール方法を見る

含まれるファイル(1)

  • SKILL.md5.2 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

<!-- Generated from performing-actions.mdx. DO NOT EDIT. -->

Real apps move, load, and change. Adapt your tests to these conditions.

You generated and learned your tests. Then you got them to run. Now the challenge is the real world: buttons show after a spinner, pages navigate, animations play, and content comes in over the network. To keep the tests reliable, do the correct actions and control the timing. Then your tests adapt to the true behavior of the UI. They do not break.

Performing Actions

TestDriver gives you many actions. You can click, type, hover, and scroll. For a full list, read the API Reference.

// Clicking
await testdriver.find('submit button').click();
await testdriver.find('file item').doubleClick();
await testdriver.find('text area').rightClick();

// Typing
await testdriver.find('email input').type('user@example.com');
await testdriver.find('password input').type('secret', { secret: true });

// Keyboard shortcuts
await testdriver.pressKeys(['enter']);
await testdriver.pressKeys(['ctrl', 'c']);

// Hovering
await testdriver.find('dropdown menu').hover();

// Scrolling
await testdriver.scroll('down', 500);

// Waiting
await testdriver.wait(2000); // Wait 2 seconds for animation/state change

// Extracting information from screen
const price = await testdriver.extract('the total price');
const orderNumber = await testdriver.extract('the order confirmation number');

Chaining Actions

TestDriver lets you chain methods for cleaner code:

// Chain find() with actions
const button = await testdriver.find('submit button').click();

Or keep the element reference for later use:

const button = await testdriver.find('submit button');
await button.click();

Waiting for Dynamic Content

By default, find() polls automatically for a maximum of 10 seconds. It tries again each 5 seconds until it finds the element. Thus TestDriver finds most elements that show after short async operations. You do not need more configuration.

For longer operations, make the timeout larger:

// Default behavior - polls for up to 10 seconds automatically
const element = await testdriver.find('Loading complete indicator');
await element.click();

// Wait up to 30 seconds for slower operations
const element = await testdriver.find('Loading complete indicator', { timeout: 30000 });
await element.click();

// Useful after actions that trigger loading states
await testdriver.find('submit button').click();
await testdriver.find('success message', { timeout: 15000 });

// Disable polling for instant checks
const toast = await testdriver.find('notification toast', { timeout: 0 });

Flake Prevention

TestDriver automatically waits for the screen and network to stabilize after each action using redraw detection. This prevents flaky tests caused by animations, loading states, or dynamic content updates.

<Note> Redraw detection adds a small delay after each action but significantly reduces test flakiness. </Note>

For example, when clicking a submit button that navigates to a new page:

// Click submit - TestDriver automatically waits for the new page to load
await testdriver.find('submit button').click();

// By the time this runs, the page has fully loaded and stabilized
await testdriver.assert('dashboard is displayed');
await testdriver.find('welcome message');

Without redraw detection, you'd need manual waits or retries to handle the page transition. TestDriver handles this automatically by detecting when the screen stops changing and network requests complete.

You can disable redraw detection or customize its behavior:

// Disable redraw detection for faster tests (less reliable)
const testdriver = TestDriver(context, { 
  redraw: false 
});

Here is an example of customizing redraw detection:

// Fine-tune redraw detection
const testdriver = TestDriver(context, { 
  redraw: {
    enabled: true,
    diffThreshold: 0.1,      // Pixel difference threshold (0-1)
    screenRedraw: true,      // Monitor screen changes
    networkMonitor: true,    // Wait for network idle
  }
});

Simple Delays with wait()

For simple pauses — waiting for animations, transitions, or state changes after an action — use wait():

// Wait for an animation to complete
await testdriver.find('menu toggle').click();
await testdriver.wait(2000);

// Wait for a page transition to settle
await testdriver.find('next page button').click();
await testdriver.wait(1000);
<Note> For waiting for specific **elements** to appear, prefer `find()` with a `timeout` option. Use `wait()` only for simple time-based pauses. </Note>

Once your tests can reliably act on a changing UI and assert the results, the next step is figuring out what happened when something does go wrong.

<Card title="Next: Debug" icon="bug" href="/debugging-with-screenshots"> Use screenshots and run output to see exactly what your test saw and pinpoint failures. </Card>

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

How the TestDriver agent behaves on GitHub issues, pull requests, and @mentions

日本語の概要は準備中です。原文の説明を表示しています。

testdriverai/testdriverai2432026年9月21日 更新

Execute natural language tasks using AI

日本語の概要は準備中です。原文の説明を表示しています。

testdriverai/testdriverai2432026年9月21日 更新

Make AI-powered assertions about screen state

日本語の概要は準備中です。原文の説明を表示しています。

testdriverai/testdriverai2432026年9月21日 更新

Deploy TestDriver on your AWS infrastructure using CloudFormation

日本語の概要は準備中です。原文の説明を表示しています。

testdriverai/testdriverai2432026年9月21日 更新

Speed up tests with screenshot-based caching

日本語の概要は準備中です。原文の説明を表示しています。

testdriverai/testdriverai2432026年9月21日 更新

How TestDriver learns your app and caches what it discovers for instant, deterministic replays

日本語の概要は準備中です。原文の説明を表示しています。

testdriverai/testdriverai2432026年9月21日 更新

testdriverai のスキルをすべて見る

このスキルの問題を報告する