MIT License

项目介绍

cypress-io/cypress-example-todomvc 是一个托管在 GitHub 上的开源项目,主要使用 JavaScript 编写,采用 MIT License 许可证,目前获得 268 个 Star、499 次 Fork。

仓库全名
cypress-io/cypress-example-todomvc
开源许可证
MIT License
Star 数
268
Fork 数
499
未关闭 Issue
1

README 摘要

This repo contains an example React App, with the tests written in Cypress and running tests in Circle CI. The tests are written to be directly compared to the official TodoMVC tests. Each test covers the same functionality found in the official TodoMVC tests but utilizes the Cypress API. The tests are heavily commented to ease you into the Cypress API. You can find the official TodoMVC tests we are comparing to…

完整内容见 GitHub 原始 README 或本页 。

常见问题

cypress-example-todomvc 用什么语言开发?

主要使用 JavaScript 编写,采用 MIT License 许可证,目前有 268 个 Star。

cypress-example-todomvc 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 cypress-example-todomvc 的源码?

可以直接克隆仓库:git clone https://github.com/cypress-io/cypress-example-todomvc.git,默认分支为 master;安装与运行步骤见仓库 README。

cypress-example-todomvc 最近还在维护吗?

仓库最近一次更新为 2025年10月10日,当前有 1 个未关闭 Issue;Star 数为 268,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

The official TodoMVC tests written in Cypress.

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
1277
价值分
311
活跃状态
归档

语言占比

HTML
JavaScript
TypeScript

README

TodoMVC Circle CI

This repo contains an example React App, with the tests written in Cypress and running tests in Circle CI.

The tests are written to be directly compared to the official TodoMVC tests. Each test covers the same functionality found in the official TodoMVC tests but utilizes the Cypress API.

The tests are heavily commented to ease you into the Cypress API.

You can find the official TodoMVC tests we are comparing to here. And here. And here.

Help + Testing

The steps below will take you all the way through Cypress. It is assumed you have nothing installed except for node + git.

If you get stuck, here is more help:

1. Install Cypress

Follow these instructions to install Cypress.

2. Fork this repo

If you want to experiment with running this project in Continous Integration, you’ll need to fork it first.

After forking this project in Github, run these commands:

## clone this repo to a local directory
git clone https://github.com/<your-username>/cypress-example-todomvc.git

## cd into the cloned repo
cd cypress-example-todomvc

## install the node_modules
npm install

## start the local webserver
npm start

The npm start script will spawn a webserver on port 8888 which hosts the TodoMVC app.

You can verify this by opening your browser and navigating to: http://localhost:8888

You should see the TodoMVC app up and running. We are now ready to run Cypress tests.

3. Add the project to Cypress

Follow these instructions to add the project to Cypress.

4. Run in Continuous Integration

Follow these instructions to run the tests in CI.

Cypress IntelliSense

If you use modern IDE that supports TypeScript (like VSCode), you can benefit from Cypress type declarations included with the cypress NPM module. Just add @ts-check to the spec file and configure “dummy” tsconfig.json file and see IntelliSense over cy.<something> commands.

cy.type IntelliSense

Custom commands

This project also adds several custom commands in cypress/support/commands.js. They are useful to create one or more default todos from the tests.

it('should append new items to the bottom of the list', function () {
  cy.createDefaultTodos().as('todos')
  // more test commands
})

To let TypeScript compiler know that we have added a custom command and have IntelliSense working, I have described the type signature of the custom command in file cypress/support/index.d.ts. Here is how this file looks; the type signatures should match the arguments custom commands expect.

/// <reference types="cypress" />

declare namespace Cypress {
  interface Chainable<Subject> {
    /**
     * Create several Todo items via UI
     * @example
     * cy.createDefaultTodos()
     */
    createDefaultTodos(): Chainable<any>
    /**
     * Creates one Todo using UI
     * @example
     * cy.createTodo('new item')
     */
    createTodo(title: string): Chainable<any>
  }
}

To include the new “.d.ts” file into IntelliSense, I could update tsconfig.json or I could add another special comment to the JavaScript spec files - /// <reference types="...>.

// type definitions for Cypress object "cy"
/// <reference types="cypress" />

// type definitions for custom commands like "createDefaultTodos"
// will resolve to "cypress/support/index.d.ts"
/// <reference types="../support" />

Related: IntelliSense for custom Chai assertions added to Cypress

Support

If you find errors in the type documentation, please open an issue

You can also ask questions in our chat channel

评论

暂无评论