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.
Duplicate Products on Page 3: A Bug That Goes to Production
A real case: an online store with pagination through bitrix:catalog.section duplicates products on page three after every second visit. Cache clearing helps for a day, then the duplicates return. Root cause: a custom sort handler collides with PAGEN_1, and under a specific filter combination CIBlockElement::GetList returns identical IDs. Code review missed it; only testing caught it. We build QA for 1C-Bitrix projects that catches such bugs before they hit production: manual functional, automated E2E, load, and acceptance testing. With over a decade of Bitrix experience, we have a library of typical pitfalls and test scenarios that prevent these issues from the start.
How Does a Standard Bitrix Project Break Without Dedicated Testing?
1C-Bitrix is not a landing page. Behind the frontend lie dozens of modules, external integrations, and non‑obvious dependencies. A discount change in sale.discount breaks a promo code in sale.basket.discount — the discount module is one of the most fragile in the platform. Interchange with 1C via catalog.import.1c or REST fails when property mapping is off, resulting in products without price or stock. Core updates — bitrix:main updated, a custom component uses the deprecated CModule::IncludeModule. Without regression testing, every deployment is Russian roulette. Cross‑browser: sale.order.ajax renders differently in Safari and Chrome; the “Place Order” button can move off‑screen on an iPhone. These are not edge cases — they are daily realities for Bitrix teams.
What Does Functional Testing Cover?
We check every business scenario — not just “works or doesn’t work”, but all boundary cases.
Catalog (catalog.section, catalog.element)
- Smart filter
catalog.smart.filter: all property combinations, reset, result counting. Filters by SKUs break most often.
- Sorting + pagination — the duplicate bug described above.
- Comparison via
catalog.compare.list — add, remove, display differences.
- Quick view — modal window, cart from modal.
Cart and Order (sale.basket.basket, sale.order.ajax)
- Adding from catalog, product page, quick order.
- Discounts: by quantity, by amount, by coupon, cumulative. Discount intersection — at least eight test combinations.
- Delivery calculation: handlers
sale.delivery.services, cost, time, pickup points on map.
- Payment:
sale.paysystem — processing, handling declines, refunds.
- Order placement: email via
main.mail.event, CRM recording, transmission to 1C via sale.export.1c.
Personal Account (sale.personal.section)
- Registration, authorization, password recovery — including Cyrillic email edge cases.
- Order history, repeat order.
- Subscriptions, bonus program.
Forms and Search
-
form.result.new / iblock.element.add.form — submission, validation, file fields.
-
search.page — relevance, morphology, typo handling via search.title.
Why Is Regression Testing Critical for Bitrix?
After every deployment we verify that nothing previously working is broken.
-
Smoke tests — main page loads, catalog shows products, order completes. 5 minutes, run after every deploy. If smoke fails — roll back immediately.
-
Regression suite — 40–80 test cases covering main scenarios before every release.
-
Visual testing — screenshot comparison (Percy or Playwright). A button shifted 20px, font changed after update — test shows the diff.
-
Module checklists — structured lists for
sale, catalog, iblock, search. Each module has its own checklist.
What Happens During Load Testing?
The question is not “will the site handle it” but at how many concurrent users catalog.section starts returning 500 errors.
| Scenario |
Share |
Target Response |
What Breaks First |
| Main page |
20% |
< 1 sec |
Composite cache if not configured |
| Catalog with filters |
30% |
< 2 sec |
MySQL – heavy JOINs on b_iblock_element_property |
| Product page |
25% |
< 1.5 sec |
Queries for SKUs |
| Add to cart |
10% |
< 1 sec |
Table locks on b_sale_basket |
| Checkout |
5% |
< 3 sec |
Delivery handlers (external APIs) |
| Search |
10% |
< 2 sec |
b_search_content without indexes |
Tools:
-
k6 — JavaScript scripting.
- Apache JMeter — classic, for complex scenarios with cookie authorization.
- Yandex.Tank — real‑time visualization, integration with Overload.
Output: peak RPS, response times by percentiles p50/p95/p99, bottlenecks (CPU, RAM, MySQL slow queries on b_iblock_element, file cache). Recommendations: which index to add, which query to rewrite with D7 ORM, where to enable composite cache.
What Deliverables Do You Receive After Testing?
- Test plan with scope, priorities, and quality criteria.
- Test case suite — functional, regression, load.
- Defect report in a tracker (Jira/YouTrack) with severity classification.
- Auto tests (Playwright/Cypress) — basic smoke suite for CI/CD.
- Load testing protocol with graphs and recommendations.
- Acceptance certificate after UAT — confirming readiness for launch.
After delivery, we provide free consultation for a month — answering questions on test improvements and process adaptation. Contact us to receive a full package of documents and auto tests.
Cross‑Browser Testing
We test where buyers actually are. Statistics from your Metrica are more important than general market data.
Minimum set:
- Chrome (last 2 versions) — main traffic.
- Safari on iOS — critical for mobile checkout,
sale.order.ajax often behaves unpredictably.
- Yandex.Browser — significant share in Russia, Chromium‑based but with extension quirks.
- Samsung Internet — mobile Android, often forgotten.
Devices:
- Desktop: 1920×1080, 1366×768.
- iPhone: 375×812, 390×844 — checkout must be verified.
- Android: 360×800, 412×915.
Tools: BrowserStack for real devices, Playwright for automation on Chromium/Firefox/WebKit.
Automation
Playwright — primary choice for E2E on Bitrix:
- Cross‑browser: Chromium, Firefox, WebKit.
- Parallel execution, automatic waits.
- Works well with dynamic forms
sale.order.ajax.
- Supports mobile viewports and geolocation.
Cypress:
- Runs in browser — more stable for SPA‑like interfaces.
- Excellent visual runner for debugging.
- Limitation: only Chromium‑based browsers.
PHPUnit for custom code:
- Unit tests for custom Bitrix components and modules.
- Tests business logic without frontend dependency.
- Integration with CI/CD — GitLab CI, GitHub Actions.
UAT – Acceptance Testing
Final check with the client on a staging environment with real data:
- Jointly compile a list of critical scenarios — 15–20 key customer paths, not 200 test cases.
- Staging with a copy of the production database (anonymized personal data).
- Quick bug tracking — Jira/YouTrack, prioritization by severity.
- Acceptance protocol — document with results, signatures, and launch readiness.
Order UAT support and we guarantee a release without surprises.
QA Process – Integrated, Not Tacked On
-
Requirements analysis — QA participates in task discussions, catches ambiguities. “Does the discount apply to the product or the order?” — such a question upfront saves two days of debugging.
-
Test cases before development — scenarios ready before the first line of code.
-
Code review — checks for typical Bitrix mistakes: uncleared component cache, direct SQL queries instead of ORM, missing
$USER‑>IsAuthorized() check.
-
Functional → regression → deploy.
-
Post‑release monitoring — errors in
bitrix/error.log, metrics in Metrica, alerts for 500 errors.
We have been working with Bitrix for over 10 years and have tested more than 300 projects of various scales — from small online stores to corporate portals with 1C and Bitrix24 integration.
Timelines
| Task |
Duration |
| Test plan |
2–3 days |
| Functional testing (medium store) |
3–5 days |
| Basic E2E auto test suite (Playwright) |
2–3 weeks |
| Load testing + report |
1–2 weeks |
| Cross‑browser testing |
2–3 days |
| UAT support |
3–5 days |
| QA process from scratch |
3–4 weeks |
Testing cost is calculated individually for your project. Get a free consultation — we will assess the scope within one business day and provide a preliminary estimate and test plan. Contact us to discuss your project and schedule a call.