Fix e2e tests#17
Conversation
There was a problem hiding this comment.
Bug: Undefined Error Handling in Test Function
The runTest_expectFailure function incorrectly passes undefined to expect().rejects.toThrow(). In testing frameworks, toThrow(undefined) does not behave as expected for catching any error. When expectedError is undefined, toThrow() should be called without arguments to correctly expect any error.
packages/delegator-e2e/test/caveats/nativeTokenPayment.test.ts#L303-L306
BugBot free trial expires on July 22, 2025
You have used $0.00 of your $50.00 spend limit so far. Manage your spend limit in the Cursor dashboard.
Was this report helpful? Give feedback by reacting with 👍 or 👎
…context (rather than empty string which fails to match)
🚨 BugBot couldn't runBugBot is experiencing high demand right now. Try again in a few minutes by commenting "bugbot run" (requestId: serverGenReqId_a0d2f7e6-834d-42f3-bedc-a8ae31def50e). |
There was a problem hiding this comment.
Pull Request Overview
This PR updates the e2e tests for the NativeTokenPaymentEnforcer so that a failure is expected rather than a specific error string, and adjusts the GitHub workflow to allow manual triggering of the full test suite via a new RUN_FULL_TESTS input.
- Updates test expectations in nativeTokenPayment.test.ts to handle unspecified error messages.
- Modifies workflow conditionals to trigger full e2e tests based on a manual boolean input.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/delegator-e2e/test/caveats/nativeTokenPayment.test.ts | Adjusts the permissionsContext type and updates expected error handling in the e2e test. |
| .github/workflows/end-to-end-tests.yml | Introduces a RUN_FULL_TESTS workflow input and updates conditional logic to run full or smoketest suites based on that value. |
Comments suppressed due to low confidence (2)
packages/delegator-e2e/test/caveats/nativeTokenPayment.test.ts:180
- Casting the permissionsContext to '0x' as const ensures type consistency with the expected Hex type. Ensure that this assertion aligns with the definition of Hex throughout the codebase.
const permissionsContext = '0x' as const;
.github/workflows/end-to-end-tests.yml:64
- The change to use the RUN_FULL_TESTS input for triggering full tests is clear; just verify that the input is consistently handled as a boolean to avoid any potential ambiguity in string comparison.
if [[ "${{ inputs.RUN_FULL_TESTS }}" == "true" ]]; then
📝 Description
Fix e2e test for payment caveat by expecting a failure, rather than a specific failure (previously expected an empty string, which for some reason was failing 🤷)
Also updates the workflows so that we can manually trigger the e2e test to run the full suite on a branch (which I did to validate the fix).