July 23, 2026
Testing Dark Mode and Saved UI Preferences with Endtest
A practical review of Endtest for dark mode testing, theme switching testing, persisted preferences, and visual regression checks without overfitting to screenshots alone.
Dark mode looks simple until you test it. A toggle changes CSS classes, but the real risk sits elsewhere: persistence across reloads, server-rendered defaults, hydration mismatches, cross-tab state, OS-level theme detection, and visual differences that are meaningful in one viewport and harmless in another. That is where a tool like Endtest for dark mode testing becomes interesting, because the value is not just in clicking a switch, it is in validating the full user journey around theme switching and saved preferences.
For teams working on product UI, dark mode and theme switching testing often exposes a broader class of failures than people expect. A preference can be stored in localStorage, a cookie, IndexedDB, or a backend profile setting. The app may apply the theme immediately in the browser, then re-render differently after a navigation, a hard refresh, or a new session. If the test suite only checks whether the toggle was clicked, it misses the more important question, did the application preserve the user’s choice in realistic conditions?
This review looks at Endtest as a practical option for teams that want to validate preference persistence and UI-state changes without overfitting to screenshots alone. The short version is that Endtest is a credible fit when you want low-code, editable, human-readable test steps, plus visual AI support for catching meaningful UI regressions. It is not a replacement for every kind of assertion, and it should not be treated as a magic screenshot oracle. It is useful because it sits in the middle ground, where many UI failures actually live.
What theme switching testing really needs to prove
When teams say they want to test dark mode, they often mean several different things:
- The toggle changes the visible theme immediately.
- The selection persists after reload.
- The selection survives a full browser restart or a new session.
- The app respects system color scheme when the user has not overridden it.
- Pages and components remain usable in both light and dark themes.
- No regressions appear in layout, contrast, iconography, or focus states.
That list matters because each item exercises a different part of the stack. A frontend-only test can confirm a CSS class changes. A browser automation test can verify that the class persists after refresh. A visual regression check can show whether a modal, toast, or navigation bar became unreadable in dark mode. A good strategy uses all three layers in proportion to risk.
The practical mistake is to test the toggle as if it were just a button. In reality, it is a contract between UI state, storage, rendering, and user expectations.
That is why a tool evaluation should ask whether it can handle realistic browser sessions, not just isolated DOM state. For persisted preferences, state is the actual product. The toggle itself is only the entry point.
Where Endtest fits in that workflow
Endtest is an agentic AI [Test automation](https://en.wikipedia.org/wiki/Test_automation) platform with low-code and no-code workflows. For teams testing theme switching, that matters because the maintenance burden is usually not in creating the first test, it is in keeping the test understandable after the UI evolves. Endtest’s AI Test Creation Agent generates standard, editable Endtest steps inside the platform, which is a useful property when several people need to review, debug, and update the test later.
For dark mode testing, that human-readable structure is a real advantage. A test that says, in effect, “click theme toggle, reload page, verify persisted theme, compare visible UI state” is easier to inspect than a long chain of generated framework code. That does not make code-based automation bad, but it does change the maintenance conversation. If your core problem is checking preference persistence across multiple pages and browsers, readable platform-native steps can reduce ownership concentration and make triage faster.
Endtest also brings Visual AI into the discussion. According to its product and docs, Visual AI is designed to compare the current state of an application to previous baselines and detect meaningful visual changes, while also allowing teams to limit checks to specific page regions or use AI assertions to confirm the presence of a visual element without requiring a baseline. That is relevant because dark mode produces a common visual testing trap, where teams either ignore the UI entirely or create brittle screenshot checks that fail on harmless differences.
Why screenshot-only validation is too fragile
Many teams start theme testing with screenshot comparisons and then get annoyed when font rendering, anti-aliasing, browser differences, or dynamic content create noise. That frustration is understandable. The failure mode is not screenshot testing itself, it is using screenshots as a substitute for intent.
For theme switching, a better model is to divide checks into three layers:
- Functional state checks, such as confirming the theme preference is stored and reapplied.
- Behavioral checks, such as verifying components render correctly after navigation or reload.
- Visual regression checks, such as detecting a broken contrast pattern, clipped component, or unreadable label.
Endtest’s Visual AI is valuable because it aligns with layer three without forcing you to depend entirely on pixel-perfect snapshots. The docs describe intelligent comparison and meaningful visual changes, which is the kind of capability teams usually want when content is dynamic or when only part of the page should be considered stable.
A practical dark mode test should therefore not ask, “Did this screenshot match exactly?” It should ask, “Did the UI preserve the selected preference, render the right state after persistence, and avoid regressions in the visible areas that matter?”
A realistic evaluation criterion for Endtest
When reviewing any tool for theme switching testing, I would use the following criteria:
1. Can it exercise a real browser session end to end?
Theme behavior is often dependent on page load timing, stored preferences, and hydration. You need to click a toggle, reload, revisit a different route, and check the result in the same browser context. Endtest is a good fit if the workflow can run those steps without forcing you into custom glue code for basic navigation.
2. Can it verify persistence without overfitting to implementation details?
A test should validate the behavior, not the storage mechanism. The implementation might use localStorage today and a cookie tomorrow. A well-designed test still passes if the user experience is the same. Human-readable steps help here because the test intent stays legible even when the internal storage strategy changes.
3. Can it reduce visual noise without hiding important problems?
This is where Visual AI matters. A theme switch can change many pixels by design, so the tool must allow scoped checks, baselines, or region-aware comparison. Otherwise, every legitimate dark mode update becomes a false positive.
4. Can non-authors review the test later?
If a QA engineer, frontend engineer, or engineering manager cannot understand the test without asking the original author, the long-term cost goes up. Editable platform-native steps are a practical advantage when multiple people own the suite.
5. Can it handle the awkward edges?
The awkward edges are where real bugs appear, things like cross-tab synchronization, persisted defaults after logout, theme choice conflicting with OS setting, and components that only break in one theme. A useful tool should not force you to choose between brittle visual checks and weak functional checks.
A good test structure for persisted preferences
The most useful dark mode test is usually a short scenario that combines functional state and visual validation. A typical flow might look like this:
- Open the app in a clean browser session.
- Confirm the default theme state.
- Switch to dark mode.
- Verify the UI updates immediately.
- Reload the page.
- Verify the theme remains dark.
- Navigate to a second page or route.
- Verify the theme remains dark there too.
- Optionally open a new session or incognito context and verify the expected default behavior.
That last step is important because not all persistence is supposed to survive every context. If the product chooses to respect an explicit user preference, the test should verify that. If the app falls back to system preference when no user setting exists, the test should define that precondition clearly.
A browser automation tool like Endtest is valuable when it can keep this scenario compact and understandable. If the suite becomes a maze of selectors and callbacks, the maintenance cost rises quickly. The test should read like a user story, not an internal implementation dump.
Example of a practical assertion strategy
For a theme toggle test, it is a mistake to assert only on a visual result or only on a CSS class. A better pattern is to combine both, depending on what the app exposes.
A frontend team might check a state attribute such as data-theme="dark", plus verify a visible label or icon changed. Then use a visual check for the surrounding chrome, where regressions often happen.
Here is a minimal Playwright example that illustrates the sort of behavior a tool should cover, even if you would not write it this way inside Endtest itself:
import { test, expect } from '@playwright/test';
test('persists dark theme after reload', async ({ page }) => {
await page.goto('https://example.com');
await page.getByRole('button', { name: /theme/i }).click();
await expect(page.locator('html')).toHaveAttribute('data-theme', 'dark');
await page.reload();
await expect(page.locator('html')).toHaveAttribute('data-theme', 'dark');
});
That test shows the behavioral intent clearly. The point of a platform like Endtest is not that it must mimic this line for line, but that it should support the same scenario in a form that is easier to maintain for broader teams.
Why visual AI matters for dark mode, but only in the right place
Dark mode creates two kinds of visual changes, expected changes and accidental changes. Expected changes include background color, typography contrast, borders, shadows, and icon treatment. Accidental changes include clipped text, invisible labels, broken focus rings, low-contrast controls, and components that no longer align.
Endtest’s Visual AI is compelling here because its documentation describes comparing the current state against prior baselines and flagging meaningful visual changes only. That is exactly the kind of capability teams need when they want to avoid drowning in false positives.
The key is to scope it intelligently. For example:
- Use visual checks on stable shell areas, such as navigation, dialogs, and settings panes.
- Avoid full-page baselines when large sections contain dynamic content.
- Restrict checks to the theme-sensitive regions that matter for user trust.
- Pair visual checks with functional assertions so you know whether a failure is logical or cosmetic.
A common failure mode is to rely on baselines alone and assume a match means correctness. A match only means the page looks like the baseline. If the baseline already captured a bug, the test will happily preserve it. That is why a good theme test still needs a behavior assertion, even when visual AI is available.
Comparing Endtest with hand-written automation
Custom Playwright, Selenium, or Cypress code can absolutely test theme switching well. The question is not whether code can do it, but what the long-term ownership model looks like.
Hand-written automation gives you full control over selectors, storage inspection, cross-tab behavior, and CI integration. It can be ideal when your app has very custom state flows, or when the test needs tight coupling with backend setup. But the tradeoff is maintenance. Theme tests are deceptively simple, so teams often underinvest in abstractions until the suite becomes hard to read and expensive to repair.
Endtest’s advantage is that it keeps the test intent visible. That matters when:
- QA owns the scenario but frontend engineers need to review it.
- The team wants shared ownership without deep framework knowledge.
- The suite includes many stateful UI flows, not just theme toggles.
- Visual regression checks must be understandable by non-specialists.
If the point of automation is to preserve judgment rather than hide it, human-readable steps are often easier to sustain than code-generated complexity.
That said, Endtest will not erase every hard problem. If your app has highly custom authentication, unusual storage rules, or multiple layers of theme inheritance, you still need to design the test carefully. Tooling helps, but it does not substitute for test thinking.
Failure modes to watch for in theme switching tests
These are the bugs that commonly slip past shallow checks:
Storage mismatch
A user changes theme, the UI updates, but reload resets to the default because the preference is written to one place and read from another.
Route-level inconsistency
The home page respects the theme, but a nested route or lazy-loaded component uses a stale default.
Hydration flicker
Server-rendered markup loads in light mode, then flips to dark mode after hydration. A screenshot test may pass if it samples too late, but the user still sees a flash.
Cross-tab desynchronization
One tab changes the theme, another tab stays stale because storage events are not handled.
Accessibility regressions
A theme toggle works visually, but focus indication or contrast becomes poor in one mode.
Overbroad visual baselines
A dynamic widget changes by design, and the visual comparison turns noisy. The test becomes easy to ignore.
Endtest is attractive when you want to catch these issues without hand-writing a complicated framework around them. Its balance of editable steps and visual AI is especially useful for teams that want their tests to stay understandable during triage.
How to set up a sane review process
A theme-switching suite should not be owned by one person. The review process should make it easy to ask three questions about each test:
- What user behavior is this validating?
- What is the precondition for the persisted preference?
- Which visible areas are supposed to stay stable across theme changes?
If the answer to those questions is clear, the test is probably useful. If the test depends on obscure selectors, arbitrary sleeps, or a giant screenshot diff, it probably needs refinement.
In CI, the best practice is to keep the scenario short and deterministic. If you can isolate a preference-specific browser profile, do that. If your app depends on cookies or local storage, make the setup explicit. If a page has dynamic content, narrow the visual scope so a legitimate data update does not mask a theme failure.
For teams already using continuous integration, the general purpose remains the same as described in continuous integration, namely, to surface regressions frequently enough that they stay cheap to fix. Theme testing benefits from that rhythm because UI-state regressions are easiest to diagnose near the change that introduced them.
When Endtest is a strong fit
Endtest is a strong fit when your team wants to test preference persistence, route-to-route consistency, and visual correctness in a readable way. It is especially appealing if you need:
- Low-code authoring with editable steps.
- A shared format that QA and engineering can both inspect.
- Visual AI support for meaningful UI regression checks.
- Better coverage of dynamic UI states without writing a large custom framework.
The platform is not just a screenshot checker, and that distinction matters. For dark mode testing, the useful part is the combination of browser interaction, persistence verification, and scoped visual validation.
If you want to explore the feature surface further, the official Endtest pages on Visual AI and the Visual AI documentation are the right starting points, because they show how the platform frames comparison, baselines, and AI-assisted visual checks.
Final take
For teams evaluating Endtest for dark mode testing, the most important question is not whether it can click a toggle. It is whether it can help you validate the entire preference lifecycle in a way that stays reviewable and maintainable. On that criterion, Endtest looks practical and credible.
Its strongest advantage is not just visual AI, but the combination of visual AI with editable, human-readable test steps. That makes it easier to test the real problem, persisted preferences across realistic browser sessions, while still catching the UI regressions that matter to users.
If your current suite over-relies on screenshots, or if your hand-written theme tests are getting too brittle to own comfortably, Endtest is worth serious evaluation. It gives QA teams, frontend engineers, and automation groups a cleaner way to cover theme switching without collapsing the whole problem into a pile of brittle assertions.