RepositoryJavaScriptNLHà Lan
ME

meinaart/cypress-plugin-snapshots

Plugin for snapshot tests in Cypress.io

493sao
117fork
91issue
0lượt xem

🧪 cypress-plugin-snapshots — Plugin snapshot test cho Cypress.io

Thêm toMatchSnapshot và toMatchImageSnapshot vào Cypress để kiểm tra thay đổi giao diện và dữ liệu nhanh chóng.

cypress-plugin-snapshots là plugin mã nguồn mở cho Cypress.io, cung cấp hai lệnh toMatchSnapshot (so sánh text/JSON/HTML) và toMatchImageSnapshot (so sánh ảnh giao diện). Dự án giúp kiểm thử viên dễ dàng theo dõi thay đổi giao diện người dùng hoặc dữ liệu trả về từ API mà không cần viết logic so sánh thủ công.

✨ Điểm nổi bật

  • Text snapshots: so sánh chuỗi, JSON, HTML với tùy chọn bỏ qua trường hoặc phần tử dư thừa.
  • Image snapshots: chụm ảnh toàn trang hoặc phần tử cụ thể, hỗ trợ ngưỡng chênh lệch pixel/percent.
  • Tùy chỉnh giá trị mặc định: cấu hình trong cypress.json, bao gồm tự động cập nhật snapshot mới.
  • Hiển thị diff trực quan: hỗ trợ tạo ảnh diff và hiển thị modal so sánh.
  • Tích hợp dễ dàng: chỉ cần thêm plugin và lệnh vào cypress/plugins/index.js và cypress/support/index.js.
  • Hỗ trợ tùy chọn nâng cao: như replace, prettier, screenshotConfig, serverEnabled, v.v.

💡 Vì sao đáng chú ý

Khác với cách so sánh thủ công bằng assertion từng giá trị, plugin này tự động lưu và so sánh snapshot, giảm đáng cảm ứng khi giao diện thay đổi nhỏ. Phù hợp cho dự án cần kiểm tra giao diện ổn định hoặc theo dõi thay đổi dữ liệu API. Đặc biệt hữu ích trong CI để phát hiện thay đổi không mong muốn.


#CypressIO #SnapshotTesting #VisualTesting #OpenSource #TiniX

Dự án tương tự

Khám phá các dự án và mô hình AI khác có sự tương đồng.

RepositoryJavaScript
abramenal/cypress-file-upload

File upload testing made easy

493
May 30, 2023
RepositoryJavaScript
bahmutov/cypress-failed-log

Saves the Cypress test command log as a JSON file if a test fails

195
Jun 6, 2026
RepositoryJavaScript
cypress-io/github-action

GitHub Action for running Cypress end-to-end & component tests

1.5k
Nov 25, 2026
RepositoryJavaScript
percy/percy-cypress

Visual testing with Cypress and Percy

352
Nov 30, 2026
RepositoryJavaScript
LironEr/cypress-mochawesome-reporter

Zero config Mochawesome reporter for Cypress with screenshots and videos

185
Oct 2, 2026
RepositoryJavaScript
Shelex/cypress-allure-plugin

cypress plugin to use allure reporter api in tests

170
May 17, 2025
RepositoryJavaScript
cypress-io/cypress-xpath

Adds XPath command to Cypress test runner

145
Oct 13, 2022
RepositoryJavaScript
bahmutov/add-typescript-to-cypress

Quickly adds TypeScript spec support to Cypress

107
Nov 16, 2026
RepositoryJavaScript
elaichenkov/cy-verify-downloads

Cypress custom command to wait and verify that file has been downloaded

71
Jan 26, 2026