Setting Up Cypress Tests for 1C-Bitrix
Your Bitrix project is growing, and manual regression testing is eating up 30% of the budget. We have faced this many times. Our engineers implement Cypress tests for E2E coverage of critical paths — filtering, cart, checkout. Result: a test suite run takes 10 minutes instead of 3 hours of manual checks. Errors are caught before deployment, and flaky tests almost disappear.
Why Cypress is Better than Selenium for Bitrix
Cypress runs inside the browser, has full access to DOM and network. Unlike Selenium, it automatically waits for elements and AJAX responses, so race conditions with sleep() are unnecessary. In practice, this yields 2-3 times fewer flaky tests and reduces run time by 40% on average. Additionally, Cypress can take screenshots on failures and record videos — debugging takes minutes, not hours. As confirmed by the official documentation, Cypress's automatic waiting significantly reduces unstable tests.
What Problems We Solve
Unstable Selenium tests — frequent bugs due to slow Bitrix AJAX requests (filtering, cart updates). Cypress waits for all network requests to finish before moving to the next step.
CSRF and session complexity — Bitrix uses sessid for CSRF protection. Cypress automatically picks up cookies, and we add custom commands for correct authorization.
Lack of CI integration — tests run locally but not in the pipeline. We set up execution in GitHub Actions / GitLab CI, regression checks on every push.
How to Set Up Cypress for a Bitrix Project
Installation and basic configuration take 4–8 hours. Key steps:
- Install the framework
npm install --save-dev cypress - Create configuration file
cypress.config.ts:
import { defineConfig } from 'cypress'; export default defineConfig({ e2e: { baseUrl: 'https://test.site.ru', specPattern: 'cypress/e2e/**/*.cy.ts', supportFile: 'cypress/support/e2e.ts', viewportWidth: 1280, viewportHeight: 900, defaultCommandTimeout: 8000, requestTimeout: 10000, video: false, screenshotOnRunFailure: true, experimentalModifyObstructiveThirdPartyCode: true, }, env: { adminLogin: 'admin', adminPassword: '', // from environment variable CYPRESS_adminPassword siteSessid: '', }, }); -
Add custom commands for working with Bitrix (authorization, adding to cart, getting sessid).
-
Write E2E tests, for example, for the smart catalog filter:
// cypress/e2e/catalog/filter.cy.ts describe('Smart catalog filter', () => { beforeEach(() => { cy.visit('/catalog/tools/'); cy.get('.catalog-filter').should('be.visible'); cy.get('.product-list').should('be.visible'); }); it('filters products by brand', () => { cy.get('[data-filter-prop="BRAND"] [value="bosch"]').click(); cy.get('.catalog-loading').should('not.exist'); cy.url().should('include', 'brand=bosch'); cy.get('.product-brand').each($el => { cy.wrap($el).should('have.text', 'Bosch'); }); }); it('resets filter', () => { cy.get('[data-filter-prop="BRAND"] [value="bosch"]').click(); cy.get('.catalog-loading').should('not.exist'); cy.get('.filter-reset-btn').click(); cy.get('.catalog-loading').should('not.exist'); cy.url().should('not.include', 'brand=bosch'); }); it('displays correct product count in filter counter', () => { cy.get('[data-filter-prop="BRAND"] [value="makita"]').click(); cy.get('.catalog-loading').should('not.exist'); cy.get('.products-count').invoke('text').then(text => { const count = parseInt(text.replace(/\D/g, '')); cy.get('.product-card').should('have.length', Math.min(count, 24)); }); }); }); Comparison of Cypress and Selenium for Bitrix
| Parameter | Cypress | Selenium WebDriver |
|---|---|---|
| Execution speed | 2x faster (no network delays between steps) | Slower due to waits and browser start/stop |
| Test stability | Virtually no flaky tests (automatic waiting) | Frequent StaleElement and Timeout |
| Debugging | Built-in time travel, video, screenshots | Requires third-party solutions |
| Handling iframes and popups | Limited (not recommended) | Full support |
| CI integration | Simple, ready-made Docker images | Requires Grid setup |
To isolate tests from external services, use cy.intercept to mock AJAX requests. This is especially useful when integrating with 1C, where data exchange may be unstable. Practical case: in one project with a catalog of 10,000 products, we mocked filter responses, reducing run time from 45 to 12 minutes.
How the Implementation Works
- Audit of current functionality — identify critical scenarios (catalog, cart, checkout, personal account).
- Infrastructure setup — install Cypress, configure for your template, connect CI.
- Writing tests — cover 5–10 key scenarios initially, then expand to full regression.
- CI/CD integration — configure to run on every pull request, send reports to Slack/Telegram.
- Team training — conduct session on writing and maintaining tests.
What Is Included in the Work
- Cypress project configuration for your environment.
- Custom command set (authorization, currency selection, sessid retrieval).
- E2E test suite for critical paths (minimum 10 tests).
- CI integration (GitHub Actions / GitLab CI).
- Documentation on running and maintaining.
- 1 month of support: fixing flaky tests and modifications.
Checklist for Cypress Readiness
- [ ] Data attributes defined in the template (
[data-action="add-to-cart"]). - [ ] Test environment with test data (catalog, prices, users).
- [ ] CI server with Docker and Node configured.
- [ ] Critical scenario criteria agreed upon.
Timeline
| Task | Duration |
|---|---|
| Cypress installation, base config, custom commands | 4–8 hours |
| E2E tests for critical scenarios (5–10 tests) | 1–2 days |
| Full test suite for catalog + cart + checkout | 2–4 days |
| Integration into GitHub Actions / GitLab CI | 4–8 hours |
Our engineers have over 10 years of Bitrix experience and 1C-Bitrix certifications. We guarantee test stability and transparent reporting. Contact us for a consultation and project assessment. Order testing implementation — reduce regression costs by 2-3 times. Get a consultation for your project — we will evaluate the complexity and suggest the optimal test suite.

