0
0

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 3 years have passed since last update.

動画で学ぶJHipster (4) (Cypressテスト)

Posted at

参考動画

テスト (Cypress)

参考動画の3:25辺りから~

Web UI の自動テストツール Cypress を使った自動テスト、end to end test が実行できるようです。
まず、サーバーをコマンドmvnwで立ち上げておきます。
その後、別のコンソールを開いて、npm run e2eを実行します。

自動でブラウザが立ち上がり、テストが実行されます。
画面が高速で目まぐるしく動いて、見てたら疲れます(笑)
2.PNG
3.PNG

結果がコンソールに表示されます。
0.PNG
1.PNG

src\test\javascript\cypress\integration以下のフォルダに入っている*.spec.tsファイルがテストで実行される対象となっています。

エラーになる場合

動画ではnpm run e2eを実行すると、特にエラーもなく、すんなりうまくいっているみたいですが、私がやるとエラーになりました(笑)

You passed the --record flag but this project has not been setup to record.
This project is missing the 'projectId' inside of 'cypress.json'.
We cannot uniquely identify this project without this id.
You need to setup this project to record. This will generate a unique 'projectId'.
Alternatively if you omit the --record flag this project will run without recording.

調べると、同じエラーに遭遇している人がいるみたいで汗・・・

ファイルpackage.json の中を以下のように変えると、動作しました。

変更前

"e2e:cypress": "cypress run --browser chrome --record ${CYPRESS_ENABLE_RECORD:-false}",

変更後

"e2e:cypress": "cypress run --browser chrome --record false",

今回のコード

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?