Giter Site home page Giter Site logo

wikimedia / color-contrast-checker Goto Github PK

View Code? Open in Web Editor NEW
0.0 20.0 1.0 175 KB

Automates reporting of color contrast violations for Wikipedia articles.

Home Page: https://night-mode-checker.wmcloud.org/

License: MIT License

JavaScript 95.43% Mustache 4.57%

color-contrast-checker's Introduction

Color Contrast Monitoring for Dark Mode

๐Ÿšจ Work in Progress ๐Ÿšจ

The provided scripts are designed to monitor color contrast issues, specifically for dark mode. The process involves creating test cases based on the top Wikipedia articles and running accessibility tests using pa11y axe-core. The results are logged to the console and a CSV file, capturing color contrast violations.

Scripts

Color Contrast Tester
โ”‚
โ”œโ”€โ”€ index.js
โ”‚
โ”œโ”€โ”€ report/
โ”‚   โ”œโ”€โ”€ index.html
โ”‚   โ””โ”€โ”€ simplifiedList.csv
โ”‚
โ”œโ”€โ”€ modules/
โ”‚   โ”œโ”€โ”€ csvWriter.js
โ”‚   โ”œโ”€โ”€ htmlGenerator.js
โ”‚   โ”œโ”€โ”€ topArticles.js
โ”‚   โ””โ”€โ”€ accessibility.test.js
โ”‚
โ””โ”€โ”€ README.md

Usage

  • Ensure you have the required environment variables set: MW_SERVER, MEDIAWIKI_USER, and MEDIAWIKI_PASSWORD.

  • Run the tests using the following command:

node index.js --project en.wikipedia

Advanced

Run against mobile:

node index.js --project fr.wikipedia --mobile --query "minervanightmode=1"

Run against mobile against 10 random articles with sleep duration of 0s.

node index.js --project fr.wikipedia --mobile --query "minervanightmode=1" --source random -z 0 --limit 10

Run against desktop night theme against 100 random articles.

node index.js --project fr.wikipedia --query "useskin=vector-2022&vectornightmode=1" --source random --limit 100

Important Note

This tool is currently in development and should be used cautiously. Stay tuned for updates and improvements!

color-contrast-checker's People

Contributors

jdlrobson avatar kimsarabia avatar

Watchers

 avatar Santhosh Thottingal avatar Sam Smith avatar Daniel Duvall avatar Tyler Cipriani avatar Jan Drewniak avatar Stephane Bisson avatar Dayllan Maza avatar Giuseppe Lavagetto avatar Andrew Otto avatar will avatar Leszek Manicki avatar Piotr Miazga avatar Amir Sarabadani avatar claime avatar Niharika Kohli avatar Clare Ming avatar Riccardo Coccioli avatar J H avatar  avatar

Forkers

jdlrobson

color-contrast-checker's Issues

Debug memory leaks

Problem

We have a memory leak.

Debugger listening on ws://127.0.0.1:9229/c0e5e61e-5d83-4bfa-87fb-ecec3f42ca02
For help, see: https://nodejs.org/en/docs/inspector
(node:11418) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 exit listeners added to [process]. Use emitter.setMaxListeners() to increase limit
(Use node --trace-warnings ... to show where the warning was created)
(node:11418) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGINT listeners added to [process]. Use emitter.setMaxListeners() to increase limit
(node:11418) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGTERM listeners added to [process]. Use emitter.setMaxListeners() to increase limit
(node:11418) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGHUP listeners added to [process]. Use emitter.setMaxListeners() to increase limit

Possible To-Do's

  • Ensure all await statements properly resolve or reject promises.
  • Verify proper handling of async tasks, especially with Puppeteer interactions.
  • Confirm all resources (e.g., browser instances, pages) are closed and disposed of correctly.
  • Ensure browser.close() is invoked appropriately to close browser instances.
  • Check for added event listeners within page contexts and ensure they're removed when no longer needed.
  • Review usage of page.evaluate() to inject JavaScript code and ensure proper event listener management.
  • Utilize Node.js debugging (?) to profile memory usage.
  • Monitor memory consumption during script execution to identify abnormal patterns.

Enhancement: Add Commands for Accessibility Tests with Configurations

Overview

This issue is to enhance the accessibility testing functionality by adding commands that support specific configurations.

Commands to Add:

  1. Run Accessibility Tests with Default Configuration:

    node runA11yTests.js --config 'a11y.config.js'
  2. Run Accessibility Tests with Dark Mode Configuration:

    node runA11yTests.js --config 'a11y.config.js' --query "?darkmode=1" --output - dir 'a11y-darkmode1'

Success Criteria:

  • Running the first command should execute accessibility tests with the default configuration.
  • Running the second command should execute accessibility tests with a dark mode configuration and save the output in the 'a11y-darkmode1' directory.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.