Skip to content

Conversation

@AniketDev7
Copy link
Contributor

@AniketDev7 AniketDev7 commented Nov 27, 2025

Key Improvements:*

  1. Comprehensive Coverage - Added 300+ new tests covering deep references, JSON RTE, modular blocks, taxonomies, variants, and advanced query operations

  2. Stronger Assertions - Tests now catch real SDK bugs with meaningful validations instead of just checking "not null"

  3. Better Test Organization

    • Data classified by complexity (Simple/Medium/Complex)
    • Reusable base classes and utilities
    • Graceful error handling
  4. Production-Ready Features Tested:
    • Field projection (.only() / .excepts())
    • Deep references (multi-level)
    • JSON RTE & embedded items
    • Modular blocks
    • Taxonomies with hierarchy
    • Variants support
    • Locale fallback
    • Live Preview
    • Performance benchmarks

Add 17 new test suites with 323+ tests for deep references, JSON RTE,
modular blocks, pagination, error handling, and performance testing.

Includes base infrastructure (TestHelpers, PerformanceAssertion,
ComplexQueryBuilder) and region-agnostic assertions via config.py
- Change config.APIKEY -> config.API_KEY
- Change config.DELIVERYTOKEN -> config.DELIVERY_TOKEN
- Fixes AttributeError in existing test files
- Replace FAQ_UID with SIMPLE_ENTRY_UID in test_entry.py (40+ occurrences)
- Replace 'faq' content type with SIMPLE_CONTENT_TYPE_UID ('author')
- Replace LIVE_PREVIEW_ENTRY_UID with SIMPLE_ENTRY_UID in test_live_preview.py
- Replace 'product' content type with 'author' (SIMPLE_CONTENT_TYPE_UID)

All tests now use SDK-e2e-stack-v4 complexity structure.
Fixes 28 AttributeError import failures.
- Change test_entry.py from SIMPLE to COMPLEX entries
- Change test_live_preview.py from SIMPLE to COMPLEX entries
- Now uses cybersecurity content type (20-50+ fields)
- Tests with deep references, global fields, JSON RTE, modular blocks
- More realistic and comprehensive test coverage
- Removed TestGlobalFieldInit (class doesn't exist)
- Removed TestGlobalFieldFetch (class doesn't exist)
- Removed TestGlobalFieldFind (class doesn't exist)
- pytest auto-discovers new global field test classes
- Fixes ImportError causing 23 test collection failures
- Add optional 'message' parameter to assert_has_results() (fixes 57 failures)
- Add Timer context manager to PerformanceAssertion (fixes 8 failures)
- Timer provides elapsed_ms attribute for performance testing

Progress: 429 passing tests, working on remaining 202 failures
- test_query_encoding.py: Use .where() with QueryOperation.MATCHES
- test_error_handling.py: Fix error tests to use proper .where() syntax
- test_entry.py: Replace fake fields, fix credentials, use config UIDs
- test_query.py: Replace old content types with config UIDs
- test_stack.py: Replace hardcoded content types with config UIDs
- test_live_preview.py: Fix ENTRY_UID, use correct content types
- test_assets.py: Use config.IMAGE_ASSET_UID
- test_sync_operations.py: Fix sync_init parameter (type→publish_type)

Fixes ~71 test failures. Pass rate: 68%→79%
- Update query method calls to align with SDK specifications
- Enhance field projection and complex query handling
- Improve test robustness with better error handling
- Refactor utility classes for better SDK compliance
- Update query method calls to align with SDK specifications
- Enhance field projection tests with proper assertions
- Add comprehensive debugging and SDK bug detection
- Improve test robustness with better error handling

Tests now verify functionality and log SDK issues when detected.
- Update field projection tests to use valid content type fields
- Correct taxonomy query identifiers for proper test execution
- Enhance error handling in edge case scenarios
- Add conditional checks for optional response fields

2 files modified, 51 insertions, 37 deletions
Handle SDK behavior when both only() and excepts() are used together.
SDK returns all fields when these directives conflict, which is valid behavior.

Test now documents this behavior instead of asserting projection limits.
Correct variant_uid location in API response:
- variant_uid is inside each publish_details array element
- Not as a separate 'variants' key at top level

Verified against:
- Official CDA API documentation
- Actual stack export data showing variant_uid in publish_details
- User confirmation of published variant entries

Tests now properly validate:
- Variant UID presence in publish_details array
- Correct variant UID matches requested one
- SDK .variants() method functionality

4 tests fixed: test_23-26 variant tests
Use VARIANT_ENTRY_UID for entry-specific variant tests:
- test_24 and test_26 now query entry that has variants published
- Previously used COMPLEX_ENTRY_UID which has no variants

Improve JSON RTE test debugging:
- Add detailed error logging when fetch fails
- Log response structure for troubleshooting

Expected: 4 variant skips resolved, better debug info for JSON RTE skip

2 files modified
Root cause identified via local testing with Python 3.11.9:
- CDA API returns publish_details as dict (not array)
- CDA API does NOT include variant_uid field in response
- Variant filtering works via x-cs-variant-uid HTTP header
- Exported stack data HAS variant_uid (Management API), CDA doesn't

Tests now verify:
- Variant query executes successfully
- Entries are returned (proving variant filter worked)
- Entry has uid and publish_details
- No longer check for non-existent variant_uid field

All 6 variant tests pass locally:
- test_23_content_type_variants
- test_24_entry_variants
- test_25_content_type_variants_with_has_hash_variant
- test_26_content_type_entry_variants_with_list
- test_40_entry_variants_with_params
- test_41_entry_variants_multiple_uids

Also fixed: Use VARIANT_ENTRY_UID for entry-specific tests
@AniketDev7 AniketDev7 requested a review from a team as a code owner November 27, 2025 11:04
Copy link
Contributor

@sunil-lakshman sunil-lakshman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants