Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

The UI Said 'Saved.' Did the Audit Log Agree?

Описание и применение

Тестовый рецепт Cypress проверяет, что UI, API и события аудита подтверждают изменение роли пользователя, избегая гонок и конфликтов данных.

Задача

A UI success toast does not guarantee that the backend persisted data, emitted audit events, or queued notifications.

Результат

The recipe demonstrates how to assert UI feedback, API persistence, and audit events, avoiding race conditions with bounded polling and correlation IDs.

Рабочий процесс

  • Create a test user via HTTP POST
  • Visit the admin user page
  • Select a new role and click "Save changes"
  • Assert the UI toast contains "Saved"
  • Request the user API and assert the role is "editor"
  • Poll the audit‑events endpoint for a "role.changed" event using bounded retries
  • Assert the event contains the correct from/to values

Доказательства

The green <strong>Saved</strong> toast answers one narrow question: did the React application render a success message?

Источник

For consequential workflows, test three postconditions: Browser – The user saw the expected state; API – The durable record contains the change; Side‑effect sink – The expected asynchronous event appeared

Источник

Use bounded polling: function waitForEvent(subjectId, action, attemptsLeft = 8, ... )

Источник

  • Дата записи: 2026-10-10T16:40:58.429Z