mcpField
T
testcafe-skill

testcafe-skill

github.com/lambdatestテスト・品質384205 回インストール2 週間前に更新
リポジトリ

testcafe-skill について

TestCafe によるブラウザーテスト自動化のリファレンスです。JavaScript のテスト作成者向けに、セレクター、ページモデル、ブラウザー実行、スクリーンショット、TestMu AI クラウド実行を扱います。

主な機能

  1. 01TestCafe のテストパターン
  2. 02セレクターとページモデル
  3. 03ブラウザー・ヘッドレス実行コマンド
  4. 04複数ブラウザーでのテスト実行
  5. 05スクリーンショットとウィンドウ制御
  6. 06TestMu AI クラウドの設定

活用シーン

  1. 01JavaScript でのブラウザーテスト作成
  2. 02複数ブラウザーでのテスト実行
  3. 03デバッグ用スクリーンショットの取得
  4. 04TestMu AI クラウドでのテスト実行

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/lambdatest/agent-skills --skill testcafe-skill

インストール後、Claude Code で/testcafe-skillを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

reference/
advanced-patterns.md
cloud-integration.md
playbook.md

詳細

TestCafe 自動化スキル

コアパターン

基本的なテスト
import { Selector } from 'testcafe';

fixture('Login').page('https://example.com/login');

test('Login with valid credentials', async t => {
    await t
        .typeText('#username', '[email protected]')
        .typeText('#password', 'password123')
        .click('button[type="submit"]')
        .expect(Selector('.dashboard').exists).ok();
});
セレクター
const submitBtn = Selector('button').withText('Submit');
const listItems = Selector('.item').count;
const nthItem = Selector('.item').nth(2);
const filtered = Selector('.item').withAttribute('data-status', 'active');
ページモデル
import { Selector, t } from 'testcafe';

class LoginPage {
    constructor() {
        this.usernameInput = Selector('#username');
        this.passwordInput = Selector('#password');
        this.submitButton = Selector('button[type="submit"]');
    }
    async login(username, password) {
        await t
            .typeText(this.usernameInput, username)
            .typeText(this.passwordInput, password)
            .click(this.submitButton);
    }
}
export default new LoginPage();
TestMu AI Cloud

クラウドの完全なセットアップについては、reference/cloud-integration.md を参照してください。機能については、shared/testmu-cloud-reference.md を参照してください。

export LT_USERNAME=your_username
export LT_ACCESS_KEY=your_key
npx testcafe "lambdatest:Chrome@latest:Windows 11" tests/
アンチパターン
悪い例良い例理由
await t.wait(5000)タイムアウト付きのスマートなアサーション任意の待機時間
深い CSS セレクターSelector().withText()壊れやすい
エラー時のスクリーンショットなし失敗時に t.takeScreenshot()デバッグ情報が不足

クイックリファレンス

タスクコマンド
すべて実行npx testcafe chrome tests/
ヘッドレスで実行npx testcafe chrome:headless tests/
特定のテストを実行npx testcafe chrome tests/login.js
複数のブラウザーnpx testcafe chrome,firefox tests/
ライブモードnpx testcafe chrome tests/ --live
スクリーンショットawait t.takeScreenshot()
サイズ変更await t.resizeWindow(1280, 720)

詳細なパターン

高度なパターン、デバッグガイド、CI/CD 統合、ベストプラクティスについては、 reference/playbook.md を参照してください。

コメント