Cypress chạy trong cùng event loop với app (không qua WebDriver) — time-travel debugging, auto-retry, và cy.intercept() là điểm mạnh; nhược điểm: chỉ Chromium+Firefox, không support multiple tabs, không có async/await native.
- Cypress là E2E testing framework chạy trong browser (không qua WebDriver protocol như Selenium).
- Architecture khác biệt: Cypress chạy trong cùng event loop với app — có thể access application state, intercept network requests, control timers trực tiếp.
- Time-travel debugging: mỗi command được snapshot, hover qua command list để xem DOM state tại từng bước — exceptional debugging experience.
- Automatic waiting: Cypress tự retry assertions cho đến khi pass hoặc timeout — không cần manual sleep/waitForElement như Selenium. cy.intercept() cho network stubbing: mock API responses, simulate network errors, wait for specific requests to complete.
- Component testing: Cypress Component Testing mount individual components trong isolation — alternative cho Jest + Testing Library với real browser. cy.session() để cache và reuse authentication state giữa tests — giảm login overhead.
- Cypress Cloud: parallel test execution, flaky test detection, video recording.
- Nhược điểm: chỉ support Chromium-based browsers và Firefox (không có Safari/WebKit); không support multiple tabs trong cùng test; test code phải bất đồng bộ theo Cypress command queue — không dùng async/await thông thường.
- Thích hợp: rich interactive app testing, khi cần time-travel debugging, single-browser test suites.
Cypress runs in the same event loop as the app (no WebDriver) — time-travel debugging, auto-retry, and cy.intercept() are its strengths; drawbacks: Chromium+Firefox only, no multiple tabs support, no native async/await.
- Cypress is an E2E testing framework that runs inside the browser (not via the WebDriver protocol like Selenium).
- Different architecture: Cypress runs in the same event loop as the app — it can access application state, intercept network requests, and control timers directly.
- Time-travel debugging: every command is snapshotted; hover over the command list to see the DOM state at each step — an exceptional debugging experience.
- Automatic waiting: Cypress automatically retries assertions until they pass or time out — no need for manual sleep/waitForElement as in Selenium. cy.intercept() for network stubbing: mock API responses, simulate network errors, wait for specific requests to complete.
- Component testing: Cypress Component Testing mounts individual components in isolation — an alternative to Jest + Testing Library with a real browser. cy.session() caches and reuses authentication state between tests — reduces login overhead.
- Cypress Cloud: parallel test execution, flaky test detection, video recording.
- Limitations: only supports Chromium-based browsers and Firefox (no Safari/WebKit); does not support multiple tabs in the same test; test code must follow the Cypress command queue asynchrony model — standard async/await cannot be used freely.
- Best suited for: rich interactive app testing, when time-travel debugging is needed, single-browser test suites.