dify icon indicating copy to clipboard operation
dify copied to clipboard

test: enhance workflow-log component tests with comprehensive coverage

Open lyzno1 opened this issue 2 months ago • 1 comments

Summary

Refactor and enhance test coverage for web/app/components/app/workflow-log/ components by splitting into focused test files.

Changes

Split monolithic index.spec.tsx into focused test files:

File Purpose Key Tests
detail.spec.tsx DetailPanel component URL generation, replay button, close action
filter.spec.tsx Filter component Status/period/keyword filtering, clear actions
list.spec.tsx WorkflowAppLogList Sorting, drawer, replay, status display, unread indicator
trigger-by-display.spec.tsx TriggerByDisplay All trigger types, plugin metadata, theme switching
index.spec.tsx Logs container SWR integration, filter/pagination

Coverage Results

 app/components/app/workflow-log               |     100 |    97.02 |   94.73 |     100 |
  detail.tsx                                   |     100 |      100 |     100 |     100 |
  filter.tsx                                   |     100 |     87.5 |   85.71 |     100 |
  index.tsx                                    |     100 |      100 |     100 |     100 |
  list.tsx                                     |     100 |    95.91 |     100 |     100 |
  trigger-by-display.tsx                       |     100 |      100 |     100 |     100 |

Test Suites: 5 passed, 5 total
Tests:       138 passed, 138 total

Test Plan

  • [x] All 138 tests passing
  • [x] 100% statement coverage
  • [x] 97% branch coverage
  • [x] ESLint and TypeScript checks pass

lyzno1 avatar Dec 13 '25 09:12 lyzno1

Summary of Changes

Hello @lyzno1, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly bolsters the testing infrastructure for the web/app/components/app/workflow-log/ components. It introduces a substantial number of new test cases to improve coverage, validate various filter functionalities, handle edge cases in log display, and ensure correct user interaction and data presentation, ultimately enhancing the reliability and maintainability of the workflow log feature.

Highlights

  • Test Coverage Enhancement: Added 17 new test cases, increasing total passing tests from 64 to 81, and achieving 98.55% coverage for the workflow-log components.
  • Filter Component Tests: Introduced new tests for keyword search clear functionality, various period filter options (e.g., today, last7days, allTime), and all status filter options (e.g., all, succeeded, failed, stopped, partial-succeeded).
  • WorkflowAppLogList Component Tests: Added tests for handling empty logs arrays, large number edge cases (elapsed time, tokens), row highlighting and selection states, read/unread indicator state transitions, and default sort order verification.
  • Logs Container Tests: Included tests for status filter query parameter handling and pagination limit changes within the main Logs component.
  • Testing Approach: The new tests follow an integration testing first approach, utilize the Arrange-Act-Assert (AAA) pattern, cover various edge cases, and validate user interactions.
  • AI-Assisted Development: This pull request, including the comprehensive test enhancements, was generated using Anthropic Claude Skills, specifically the frontend-testing skill.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

[^1]: Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

gemini-code-assist[bot] avatar Dec 13 '25 09:12 gemini-code-assist[bot]