LoginSignup
1
1

More than 1 year has passed since last update.

Cypress でキー入力(type) の Delay を無くす

Last updated at Posted at 2022-11-28

概要

Cypress におけるキーボード入力用の API である type は、デフォルトで1文字入力ごとに 10ms の待機が発生し、長文を入力する場合にテストが遅くなってしまうことがあるので、これを解消する。

バージョン

  • cypress: 11.0.0

コマンドごとに Delay を設定する

type メソッドのオプションを設定すればOK

cy.get('input').type('Hello, World', { delay: 0 })

テスト全体でのデフォルト値を変更する

cypress/support あたりの設定ファイルに記述すればOK

Cypress.Keyboard.defaults({
  keystrokeDelay: 0
})

参考

1
1
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
1
1