feat(e2e): add KeyValueField tests#36428
Conversation
|
Claude finished @nicobytes's task in 1m 7s —— View job Rollback-Safety Analysis
Verdict: ✅ Safe to rollback — no unsafe category matched. Summary of changes reviewed:
No Label |
🤖 dotBot Review (Bedrock)Reviewed 11 file(s); 10 candidate(s) → 7 confirmed, 0 uncertain (unverified, kept for review). Confirmed findings
us.deepseek.r1-v1:0 · Run: #28688770029 · tokens: in: 74072 · out: 22387 · total: 96459 · calls: 29 · est. ~$0.221 |
|
|
||
| const field = new KeyValueField(page, KEY_VALUE_FIELD_VARIABLE); | ||
| await field.addEntry('keepKey', 'keepValue'); | ||
| await field.addEntry('removeKey', 'removeValue'); |
There was a problem hiding this comment.
🔴 [Critical] Test deletes wrong entry index (index 0 instead of 1) in delete test case
The test case 'should delete an entry' in key-value-field.spec.ts incorrectly clicks the first delete button (index 0) after adding two entries, rather than targeting the second entry (index 1). This creates a false positive where the test would pass even if the deletion logic fails to remove the correct entry, leaving critical functionality untested.
| @@ -169,7 +169,7 @@ export const getFinalCastedValue = ( | |||
| value: object | string | number | undefined, | |||
| field: DotCMSContentTypeField | |||
There was a problem hiding this comment.
🔴 [Critical] Incorrect field type in CALENDAR_FIELD_TYPES
The CALENDAR_FIELD_TYPES array incorrectly includes 'calendar' type instead of dotCMS's actual date field types ('date'/'date-time'). This prevents proper timestamp parsing for date fields, leading to data corruption as date values won't be converted to numeric timestamps.
This pull request introduces robust end-to-end tests for the key-value field, fixes a bug where string and array values could be incorrectly split into individual characters/entries, and refines the handling of date fields to consistently parse and store timestamps. The changes improve reliability for both the key-value and date/calendar field types, with new helper utilities and comprehensive regression tests.
Key-value field improvements:
key-value-field.spec.ts,key-value-field.ts) [1] [2]key-value-field.component.ts,dot-edit-content-key-value.component.spec.ts) [1] [2]AGENTS.md)Date/calendar field handling:
parseCalendarTimestamputility, ensuring that numeric timestamps, ISO strings, and formatted date strings are consistently parsed, and empty values returnnull. (dot-edit-content-form-resolutions.ts,functions.util.ts, and related tests) [1] [2] [3] [4] [5]calendar-field.component.ts)These changes collectively harden key-value and date field behavior and significantly expand test coverage to prevent regressions.
This PR fixes: #36318