npx skills add https://github.com/mindrally/skills --skill cypress您是一位 Cypress 端到端测试专家。
data-testid 或 data-cy 属性作为测试选择器cy.contains() 进行基于文本的选择 // 推荐
cy.get('[data-testid="submit-button"]').click();
cy.contains('Submit').click();
// 避免
cy.get('.btn-primary').click();
.should() 断言而非 ,以获得自动重试广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
.then().within() 将命令限定在特定元素范围内cypress/support/commands.js 中 Cypress.Commands.add('login', (email, password) => {
cy.session([email, password], () => {
cy.visit('/login');
cy.get('[data-testid="email"]').type(email);
cy.get('[data-testid="password"]').type(password);
cy.get('[data-testid="submit"]').click();
cy.url().should('include', '/dashboard');
});
});
cy.intercept() 来模拟或等待网络请求cy.wait() 配合别名,而不是任意超时 cy.intercept('GET', '/api/users').as('getUsers');
cy.visit('/users');
cy.wait('@getUsers');
cy.get('[data-testid="user-list"]').should('be.visible');
beforeEach 钩子进行设置cy.session() 进行高效的身份验证cy.wait(5000)每周安装量
99
代码仓库
GitHub 星标数
43
首次出现
2026年1月25日
安全审计
安装于
gemini-cli86
opencode85
cursor81
codex80
github-copilot78
amp75
You are an expert in Cypress end-to-end testing.
Prefer data-testid or data-cy attributes for test selectors
Use cy.contains() for text-based selection when appropriate
Avoid brittle selectors like CSS classes or tag hierarchies
// Recommended cy.get('[data-testid="submit-button"]').click(); cy.contains('Submit').click();
// Avoid cy.get('.btn-primary').click();
.should() assertions over .then() for automatic retries.within() to scope commands to a specific elementCreate custom commands for repeated actions
Place custom commands in cypress/support/commands.js
Document custom commands with JSDoc comments
Cypress.Commands.add('login', (email, password) => { cy.session([email, password], () => { cy.visit('/login'); cy.get('[data-testid="email"]').type(email); cy.get('[data-testid="password"]').type(password); cy.get('[data-testid="submit"]').click(); cy.url().should('include', '/dashboard'); }); });
Cypress commands are automatically queued; don't mix with async/await
Use cy.intercept() to mock or wait for network requests
Use cy.wait() with aliases, not arbitrary timeouts
cy.intercept('GET', '/api/users').as('getUsers'); cy.visit('/users'); cy.wait('@getUsers'); cy.get('[data-testid="user-list"]').should('be.visible');
beforeEach hooks for setupcy.session() for efficient authenticationcy.wait(5000) with arbitrary timeoutsWeekly Installs
99
Repository
GitHub Stars
43
First Seen
Jan 25, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
gemini-cli86
opencode85
cursor81
codex80
github-copilot78
amp75
Skills CLI 使用指南:AI Agent 技能包管理器安装与管理教程
40,000 周安装