Repository navigation
ux ui developers
title: "Cypress UX/UI Guide for Developers" type: guide domain: testing framework: cypress tags: [cypress, design-tokens, taxonomy, severity, ux, ui, carbon] created: 2026-07-14
Internal implementation of the UI/UX quality check system.
The system uses:
-
Custom commands in
cypress/cypress/support/commands.ts -
Token lookups in
cypress/cypress/support/helpers/tokens.helpers.ts -
Validation helpers in
designTokens.helpers.tsanduxui.helpers.ts -
Cypress tasks in
cypress.config.tsfor aggregation - JSON reports written after each run
Commands registered in commands.ts:
| Command | Subject | Description |
|---|---|---|
validateStyle(token, property) |
element | Check one CSS property against a token |
validateTokenStyle(token) |
element | Check all properties from a token |
validateContrast(level) |
element | Check contrast ratio against WCAG level |
validateTypography(token) |
element | Check font properties against a typography token |
shouldHaveStyle(property, expected) |
element | Legacy: check computed CSS property |
All commands follow the same flow: cy.window() → cy.wrap() → getComputedStyle → valuesMatch → createTaskRecord → cy.task("uiux:record") → expect.
Maps CSS properties to categories. Full map from tokens.helpers.ts:
const UX_TAXONOMY_MAP = {
// Typography
"font-size": "typography",
"font-weight": "typography",
"line-height": "typography",
"letter-spacing": "typography",
"font-family": "typography",
// Color
"color": "color",
"background-color": "color",
// Border
"border-color": "border",
"border-width": "border",
"border-radius": "border",
// Spacing
"padding": "spacing", "padding-top": "spacing", "padding-right": "spacing",
"padding-bottom": "spacing", "padding-left": "spacing",
"margin": "spacing", "margin-top": "spacing", "margin-right": "spacing",
"margin-bottom": "spacing", "margin-left": "spacing",
// Layout
"width": "layout", "height": "layout",
"min-width": "layout", "min-height": "layout",
"max-width": "layout", "max-height": "layout",
// Special
"spacing": "spacing",
"alignment": "alignment",
"contrast": "contrast"
};
const getTaxonomy = (property) =>
UX_TAXONOMY_MAP[property] || "style";const UX_SEVERITY_MAP = {
"color": "critical",
"contrast": "critical",
"typography": "major",
"spacing": "minor",
"border": "minor",
"layout": "minor",
"alignment": "minor",
"token-missing": "major",
"style-mismatch": "major",
"style-check": "info"
};
const getSeverity = (taxonomy, event) => {
if (event === "check") return "info";
return UX_SEVERITY_MAP[taxonomy] || "major";
};createTaskRecord standardizes all records:
{
event: "check" | "violation",
type: "style-check" | "style-mismatch" | "token-missing" | ...,
taxonomy: "typography" | "color" | ...,
actual: "14px",
element: "button",
scenario: "User logs in",
feature: "login.feature",
timestamp: Date.now()
}getTokenDefinition resolves tokens via CSS custom properties:
- Try
--cds-{token}-{property}(property-specific) - Fall back to
--cds-{token}(base token)
valuesMatch handles:
- Color normalization (hex, rgb, hsl, named colors)
- px/rem/em conversion with tolerance (0.5px default)
- Floating-point comparison
-
cy.task("uiux:record")pushes touiuxResultsarray in Node -
before:runclears stale files -
after:runwritesreports/uiux/uiux-results.json -
scripts/modules/uiuxModule.jsreads JSON and produces markdown tables
| File | Purpose |
|---|---|
support/commands.ts |
Command registration |
support/helpers/tokens.helpers.ts |
Token resolution, color math, taxonomy, severity |
support/helpers/designTokens.helpers.ts |
validateStyle, validateTokenStyle, validateContrast, validateTypography
|
support/helpers/uxui.helpers.ts |
shouldHaveStyle (legacy) |
support/helpers/elements.helpers.ts |
Element resolution by type and text |
support/step_definitions/steps/uiux.steps.ts |
Gherkin steps for UI/UX checks |
support/step_definitions/steps/designTokens.steps.ts |
Gherkin steps for design tokens |
cypress.config.ts |
Task definitions, report writing |
scripts/modules/uiuxModule.js |
Markdown report generation |
This wiki documents NR Waste Plus for users and developers. Verify security and deployment guidance against the current application configuration before applying it elsewhere.
- Report an issue or ask a question in the GitHub repository.
- Follow the Contributing Guidelines to propose an update.
- Read the Code of Conduct.
Collection indexes support human browsing and machine retrieval. Keep both current when adding or moving wiki pages.
NR Waste Plus Wiki | GitHub Repository