From 4be99ec3c8d2552f1267188852d0aaf5a5a9cf0c Mon Sep 17 00:00:00 2001 From: irasally Date: Tue, 22 Jun 2021 17:26:49 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B5=E3=82=A4=E3=83=97=E3=83=AC=E3=82=B9?= =?UTF-8?q?=E3=82=92=E8=8B=B1=E5=8D=98=E8=AA=9E=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- intro-1/cypress.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/intro-1/cypress.md b/intro-1/cypress.md index 2a6aa930f..35dc0a690 100644 --- a/intro-1/cypress.md +++ b/intro-1/cypress.md @@ -26,10 +26,10 @@ npx tsc --init --types cypress --lib dom,es6 echo {} > cypress.json ``` -> ここでは特にサイプレスのために別々の`e2e`フォルダを作成するいくつかの理由があります: +> cypressのために別の`e2e`フォルダを作成するのには、いくつかの理由があります: > > * 別のディレクトリや`e2e`を作成すると、`package.json`の依存関係を他のプロジェクトと簡単に分離することができます。これにより依存性の競合が少なくなります。 -> * テストフレームワークには、グローバルな名前空間を`describe` `it` `expect`などのもので汚染する慣習があります。グローバルな型定義の競合を避けるために、e2e `tsconfig.json`と`node_modules`をこの特別な`e2e`フォルダに保存することが最善です。 +> * テストフレームワークには、グローバルな名前空間を`describe` `it` `expect`などのもので汚染する慣習があります。グローバルな型定義の競合を避けるために、e2eの `tsconfig.json`と`node_modules`をこの特別な`e2e`フォルダに保存することをおすすめします。 `e2e/package.json`ファイルにいくつかのスクリプトを追加します: @@ -98,9 +98,9 @@ Cypressテストはコンパイル/パックされ、ブラウザで実行され たとえば、UIセレクタとテストの間でID値を共有して、CSSセレクタが壊れないようにすることができます。 ```typescript -import { Ids } from '../../../src/app/constants'; +import { Ids } from '../../../src/app/constants'; -// Later +// Later cy.get(`#${Ids.username}`) .type('john') ``` @@ -110,7 +110,7 @@ cy.get(`#${Ids.username}`) さまざまなテストがページで行う必要があるすべてのインタラクションに対して便利なハンドルを提供するオブジェクトを作成することは、一般的なテストの慣例です。getterとメソッドでTypeScriptクラスを使用してページオブジェクトを作成できます。 ```typescript -import { Ids } from '../../../src/app/constants'; +import { Ids } from '../../../src/app/constants'; class LoginPage { visit() { @@ -400,4 +400,3 @@ package.jsonの例: * Visual Testing: [https://docs.cypress.io/guides/tooling/visual-testing.html](https://docs.cypress.io/guides/tooling/visual-testing.html) * Optionally set a `baseUrl` in cypress.json to [prevent an initial reload that happens after first `visit`.](https://github.com/cypress-io/cypress/issues/2542) * Code coverage with cypress: [Webcast](https://www.youtube.com/watch?v=C8g5X4vCZJA) -