How to Test Dark Mode on Web (Complete Guide)

Dark mode, also known as night mode, has become a standard feature in many web applications, allowing users to switch to a darker color scheme to reduce eye strain and improve readability in low-light

May 01, 2026 · 3 min read · How-To Guides

Introduction to Dark Mode Testing

Dark mode, also known as night mode, has become a standard feature in many web applications, allowing users to switch to a darker color scheme to reduce eye strain and improve readability in low-light environments. However, testing dark mode can be challenging, as it requires verifying that the application's functionality and usability are not affected by the change in color scheme. In this guide, we will cover the importance of dark mode testing, specific test cases, manual and automated testing approaches, and how SUSA tests dark mode autonomously.

Why Dark Mode Testing Matters

Dark mode testing matters because it can significantly impact the user experience. If not tested properly, dark mode can lead to issues such as:

These issues can lead to user frustration, decreased engagement, and ultimately, a negative impact on the application's reputation.

What to Test

Here are some specific test cases to consider when testing dark mode:

+ Verify that the dark mode toggle switch is visible and functional

+ Check that the application's layout and design adapt correctly to dark mode

+ Test that all interactive elements, such as buttons and forms, are accessible and usable in dark mode

+ Verify that images and graphics are properly displayed in dark mode

+ Test that error messages and alerts are properly displayed in dark mode

+ Verify that error handling mechanisms, such as error pages and exception handling, work correctly in dark mode

+ Check that dark mode does not introduce any new errors or exceptions

+ Test dark mode with different screen resolutions and orientations

+ Verify that dark mode works correctly with different browser types and versions

+ Check that dark mode is properly supported in different operating systems and devices

+ Verify that dark mode does not introduce any accessibility issues, such as insufficient color contrast or missing alternative text for images

+ Test that screen readers and other assistive technologies work correctly in dark mode

+ Check that dark mode does not interfere with keyboard navigation or other accessibility features

Manual Testing Approach

To manually test dark mode, follow these steps:

  1. Enable dark mode: Toggle the dark mode switch or use the browser's built-in dark mode feature.
  2. Verify layout and design: Check that the application's layout and design adapt correctly to dark mode.
  3. Test interactive elements: Verify that all interactive elements, such as buttons and forms, are accessible and usable in dark mode.
  4. Check images and graphics: Verify that images and graphics are properly displayed in dark mode.
  5. Test error scenarios: Test that error messages and alerts are properly displayed in dark mode.
  6. Verify accessibility: Check that dark mode does not introduce any accessibility issues.

Automated Testing Approach

To automate dark mode testing, you can use tools such as Selenium or Cypress. Here is an example of how to use Selenium to test dark mode:


const { By, until } = require('selenium-webdriver');

// Enable dark mode
driver.findElement(By.css('.dark-mode-toggle')).click();

// Verify layout and design
driver.findElement(By.css('.header')).getText().then(text => {
  console.log(text);
});

// Test interactive elements
driver.findElement(By.css('.button')).click().then(() => {
  driver.findElement(By.css('.form')).getText().then(text => {
    console.log(text);
  });
});

// Check images and graphics
driver.findElement(By.css('.image')).getAttribute('src').then(src => {
  console.log(src);
});

You can also use frameworks such as Playwright to automate dark mode testing. Here is an example of how to use Playwright to test dark mode:


const { test, expect } = require('@playwright/test');

test('dark mode', async ({ page }) => {
  // Enable dark mode
  await page.click('.dark-mode-toggle');

  // Verify layout and design
  await expect(page.locator('.header')).toContainText('Header Text');

  // Test interactive elements
  await page.click('.button');
  await expect(page.locator('.form')).toContainText('Form Text');

  // Check images and graphics
  await expect(page.locator('.image')).toHaveAttribute('src', 'image-src');
});

How SUSA Tests Dark Mode Autonomously

SUSA tests dark mode autonomously using its built-in personas, including the accessibility persona, which checks for accessibility issues, and the power user persona, which tests the application's functionality and usability. SUSA also uses its cross-session learning feature to get smarter about the application every run, allowing it to detect issues that may not be immediately apparent.

The accessibility persona checks for issues such as:

The power user persona tests the application's functionality and usability, including:

By using SUSA to test dark mode autonomously, you can ensure that your application is thoroughly tested and provides a good user experience, even in dark mode.

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free