Building a Resilient E2E Test Suite for a Crypto Exchange Staging Environment
During the first month of my internship at PT Darmawan Aryansyah Teknologi (DAT), I worked with the Developer division to automate regression testing for Coinx, a crypto asset exchange platform.
Before this project, regression testing was done manually: testers walked through scenarios step by step, checked the UI, and took screenshots as proof. That approach works when a product is small, but it quickly becomes a bottleneck—every release repeats the same steps, and manual evidence is hard to compare across iterations.
My goal was to build a repeatable automated test suite against the staging environment covering core user flows—bank account management, fiat (IDR) deposits and withdrawals, and crypto asset (USDT, ETH, BTC) deposits and withdrawals—while leaving out flows that inherently require human interaction or visual chart interpretation, such as KYC verification and live trading.
Structuring the Suite with Page Object Model
I built the suite using Python 3.14, uv, and pytest, structured around the Page Object Model (POM). Each application page lives in its own class responsible for selectors and UI interactions, while the test files only orchestrate user flows and assertions.
Shared browser setup, authentication, and helper utilities are injected via pytest fixtures, and all test credentials, TOTP secrets, and API keys stay isolated in .env files outside version control. This separation meant that when a UI flow changed, I only had to update a single page object rather than hunting through dozens of test files.
Dealing with Staging Realities
Automating a real financial/crypto staging app is rarely as simple as clicking buttons. Several practical hurdles shaped the architecture:
- Bot protection & login captchas: Automated browser sessions were immediately flagged by Cloudflare Turnstile, and the login form included a captcha. Running Chrome via SeleniumBase UC Mode handled the browser-level protection, while authenticating directly against the login API endpoint and injecting the resulting JWT token as a browser cookie bypassed the login captcha cleanly.
- Time-based 2FA: Sensitive flows required two-factor authentication. Using
pyotpwith the test account's TOTP secret allowed the suite to generate valid 6-digit codes on demand without manual input. - Shifting UI locators: Because the staging app was actively under development, single selectors broke frequently. I built a
SmartLocatorwrapper that tries multiple fallback strategies (ID, CSS selector, XPath) in sequence. If every fallback fails, an LLM-assisted self-healing module (backed by Google Gemini) inspects the context and suggests a replacement selector before giving up. - Payment gateway dependencies: Fiat deposit flows depended on external payment gateway confirmations (Xendit). To avoid manual intervention, I wrote a payment API helper to simulate gateway callbacks during test runs.
- Traceable evidence: Because one of the main pain points of manual testing was assembling proof, I added a
ScreenshotManagerthat captures sequentially numbered screenshots at every critical step alongside structured logs.
Results and the Biggest Lesson
Executing the full suite of 33 positive and negative scenarios against staging produced a 79% pass rate (26 passed, 4 failed, 3 marked as expected failures for known unstable features), with every negative validation check passing.
The most valuable takeaway wasn't the pass rate itself—it was learning to separate test-script defects from actual application defects before reporting them. When four scenarios failed, digging into the execution logs showed that two were caused by our payment gateway simulation not handling a response format properly, while the other two were genuine application error messages on staging. Treating every red test as an app bug wastes developer time; triaging logs and screenshots first makes automation genuinely useful to the team.
One limitation remaining at the end of the project was that the suite still ran on demand rather than inside Coinx's internal CI pipeline—which would require dedicated secret management and deterministic test-data resets between runs.