Skip to content

Conversation

thephez
Copy link
Collaborator

@thephez thephez commented Aug 6, 2025

Issue being fixed or feature implemented

The WASM SDK UI test suite lacked comprehensive coverage for query execution, particularly for DPNS, voting, epoch, and system queries. Many queries were not being tested with proof verification, and existing tests had insufficient validation.

What was done?

  • Added comprehensive test coverage for DPNS queries including domain resolution and reverse lookups
  • Implemented tests for voting system queries (contested resources, vote polls, vote states)
  • Added epoch and block-related query tests
  • Enhanced test validation to check for specific properties in query results (e.g., ownerId, balance, revision fields)
  • Implemented proof verification for queries that support it
  • Fixed timing issues with instant query execution in UI automation
  • Improved test data fixtures with better test values

How Has This Been Tested?

  • Ran tests (GitHub Action run)
  • Verified all new tests pass with proper validation
  • Confirmed proof verification works for supported queries

Breaking Changes

None

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • New Features

    • Added a required "indexValues" input field for certain voting-related queries and UI, allowing users to specify index values as a JSON array.
  • Enhancements

    • Improved the UI for selecting contested resources by adding a textarea for entering index values.
    • Expanded test data and automated test coverage for a wide range of new queries, including voting, DPNS, token, group, and protocol-related queries.
  • Bug Fixes

    • Improved test robustness to handle instant query executions that may skip loading indicators.
  • Refactor

    • Refactored and streamlined automated query execution tests for better maintainability and coverage.
  • Chores

    • Updated parameter mappings and handling in test utilities to support new query parameters.
    • Added .gitignore entries to exclude test reports and results from version control.

Copy link
Contributor

coderabbitai bot commented Aug 6, 2025

Walkthrough

The changes introduce a new required indexValues array input for specific voting-related queries and UI flows in the WASM SDK. Test data, parameter injection, and test automation utilities are updated to support this new parameter and additional queries. The query execution logic and tests are refactored for improved robustness, coverage, and maintainability.

Changes

Cohort / File(s) Change Summary
Voting Query Input & Execution Update
packages/wasm-sdk/index.html
Added required indexValues array input for voting queries and UI; updated query and state transition execution logic to handle and forward indexValues.
Test Data Expansion
packages/wasm-sdk/test/ui-automation/fixtures/test-data.js
Expanded test data with new queries and parameter sets across system, protocol, epoch, dpns, token, voting, and group categories.
Test Suite Refactor & Expansion
packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
Refactored and expanded tests for query execution: added new validation helpers, parameterized test definitions, and increased coverage for queries and proof support.
Query Execution Robustness
packages/wasm-sdk/test/ui-automation/utils/base-test.js
Improved query execution logic to handle cases where loading state never appears, reducing flakiness for instant queries.
Parameter Injection Mapping
packages/wasm-sdk/test/ui-automation/utils/parameter-injector.js
Added/updated parameter field mappings for new query parameters, including those for DPNS, voting, and group queries.
Dynamic Array Parameter Support
packages/wasm-sdk/test/ui-automation/utils/wasm-sdk-page.js
Added indexValues to dynamic array parameters for special handling in UI automation.
Git Ignore Addition
packages/wasm-sdk/.gitignore
Added .gitignore to exclude playwright-report/ and test-results/ directories from Git tracking.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI (index.html)
    participant SDK
    participant Backend

    User->>UI (index.html): Enter query parameters (including indexValues)
    UI (index.html)->>SDK: executeQuery(queryName, { ...params, indexValues })
    SDK->>Backend: Send query with indexValues
    Backend-->>SDK: Return query result
    SDK-->>UI (index.html): Return result
    UI (index.html)-->>User: Display query result
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Possibly related PRs

Suggested labels

js-sdk

Suggested reviewers

  • QuantumExplorer

Poem

A rabbit hopped through code so wide,
Adding indexValues with pride.
Queries and tests, now robust and neat,
With new arrays, no bug can beat!
UI and backend, hand in paw,
Hop along—review in awe!
🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0dd5ba2 and f25ace4.

📒 Files selected for processing (1)
  • packages/wasm-sdk/.gitignore (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/wasm-sdk/.gitignore
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build JS packages / Build JS
  • GitHub Check: build-wasm-sdk
  • GitHub Check: build-and-test-wasm-sdk
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch automate-ui-testing-part2b

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@thephez thephez marked this pull request as ready for review August 6, 2025 19:24
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
packages/wasm-sdk/index.html (1)

4430-4437: Same serialization issue propagated to get_contested_resource_voters_for_identity

The voters-for-identity helper receives the raw values.indexValues array just like the previous block. Apply the same JSON serialization (or remove it from the state-transition path) after you confirm the correct ABI.

Failure to fix both places will keep the UI non-functional for one of the two query variants.

Also applies to: 4441-4447

🧹 Nitpick comments (1)
packages/wasm-sdk/index.html (1)

1994-1999: Index values field lacks user guidance and format constraints

The newly-added indexValues input is declared as a generic array without any placeholder, help text, or validation hint. Because the acceptable element type (identifier bytes, strings, etc.) is contract-specific, users are left guessing the proper format, which will likely produce malformed queries.

Add at least a short placeholder and/or help attribute illustrating the expected JSON (e.g. ["dash","alice"]) and consider validating that the array is non-empty before execution.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between be080b5 and 0dd5ba2.

📒 Files selected for processing (6)
  • packages/wasm-sdk/index.html (6 hunks)
  • packages/wasm-sdk/test/ui-automation/fixtures/test-data.js (2 hunks)
  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js (9 hunks)
  • packages/wasm-sdk/test/ui-automation/utils/base-test.js (1 hunks)
  • packages/wasm-sdk/test/ui-automation/utils/parameter-injector.js (4 hunks)
  • packages/wasm-sdk/test/ui-automation/utils/wasm-sdk-page.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
packages/wasm-sdk/index.html

📄 CodeRabbit Inference Engine (CLAUDE.md)

Test the WASM SDK using the web interface at 'index.html' in 'packages/wasm-sdk'

Files:

  • packages/wasm-sdk/index.html
packages/wasm-sdk/**/index.html

📄 CodeRabbit Inference Engine (packages/wasm-sdk/CLAUDE.md)

packages/wasm-sdk/**/index.html: When adding new queries or state transitions, update the definitions in index.html.
The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.

Files:

  • packages/wasm-sdk/index.html
🧠 Learnings (22)
📓 Common learnings
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:05.082Z
Learning: Applies to packages/wasm-sdk/index.html : Test the WASM SDK using the web interface at 'index.html' in 'packages/wasm-sdk'
Learnt from: lklimek
PR: dashpay/platform#2318
File: .github/workflows/tests-build-image.yml:45-45
Timestamp: 2024-11-13T10:31:30.891Z
Learning: In the dashpay/platform repository, changes to `.github/workflows/tests-build-image.yml` that switch the Docker image platform from `linux/arm64` to `linux/amd64` for testing purposes are acceptable when required to run on GitHub-hosted runners. ARM64 testing is covered on the testnet.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : When adding new queries or state transitions, update the definitions in index.html.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
Learnt from: QuantumExplorer
PR: dashpay/platform#2711
File: packages/wasm-sdk/AI_REFERENCE.md:771-783
Timestamp: 2025-07-28T20:00:08.502Z
Learning: In packages/wasm-sdk/AI_REFERENCE.md, the documentation correctly shows the actual SDK method signatures (including identityCreate and identityTopUp with their full parameter lists), which may differ from the UI inputs shown in fixed_definitions.json. The UI may collect fewer parameters from users while handling additional requirements internally.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/generate_docs.py : When adding new queries or state transitions, run python3 generate_docs.py to regenerate documentation.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : When implementing WASM SDK functionality, always refer to AI_REFERENCE.md first for accurate method signatures and examples.
Learnt from: shumkov
PR: dashpay/platform#2449
File: packages/rs-sdk/src/platform/tokens/token_status.rs:8-24
Timestamp: 2025-02-14T04:33:23.920Z
Learning: Input validation for query implementations (empty checks, duplicates, size limits) should be implemented consistently across all query types rather than individually.
📚 Learning: applies to packages/wasm-sdk/**/index.html : the wasm sdk now fully supports where and orderby claus...
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/utils/wasm-sdk-page.js
  • packages/wasm-sdk/test/ui-automation/utils/base-test.js
  • packages/wasm-sdk/test/ui-automation/fixtures/test-data.js
  • packages/wasm-sdk/index.html
  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
📚 Learning: applies to packages/wasm-sdk/**/index.html : when adding new queries or state transitions, update th...
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : When adding new queries or state transitions, update the definitions in index.html.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/utils/wasm-sdk-page.js
  • packages/wasm-sdk/test/ui-automation/utils/base-test.js
  • packages/wasm-sdk/test/ui-automation/fixtures/test-data.js
  • packages/wasm-sdk/index.html
  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
📚 Learning: in packages/wasm-sdk/ai_reference.md, the documentation correctly shows the actual sdk method signat...
Learnt from: QuantumExplorer
PR: dashpay/platform#2711
File: packages/wasm-sdk/AI_REFERENCE.md:771-783
Timestamp: 2025-07-28T20:00:08.502Z
Learning: In packages/wasm-sdk/AI_REFERENCE.md, the documentation correctly shows the actual SDK method signatures (including identityCreate and identityTopUp with their full parameter lists), which may differ from the UI inputs shown in fixed_definitions.json. The UI may collect fewer parameters from users while handling additional requirements internally.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/utils/wasm-sdk-page.js
  • packages/wasm-sdk/test/ui-automation/utils/parameter-injector.js
  • packages/wasm-sdk/test/ui-automation/fixtures/test-data.js
  • packages/wasm-sdk/index.html
  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
📚 Learning: applies to packages/wasm-sdk/index.html : test the wasm sdk using the web interface at 'index.html' ...
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:05.082Z
Learning: Applies to packages/wasm-sdk/index.html : Test the WASM SDK using the web interface at 'index.html' in 'packages/wasm-sdk'

Applied to files:

  • packages/wasm-sdk/test/ui-automation/utils/wasm-sdk-page.js
  • packages/wasm-sdk/test/ui-automation/utils/base-test.js
  • packages/wasm-sdk/test/ui-automation/fixtures/test-data.js
  • packages/wasm-sdk/index.html
  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
📚 Learning: applies to packages/wasm-sdk/src/**/*.rs : the wasm sdk now fully supports where and orderby clauses...
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/utils/wasm-sdk-page.js
  • packages/wasm-sdk/test/ui-automation/fixtures/test-data.js
  • packages/wasm-sdk/index.html
  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
📚 Learning: in packages/wasm-sdk/test/ui-automation/run-ui-tests.sh, the script doesn't require cleanup handling...
Learnt from: thephez
PR: dashpay/platform#2715
File: packages/wasm-sdk/test/ui-automation/run-ui-tests.sh:6-286
Timestamp: 2025-07-31T18:15:51.813Z
Learning: In packages/wasm-sdk/test/ui-automation/run-ui-tests.sh, the script doesn't require cleanup handling because it relies on Playwright's built-in webServer configuration to manage the HTTP server lifecycle automatically. The script only runs foreground processes through npm/Playwright commands.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/utils/base-test.js
  • packages/wasm-sdk/test/ui-automation/fixtures/test-data.js
  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
📚 Learning: in packages/wasm-sdk/test/ui-automation/run-ui-tests.sh, the script correctly relies on playwright's...
Learnt from: thephez
PR: dashpay/platform#2715
File: packages/wasm-sdk/test/ui-automation/run-ui-tests.sh:6-286
Timestamp: 2025-07-31T18:15:51.813Z
Learning: In packages/wasm-sdk/test/ui-automation/run-ui-tests.sh, the script correctly relies on Playwright's built-in webServer configuration to manage the HTTP server lifecycle automatically. The script doesn't spawn any background processes and doesn't need cleanup handling because Playwright handles server start/stop automatically before and after test execution.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/utils/base-test.js
📚 Learning: applies to packages/wasm-sdk/**/generate_docs.py : when adding new queries or state transitions, run...
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/generate_docs.py : When adding new queries or state transitions, run python3 generate_docs.py to regenerate documentation.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/utils/base-test.js
  • packages/wasm-sdk/test/ui-automation/fixtures/test-data.js
  • packages/wasm-sdk/index.html
  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
📚 Learning: in `packages/wallet-contract/test/bootstrap.js`, for mocha tests in node.js, async functions like `l...
Learnt from: shumkov
PR: dashpay/platform#2314
File: packages/wallet-contract/test/bootstrap.js:14-16
Timestamp: 2024-11-06T07:27:01.722Z
Learning: In `packages/wallet-contract/test/bootstrap.js`, for Mocha tests in Node.js, async functions like `loadWasmDpp` can be assigned directly to `beforeAll` without wrapping them in another async function.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/utils/base-test.js
  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
📚 Learning: in packages/wasm-sdk/docs.html, quantumexplorer confirmed that placeholder private keys in documenta...
Learnt from: QuantumExplorer
PR: dashpay/platform#2711
File: packages/wasm-sdk/docs.html:2359-2383
Timestamp: 2025-07-28T20:00:24.323Z
Learning: In packages/wasm-sdk/docs.html, QuantumExplorer confirmed that placeholder private keys in documentation examples are acceptable as they are not real keys, though field name accuracy for the SDK API should still be maintained.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/fixtures/test-data.js
  • packages/wasm-sdk/index.html
  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
📚 Learning: in the dash platform, dpns (dash platform name service) contracts have the same id across all networ...
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.586Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/fixtures/test-data.js
📚 Learning: in the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification...
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.

Applied to files:

  • packages/wasm-sdk/index.html
  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
📚 Learning: applies to packages/wasm-sdk/src/**/*.rs : when implementing wasm sdk functionality, always refer to...
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : When implementing WASM SDK functionality, always refer to AI_REFERENCE.md first for accurate method signatures and examples.

Applied to files:

  • packages/wasm-sdk/index.html
  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
📚 Learning: in `packages/dashmate/test/unit/status/scopes/platform.spec.js`, prefer to keep mocks explicitly in ...
Learnt from: shumkov
PR: dashpay/platform#2249
File: packages/dashmate/test/unit/status/scopes/platform.spec.js:77-78
Timestamp: 2024-10-18T15:37:36.387Z
Learning: In `packages/dashmate/test/unit/status/scopes/platform.spec.js`, prefer to keep mocks explicitly in tests to increase readability, rather than refactoring them into shared `beforeEach` blocks or helper functions.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
📚 Learning: in test files for the dashmate project, such as `packages/dashmate/test/unit/status/scopes/platform....
Learnt from: shumkov
PR: dashpay/platform#2249
File: packages/dashmate/test/unit/status/scopes/platform.spec.js:466-467
Timestamp: 2024-10-18T15:37:21.329Z
Learning: In test files for the dashmate project, such as `packages/dashmate/test/unit/status/scopes/platform.spec.js`, prefer to keep mocks explicitly in tests rather than consolidating them, to increase readability.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
📚 Learning: in the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` exte...
Learnt from: lklimek
PR: dashpay/platform#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2024-12-10T10:56:26.215Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
📚 Learning: applies to packages/wasm-sdk/src/**/*.rs : token functions are methods on wasmsdk, not standalone fu...
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : Token functions are methods on WasmSdk, not standalone functions; avoid importing them as standalone.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
📚 Learning: in the rust sdk's `rs-sdk/tests` integration tests (e.g., in `packages/rs-sdk/tests/fetch/config.rs`...
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's `rs-sdk/tests` integration tests (e.g., in `packages/rs-sdk/tests/fetch/config.rs`), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
📚 Learning: in rust test files (`packages/rs-drive/tests/query_tests.rs`), when code is used only in tests, defi...
Learnt from: QuantumExplorer
PR: dashpay/platform#2347
File: packages/rs-drive/tests/query_tests.rs:438-460
Timestamp: 2024-11-25T01:17:02.001Z
Learning: In Rust test files (`packages/rs-drive/tests/query_tests.rs`), when code is used only in tests, defining explicit enums for fields (like the `status` field in the `Withdrawal` struct) may not be necessary; using primitive types is acceptable.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
📚 Learning: use comprehensive test suites at unit, integration, and e2e levels...
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:05.082Z
Learning: Use comprehensive test suites at unit, integration, and e2e levels

Applied to files:

  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
📚 Learning: the get_identity_keys_with_proof_info function in the rust wasm bindings does not support the "searc...
Learnt from: thephez
PR: dashpay/platform#2718
File: packages/wasm-sdk/index.html:0-0
Timestamp: 2025-08-05T13:55:39.147Z
Learning: The get_identity_keys_with_proof_info function in the Rust WASM bindings does not support the "search" key request type and lacks the searchPurposeMap parameter. When proof mode is enabled with keyRequestType === 'search', the implementation falls back to the non-proof version (get_identity_keys) to maintain functionality.

Applied to files:

  • packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Build Docker images (DAPI, dapi, dapi) / Build DAPI image
  • GitHub Check: Build Docker images (Drive, drive, drive-abci) / Build Drive image
  • GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
  • GitHub Check: Build JS packages / Build JS
  • GitHub Check: Rust crates security audit
  • GitHub Check: build-wasm-sdk
  • GitHub Check: build-and-test-wasm-sdk
🔇 Additional comments (20)
packages/wasm-sdk/test/ui-automation/utils/wasm-sdk-page.js (1)

9-10: LGTM! Correctly adds support for indexValues parameter.

The addition of 'indexValues': true to DYNAMIC_ARRAY_PARAMETERS properly configures the UI automation framework to handle the new voting query parameter as a dynamic array input, which aligns with the PR's expansion of WASM SDK voting query testing.

packages/wasm-sdk/test/ui-automation/utils/parameter-injector.js (5)

43-43: LGTM! Improved selector priority for identityId parameter.

The reordering of selectors prioritizes the name-based selector, which is a sensible refinement for better field matching reliability.


65-69: LGTM! Added comprehensive DPNS parameter mappings.

The new mappings for label, name, and prefix parameters properly support DPNS domain resolution and reverse lookup queries mentioned in the PR objectives, with appropriate fallback selectors for robust field detection.


79-80: LGTM! Added query modifier parameter mappings.

The orderAscending and startAfter parameter mappings enhance query flexibility with proper selector fallbacks including checkbox handling for boolean parameters.


93-98: LGTM! Comprehensive voting parameter mappings support expanded functionality.

The new voting parameter mappings for indexValues, allowIncludeLockedAndAbstainingVoteTally, and startAtIdentifierInfo properly support the expanded voting system queries (contested resources, vote polls, vote states) mentioned in the PR objectives. The mappings include appropriate selector fallbacks and handle different input types correctly.


99-107: LGTM! Extensive group parameter mappings added.

The comprehensive set of group parameter mappings (contractId, groupContractPosition, startAtGroupContractPosition, etc.) provides robust support for group-related queries with appropriate selector fallbacks for various input types including checkboxes and selects.

packages/wasm-sdk/test/ui-automation/utils/base-test.js (1)

217-238: Excellent enhancement for handling fast-executing queries!

The improved executeQuery method robustly handles cases where queries execute so quickly that the loading state never appears. The try-catch logic properly:

  1. Attempts to wait for loading state with a reasonable 5-second timeout
  2. Falls back to checking current status if loading state is skipped
  3. Correctly identifies successful/error completions for instant queries
  4. Preserves error handling by re-throwing timeouts for non-final states

This enhancement ensures stable test execution for the expanded query suite, particularly important for the new voting, DPNS, and system queries that may execute very quickly.

packages/wasm-sdk/index.html (1)

4400-4411: Incorrect serialization assumption for indexValues

The get_contested_resource_vote_state_with_proof_info binding is declared as

pub async fn get_contested_resource_vote_state_with_proof_info(,
    index_values: Vec<JsValue>,)

so it expects a JS array of values, not a JSON string. Passing values.indexValues directly is correct. Using JSON.stringify here would send a single string, breaking the Vec<JsValue> signature. There is no equivalent state-transition call that stringifies indexValues—the only JSON serialization in that wrapper is for startAtIdentifierInfo. Please ignore the suggested diff.

Likely an incorrect or invalid review comment.

packages/wasm-sdk/test/ui-automation/tests/query-execution.spec.js (6)

83-94: LGTM! Good addition for DPNS query validation.

The specialized validation function correctly handles DPNS queries where "not found" is a valid response, which is appropriate for operations like availability checks and name resolution.


153-161: Great improvements to validation functions!

The enhanced property assertions ensure that query results contain the expected fields, improving test reliability and catching potential API response issues early.

Also applies to: 192-195, 222-224, 233-234, 241-243, 250-252


298-304: Good code reuse in contract validation.

The validation correctly handles the multiple contracts response structure and effectively reuses the single contract validator.


492-583: Excellent refactoring to parameterized tests!

The data-driven approach significantly improves maintainability and consistency. The test configuration structure with hasProofSupport, needsParameters, and validateFn is well-designed and makes it easy to add new queries.


585-688: Consistent parameterized test structure across all query categories.

The uniform approach across all query categories (Epoch, Token, Voting, Group, Protocol, DPNS) makes the test suite highly maintainable and easy to extend. Each category properly defines its specific validation requirements.

Also applies to: 690-804, 806-911, 913-1007, 1083-1153, 1155-1259


1224-1224: Correct usage of specialized DPNS validator.

DPNS queries appropriately use validateBasicDpnsQueryResult which allows "not found" as a valid response.

Also applies to: 1241-1241

packages/wasm-sdk/test/ui-automation/fixtures/test-data.js (6)

251-258: System queries test data looks good.

The test data for new system queries is properly structured with appropriate parameters.


262-272: Protocol queries test data properly configured.

The test parameters correctly handle both parameter-less and parameterized protocol queries.


282-314: Epoch queries test data appropriately expanded.

The test data includes realistic epoch values and proper parameters for the new epoch-related queries.


317-351: DPNS queries test data well-structured.

The test data includes realistic DPNS usernames and appropriate parameters for all DPNS query types.


393-454: Voting queries correctly implement the new indexValues parameter.

The test data properly includes the indexValues array parameter for getContestedResourceVoteState and getContestedResourceVotersForIdentity queries, aligning with the UI changes mentioned in the PR objectives.


456-492: Group queries test data properly configured.

The test data includes all necessary parameters for group-related queries with valid testnet contract IDs.

Ignore UI testing related files
@thephez
Copy link
Collaborator Author

thephez commented Aug 7, 2025

@QuantumExplorer This just builds on #2715. Please approve when you can (failing test is unrelated to this PR).

@thephez thephez added this to the v2.1 milestone Aug 12, 2025
@thephez thephez merged commit ab80785 into v2.1-dev Aug 12, 2025
22 of 23 checks passed
@thephez thephez deleted the automate-ui-testing-part2b branch August 12, 2025 14:27
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.

2 participants