-
Notifications
You must be signed in to change notification settings - Fork 44
test(sdk): expand wasm-sdk page UI testing #2720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Improve executeQuery method to handle queries that execute so quickly they never show a loading state. Some queries like getContestedResourceIdentityVotes complete instantly (0.0s) and transition directly from success to success without displaying the loading state.
Previously many tests didn't check for specific fields/objects in the response
WalkthroughThe changes introduce a new required Changes
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ 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)
✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 toget_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 constraintsThe 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/orhelp
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
📒 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
toDYNAMIC_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
, andprefix
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
andstartAfter
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
, andstartAtIdentifierInfo
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:
- Attempts to wait for loading state with a reasonable 5-second timeout
- Falls back to checking current status if loading state is skipped
- Correctly identifies successful/error completions for instant queries
- 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 forindexValues
The
get_contested_resource_vote_state_with_proof_info
binding is declared aspub 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. UsingJSON.stringify
here would send a single string, breaking theVec<JsValue>
signature. There is no equivalent state-transition call that stringifiesindexValues
—the only JSON serialization in that wrapper is forstartAtIdentifierInfo
. 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
, andvalidateFn
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 forgetContestedResourceVoteState
andgetContestedResourceVotersForIdentity
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
@QuantumExplorer This just builds on #2715. Please approve when you can (failing test is unrelated to this PR). |
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?
How Has This Been Tested?
Breaking Changes
None
Checklist:
For repository code-owners and collaborators only
Summary by CodeRabbit
New Features
Enhancements
Bug Fixes
Refactor
Chores
.gitignore
entries to exclude test reports and results from version control.