4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[TestCafe]アクションとアサーションAPI 一覧

Posted at

ほとんど公式にドキュメントがあるのですが、
私の私による私の為のメモとして。

自分の使用したことのあるものを、自分の理解している範囲で残します。

ACTION

操作 形式 備考
クリック t.click( selector )
指定の座標へドラッグ t.drag( Selector, dragOffsetX, dragOffsetY ) Selector(要素)をドラッグする先のX、Y座標を指定します
指定の要素へドラッグ t.dragToElement( selector, destinationSelector ) Selector(要素)をドラッグする先のdestinationSelector(要素)を指定します
マウスオーバー t.hover( selector )
文字を入力 t.typeText( selector,'文字列' )
キーボード操作 t.pressKey('key')
ファイルアップロード t.setFilesToUpload( selector ,filepath )

ASSERTION

形式 備考
Deep Equal t.expect( selector ).eql('比較対象')

Deep Equal

今のところほぼこれしか使用していませんが、要素の出力が正しいか等で有用です。
t.expect( selector.textContent).eql('TEST')
として、出力文字列が「TEST」となることを確認したい時等に使用します。

PASSの時

✓ TEST になっているか

FAILの時

AssertionError: expected 'テスト' to deeply equal 'TEST'

こんな感じで期待値と結果をデフォルトで教えてくれるようになってます。
便利!

今後のテスト状況で他にも多様するものがあれば、随時追記していきます。

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?