Testing the untestable: automating QA for Epic customer portals

By August 12, 2026Healthcare, Automation
epic-portal-cover

Iframes, runtime DOM mutation, and compliance gates make an Epic portal one of the hardest web surfaces to automate. Here is the layered framework that actually tames it, built on Playwright, Claude-powered agents, and visual AI.

Key takeaways

  • Epic portals break automation at four seams: iframe boundaries, runtime DOM mutation, async content, and compliance gates.
  • If you control the injection layer, inject stable data-testid and ARIA hooks there. It is the single highest-leverage fix.
  • Playwright drives, Applitools validates. They are complementary layers, not competing tools.
  • Cross-origin iframes limit visual capture. Audit frame origins before trusting coverage.
  • Use agents for triage and self-healing, not for generating tests at scale.
  • Rent commodity layers, build the agent that encodes your team’s judgment.

Epic MyChart is the digital front door for a huge share of patients in the United States. It is where they read lab results, book visits, message a care team, and complete an e-check-in. When a health system or a digital health vendor customizes that portal, or embeds their own app inside it, they inherit a quality assurance problem that looks deceptively normal from the outside and turns brutal the moment you try to automate it. At Bitcot, we build and test patient-facing healthcare software, and the Epic customer portal comes up again and again as the surface that breaks conventional test suites. This is a field guide to why that happens and how to build a test automation framework that survives contact with it. The short version: keep Playwright as your driver, use Applitools where visual truth matters, fix the root cause at the injection layer, and point AI agents at maintenance rather than mass generation.

Epic-portal-shell-wrapping-a-SMART on FHIR iframe
The system under test: an Epic portal shell wrapping a SMART on FHIR iframe, mutated at runtime, watched by a three-part test stack.

Why Epic customer portals resist automation

Diagnosis fail

Most teams arrive with a Selenium or Cypress suite that worked fine on their own greenfield app and watch it disintegrate against the portal. The failure is not incompetence. It is that an Epic portal violates almost every assumption a classic automation tool is built on. Four seams do most of the damage.

customized-Epic-portal-fights-back
The four seams where a customized Epic portal fights back against test automation.

1. Iframe boundaries

Epic integrations built on SMART on FHIR typically render inside an iframe or a separate window rather than as a native part of the page. That means the thing you actually want to test lives behind a frame boundary, and when the frame is cross-origin, the same-origin policy walls off its internals. Playwright can still drive a cross-origin frame through a frame locator, but selector strategies that assume a flat document fall apart, and visual capture tools can go partially blind inside a frame they are not allowed to read.

2. Runtime DOM mutation

This is the one that quietly destroys suites. Many portal customizations work by injecting JavaScript that rewrites the DOM after the page loads: swapping nodes, restyling elements, relabeling controls, sometimes regenerating IDs and class names on every render. A selector you recorded on Tuesday points at markup that no longer exists on Wednesday. The application under test is a moving target, and the movement depends on injection timing you do not fully control.

3. Dynamic and asynchronous content

Lab results, appointment slots, and secure messages stream in after the page appears to be settled. Fixed sleep waits either flake or slow the suite to a crawl, and genuine race conditions start masquerading as real regressions. Teams end up unable to tell a bug from a timing artifact, which erodes trust in the whole suite.

4. Authentication and compliance gates

Every meaningful path sits behind multi-factor authentication, aggressive session timeouts, and the reality that you are moving protected health information. HIPAA governs the data, and for anything touching clinical trial or regulated e-signature flows, 21 CFR Part 11 governs the audit trail. Test data, PHI handling, and traceability are not afterthoughts you bolt on. They are design constraints from the first line of the harness.

The trap
Because the portal looks like an ordinary web app, teams reach for record-and-replay tooling and a wall of CSS selectors. Against runtime-mutated markup, that approach does not just underperform. It generates a maintenance burden that grows faster than the coverage it buys.


The framework: cover each seam in a layer

Prescription pass

The durable answer is not a single silver bullet tool. It is a stack where each layer covers exactly what the layer below it cannot, and where you fix the root cause before you spend money compensating for it.

The-foundation-is-the-highest-leverage
Four layers, bottom to top. The foundation is the highest leverage and the one most teams skip.

Layer 1: fix the root cause with stable test hooks

Here is the move no tool vendor will sell you, because it shrinks their value. You already control the JavaScript that mutates the DOM at runtime. That means you can inject stable test hooks, such as data-testid attributes and correct ARIA roles, as part of the very same injection. Doing so converts an unstable selector problem into a stable one, at the source, for free. Most teams reach for smarter selector healing precisely because they believe they cannot touch the application. When you own the injection layer, you can, and that single decision removes more flakiness than any downstream tool. Everything above this layer becomes a backstop rather than the load-bearing wall.

Layer 2: Playwright as the driver

Playwright is the right foundation for the interaction layer. It handles same-origin and cross-origin frames throughframeLocator, its auto-waiting removes most fixed sleeps, and its user-facing locators, getByRole and getByTextare far more resilient to DOM churn than brittle CSS or XPath because they target what a user perceives rather than how the markup happens to be built today. When something does fail, the Playwright trace viewer gives you a frame-by-frame recording, network log, and DOM snapshot, which is the raw material your agent layer will later reason over.

Layer 3: visual validation where pixels are the truth

For a portal whose DOM you cannot fully trust, validating what the page looks like sidesteps the selector problem entirely. Applitools Eyes remains the best-in-class option for visual regression. Its visual AI flags meaningful layout, styling, and content shifts while ignoring the dynamic noise, and its visual locators can anchor an interaction on appearance rather than a DOM path your injection keeps rewriting.

Two caveats keep this honest. First, Applitools is a validation layer, not a browser driver. It complements Playwright; it does not replace it. Second, on genuinely cross-origin iframes, no tool bypasses the same-origin policy. Visual capture can render the frame blank or fall back to a screenshot it cannot introspect, which quietly weakens coverage exactly where the portal is most customized. Audit which frames are same-origin before you assume Eyes has you covered.

There is also a piece of the Applitools stack aimed squarely at runtime mutation that many teams miss: Execution Cloud heals locators at the driver level when the DOM shifts, so a script does not shatter every time injected markup changes. If Layer 1 is not fully in your control, this is the compensating control worth evaluating.

Building AI agents around the workflow, the right way

Layer 4 heal

This is where most of the current excitement lives, and where most of the current mistakes are made. The temptation is to point a model at the portal and have it generate a thousand end-to-end tests. Against a moving DOM, that does not solve your problem. It multiplies it. You now own a giant, brittle suite that drifts out of sync faster than any team can maintain, and it hands you false confidence on top.

Generating tests at scale is not the solution. It is the problem wearing a lab coat.

The high-value use of agents here is narrow and unglamorous: maintenance and triage. A well-scoped agent reads a failed Playwright trace, the screenshot, and a DOM diff, then decides whether the failure is DOM drift or a real behavioral regression. If it is drift, the agent heals the locator or proposes a stable hook and re-verifies. If it is a real regression, it opens a triaged ticket for a human and never auto-closes it. A second agent can run guided exploration after each injection update, surfacing what visibly changed rather than asserting a fixed script.

Drift-gets-healed-automatically
The loop that reduces maintenance. Drift gets healed automatically. Regressions get a human, always.

Build it or buy it

The market gives you both paths. On the buy side, Applitools Autonomous now offers natural language authoring and autonomous test creation and analysis, though even Applitools frames autonomous testing as real but still early in adoption, so it is not something to bet an entire suite on yet. Elsewhere, tools such as Katalon lead with self-healing locators, Testim and Mabl focus on maintenance reduction, and newer agentic runners like KaneAI and Autify Aximo read a curated plan and drive the browser directly. Enterprise pricing for the established platforms typically lands in a custom range from roughly ten to fifty thousand dollars a year depending on volume and browser matrix.

On the build side, if this workflow is core to how your team ships, renting someone else’s harness for it is a strange choice. A thin triage and heal agent built on Playwright MCP and the Claude Agent SDK keeps the reliability discipline as your own intellectual property, fits cleanly onto the Playwright suite you already run, and can be repointed at the next portal without a new license. Rent the visual layer, seriously trial self-healing, and own the agent.

Rule of thumb
Buy the commodity layers. Build only the pieces that encode your team’s judgment. An agent that knows how your portal drifts, and how your reviewers triage, is worth owning. A generic visual diff engine is not worth rebuilding.

What a compliant, testable Epic portal looks like

Pulling it together, a portal that a team can actually keep green over time tends to share a few traits. Stable test hooks are injected at the source, so selectors survive DOM churn. Playwright drives interaction with user-facing locators and traces every run. Applitools guards the visual surface, with cross-origin frames explicitly accounted for. A narrow agent handles drift and triage, and a human owns every real regression. And underneath all of it, test data is synthetic, PHI never leaks into a test environment it should not, and every run leaves an audit trail that a regulator would recognize.

None of these layers is exotic on its own. The engineering is in wiring them so each one covers a seam the others cannot, and in resisting the urge to let an AI paper over a problem you could have eliminated at the source.

Frequently Asked Questions (FAQs)

Why are Epic customer portals so hard to test with automation? +

They embed features in iframes, often cross origin, and many customizations inject JavaScript that rewrites the DOM at runtime. Selectors break on every render, content loads asynchronously, and authentication plus compliance controls guard each path. Classic record and replay tooling flakes badly under those conditions.

Is Applitools the best tool for testing an Epic portal? +

Applitools is best in class for visual validation, but it is a validation layer rather than a browser driver, so it complements Playwright instead of replacing it. Use Playwright to drive the browser, Applitools Eyes to catch visual regressions, and Applitools Execution Cloud or an agent layer to heal unstable locators.

Should I use AI agents to generate my Epic portal tests? +

Generating tests at scale usually multiplies maintenance against a moving DOM. The higher value use of agents is triage and self healing of existing tests, plus guided exploration, rather than bulk generation.

How do you test content inside a cross origin iframe? +

Playwright can navigate and interact with cross origin frames through frame locators, but no tool bypasses the same origin policy for reading a frame’s internals. Visual capture can go blind inside a cross origin frame, so confirm which frames are same origin before assuming full coverage.

Amanda Jones

Amanda Jones is the Chief Technology Officer at Bitcot, leading the company’s technology vision and innovation strategy. With over 10+ years of experience in software development, AI, and automation, she specializes in building scalable, high-performance solutions. She has a strong track record of guiding engineering teams and delivering impactful products that help businesses grow, optimize operations, and remain competitive in an evolving digital landscape. Visit Amanda Jones on LinkedIn