fix e2e pagination assumptions#639
Conversation
📝 WalkthroughWalkthroughE2E tests across base, calendar, and task modules are refactored to use new pagination-aware helper functions for resource lookup instead of executing CLI commands inline. Three new helpers ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/cli_e2e/task/helpers_test.go (1)
71-111: Helper looks solid; pagination & loop detection mirrorfindCalendarByID.Non-empty guards,
seenPageTokensloop detection, and thehasMore || pageToken == ""termination are all consistent with the calendar helper. UsingAssertStdoutStatus(t, 0)for a list response matches the pattern used elsewhere intasklist_workflow_test.go(line 87).One optional nit:
findBaseTableByID,findCalendarByID, andfindTaskInTasklistnow share ~90% of the pagination/loop-detection structure across three packages. If this pattern grows further, consider extracting a small generic helper (e.g., intests/cli_e2e) that takes the command args, item JSON path, and match predicate, so future pagination fixes only need to land in one place. Safe to defer.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/cli_e2e/task/helpers_test.go` around lines 71 - 111, Extract the duplicated pagination + loop-detection logic used in findBaseTableByID, findCalendarByID, and findTaskInTasklist into a shared helper in tests/cli_e2e (e.g., PaginatedFind or RunPaginatedLookup) that accepts the context, command args, base params (page_size etc.), the gjson path to select items, and a predicate (or target GUID) to detect a match; then rewrite findBaseTableByID, findCalendarByID, and findTaskInTasklist to call this helper passing their specific Args and JSON path, preserving the seenPageTokens loop-detection, has_more/page_token handling, and existing assertions (AssertExitCode/AssertStdoutStatus) so behavior remains identical.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/cli_e2e/base/helpers_test.go`:
- Around line 173-207: The test uses a hardcoded "--limit", causing mismatch
with the pageLimit constant; update the args construction in the loop where
clie2e.RunCmd is called (the args slice containing "--limit", "50") to use
strconv.Itoa(pageLimit) instead of the literal "50" so the pagination check
using pageLimit and the len(tables) < pageLimit heuristic remain consistent with
offset and seenOffsets logic.
---
Nitpick comments:
In `@tests/cli_e2e/task/helpers_test.go`:
- Around line 71-111: Extract the duplicated pagination + loop-detection logic
used in findBaseTableByID, findCalendarByID, and findTaskInTasklist into a
shared helper in tests/cli_e2e (e.g., PaginatedFind or RunPaginatedLookup) that
accepts the context, command args, base params (page_size etc.), the gjson path
to select items, and a predicate (or target GUID) to detect a match; then
rewrite findBaseTableByID, findCalendarByID, and findTaskInTasklist to call this
helper passing their specific Args and JSON path, preserving the seenPageTokens
loop-detection, has_more/page_token handling, and existing assertions
(AssertExitCode/AssertStdoutStatus) so behavior remains identical.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 60ee8331-b5b9-49cc-bce9-047a4351836e
📒 Files selected for processing (7)
tests/cli_e2e/base/base_basic_workflow_test.gotests/cli_e2e/base/helpers_test.gotests/cli_e2e/calendar/calendar_manage_calendar_test.gotests/cli_e2e/calendar/helpers_test.gotests/cli_e2e/task/helpers_test.gotests/cli_e2e/task/tasklist_add_task_workflow_test.gotests/cli_e2e/task/tasklist_workflow_test.go
77a1be9 to
b522390
Compare
b522390 to
b5251a9
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #639 +/- ##
==========================================
+ Coverage 60.66% 61.08% +0.42%
==========================================
Files 416 428 +12
Lines 43989 45190 +1201
==========================================
+ Hits 26686 27605 +919
- Misses 15233 15474 +241
- Partials 2070 2111 +41 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@b5251a94e74fc59235e2f851eb27411970fbe9ca🧩 Skill updatenpx skills add yxzhaao/cli#fix/fix-e2e-pagination -y -g |
Summary
Changes
Test Plan
lark xxxcommand works as expectedRelated Issues
Summary by CodeRabbit
Tests
Refactor