簡體   English   中英

如何將 cypress-plugin-tab 添加到我的 Angular e2e 測試中?

[英]How to add cypress-plugin-tab to my Angular e2e testing?

我正在使用 Angular12、NX、賽普拉斯和 KendoUI。 我需要通過表單元素測試制表符。 如何將 cypress-plugin-tab 添加到我的 e2e 測試中?

該指南說在 suppport/index.ts 文件中使用 require - 這對我不起作用。

我已執行npm install -D cypress-plugin-tab並將require('cypress-plugin-tab')添加到 suppport/index.ts 我已將此代碼添加到我的測試中:

   let password = 'Password';
   let input = cy.focused();
   
   input.type(username).tab().type(password);

這不起作用,因為它說找不到“標簽”。 如何讓“制表符”在 Angular 中工作? 在此處輸入圖像描述

您需要在 tsconfig.json 中添加 compilerOptions > 鍵入 cypress-plugin-tab src 路徑。

  "compilerOptions": {
    "strict": true,
    "target": "es6",
    "lib": ["es6", "dom"],
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "skipLibCheck": true,
    "types": ["node", "cypress", "cypress-plugin-tab/src"],
    "allowSyntheticDefaultImports": true
  },

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM