React-typeScript:赛普拉斯测试

时间:2020-07-23 11:06:35

标签: cypress react-typescript

我真的是Cypress Test的新手。我正在为我的应用程序使用React-typescript。我想测试一下默认的App组件。我真的不怎么测试它。当我这样编写测试时:

describe('dd', () => {
  it('', () => {
    cy.visit('http://localhost:3000/') 
   
  })
})

这使我出错。像这样:

enter image description here

运行该应用程序后,它不会显示错误。这是正确的测试方法吗?

第二次,我像这样测试链接:

describe('dd', () => {
  it('', () => {
    cy.visit('http://localhost:3000/')
    cy.get(`App-link`).should('be.visiable').and("have.text", "Learn React")
  })
})

我遇到一个错误:

enter image description here

我正在为我的应用程序使用Eslint,这是设置:

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react"
  },
  "include": [
    "src"
  ]
}

React-typescript和Cypress是否有任何样板?

0 个答案:

没有答案