Files
safe-wallet/package.json
T
TimandGitHub 495d3cc054 tests(mobile): e2e coverage for WalletConnectGate flows (#7760)
* tests(mobile): add e2e coverage for WalletConnectGate flows

Adds Maestro tests for the two non-signing gate states on the
review-and-execute screen:

- wc-gate-reconnect.yml: expired session renders "Reconnect wallet to
  continue"; tapping restores the session and reveals Execute transaction.
- wc-gate-switch-network.yml: wrong-network state renders "Switch network
  to continue"; tapping clears the flag and reveals Execute transaction.

Wires up the e2e control surface:

- WalletConnectContext.e2e.tsx: mock reconnect() and switchNetworkIfNeeded()
  now flip walletConnectE2eState so the gate transitions correctly.
- TestCtrls: e2eWcGateReconnect and e2eWcGateWrongNetwork buttons.
- connectSignerSetup: setupWcGateReconnect / setupWcGateWrongNetwork seed
  a pending-tx safe with a WC signer in the desired gate state.

Pin isows@1.0.7 in package.json resolutions.

Part of WA-1858.

* tests(mobile): extract shared review-and-execute nav for wc-gate tests

Both wc-gate YAML tests duplicated ~30 lines navigating from app start to
the Review-and-Execute screen of the first pending tx. Move that navigation
into apps/mobile/e2e/utils/setup/open-review-and-execute.yml, parameterised
by SETUP_BUTTON_ID, and have both gate tests `runFlow` it. The seeding
button id is now the only piece of per-test configuration.

* tests(mobile): assert wc-gate dismissal by id, not by neighbouring text

The gate-dismissed assertion used a regex matching either "Execute
transaction" or "Insufficient funds". Those are distinct semantic states
(funded vs unfunded signer); coupling them in one assertion lets a
funds-error regression silently pass the gate test.

Replace the text regex with `extendedWaitUntil: notVisible` on the gate
button id. That waits for re-render and asserts the gate is gone in one
step, decoupling the test from the underlying execute-button copy.

* tests(mobile): drop unread fields from WC e2e state overrides

WalletConnectGate and useWalletConnectStatus only read `address`,
`isWrongNetwork`, and `isWalletConnectSigner`. The setup helpers and the
`reconnect` mock were also setting `hasProvider` and `walletInfo` —
unobservable from any production code path, so they only added noise.

- setupWcGateReconnect: drop the override entirely; post-reset defaults
  already model an expired session.
- setupWcGateWrongNetwork: drop hasProvider and walletInfo.
- WalletConnectContext.e2e.tsx reconnect mock: drop hasProvider.

* tests(mobile): add `wc-gate` tag to connect-signer suite

The two child flows (wc-gate-reconnect.yml, wc-gate-switch-network.yml)
declare a `wc-gate` tag, but the parent __suite__.yml didn't surface it.
Tag-based runs (`maestro test --include-tags wc-gate`) now also pick up
the aggregated suite, matching repo convention.

* tests(mobile): annotate wcSigner literal with explicit Signer type

The literal relied on inference plus `as const` on `type`. With an explicit
Signer annotation, future widening or narrowing of the discriminated union
in signersSlice will surface here at compile time instead of failing
silently in the e2e flow. The `as const` workaround is no longer needed.

* tests(mobile): reuse setupPendingTxSafe from WC gate setup

setupWcGateBase duplicated the pending-tx safe scaffolding already in
setupHelpers.ts (base config, signer registration, active safe/signer).
The only delta was the signer's `type: 'walletconnect'` and the extra
setExecutionMethod dispatch.

Extend setupPendingTxSafe with an optional `options.signer` override.
Existing five private-key callers are unchanged. setupWcGateBase now
constructs the WC Signer literal and delegates everything else to the
shared helper.

* docs(mobile): document `e2e<PascalCase>` exception for TestCtrls triggers

The repo-wide testID convention is kebab-case, but every TestCtrls
scenario-trigger button uses `e2eConnectSignerOwner`-style camelCase.
That divergence was undocumented, so new contributors would either
churn the convention or get pushed to match it without context.

Codify the exception: product testIDs stay kebab-case; the hidden
e2e-build-only TestCtrls triggers use `e2e<PascalCase>`.

* docs: document `isows@1.0.7` resolution and add resolutions log

The root package.json `resolutions` block had 12 entries with zero
recorded rationale, so each new reviewer has to investigate why a pin
exists. Add `docs/resolutions.md` as the canonical home for that
rationale and seed it with the `isows@1.0.7` entry — a benign dedup
(no CVE) added to align the transitive version under viem.

Future contributors are asked to update the log alongside any new
resolutions entry.
2026-04-28 10:35:30 +02:00

70 lines
2.2 KiB
JSON

{
"private": true,
"name": "@safe-global/safe-wallet",
"version": "1.0.1",
"workspaces": [
"expo-plugins/*",
"apps/*",
"config/*",
"packages/*",
"tools/codemods/*"
],
"scripts": {
"lint": "turbo run lint --",
"type-check": "turbo run type-check --",
"test": "turbo run test --",
"test:scripts": "yarn workspace @safe-global/web jest --config ../../scripts/jest.config.cjs",
"eslint": "yarn workspaces foreach --all -pt run eslint",
"prettier": "prettier --check . --config ./.prettierrc --ignore-path ./.prettierignore",
"prettier:fix": "prettier --write . --config ./.prettierrc --ignore-path ./.prettierignore",
"verify": "node scripts/verify.mjs",
"verify:web": "node scripts/verify.mjs --workspace=web",
"verify:changed": "node scripts/verify.mjs --changed",
"verify:changed:web": "node scripts/verify.mjs --changed --workspace=web",
"postinstall": "husky"
},
"resolutions": {
"motion": "12.34.0",
"@ledgerhq/context-module/ethers": "6.14.3",
"@gnosis.pm/zodiac/ethers": "6.14.3",
"@ledgerhq/device-signer-kit-ethereum/ethers": "6.14.3",
"@cowprotocol/events": "1.3.0",
"@ethersproject/signing-key/elliptic": "^6.6.1",
"stylus": "0.64.0",
"viem": "2.21.55",
"isows": "1.0.7",
"webpack": "5.97.1",
"react-native-quick-base64": "2.2.2",
"@tamagui/image@npm:2.0.0-rc.26": "patch:@tamagui/image@npm%3A2.0.0-rc.26#~/.yarn/patches/@tamagui-image-npm-2.0.0-rc.26-04087a216c.patch"
},
"devDependencies": {
"@storybook/builder-webpack5": "^10.2.6",
"@storybook/react": "^10.2.6",
"ajv": "^8.18.0",
"ajv-formats": "^3.0.1",
"husky": "^9.1.6",
"lint-staged": "^16.2.7",
"msw": "^2.7.3",
"prettier": "^3.6.2",
"storybook": "^10.2.7",
"turbo": "^2.9.6"
},
"dependenciesMeta": {
"cypress": {
"built": true
},
"next": {
"built": true
}
},
"packageManager": "yarn@4.14.1+sha512.64df448055b2d37ba269d7db535a469b8da93f8ef1140c25fd7a83c00a8fbaacb214ca0e02553b92a2c54cef78bb67d0b4817fab02001df0e24fac0faccc3b42",
"dependencies": {
"@yarnpkg/types": "^4.0.1"
},
"msw": {
"workerDirectory": [
"apps/web/public"
]
}
}