Skip to content

Add Layer 2 E2E tests: session injection for phone-mode signing #50

@ottovlotto

Description

@ottovlotto

Context

The E2E test suite (#48) uses --suri //Alice dev accounts for all tests. This bypasses the session/phone-signing code path entirely, leaving these flows untested:

  • Phone-mode deploy (session signer, allowance checks, mapping checks)
  • Session expiry detection
  • Logout flow with a real session
  • dot init detecting an existing valid session and skipping QR

Blocked on

@polkadot-apps/terminal merged a testing helper (paritytech/polkadot-apps#109) but hasn't published a new npm release yet. Current latest is 0.2.3 — need a release with createTestSession() or equivalent.

Action: Ask the polkadot-apps team to cut a release, then bump @polkadot-apps/terminal in package.json.

What to implement

Once the new version is published:

  1. Bump @polkadot-apps/terminal in package.json
  2. Add injectSession(account, opts?) helper to e2e/cli/fixtures/accounts.ts that:
    • Creates a temp dir
    • Uses the upstream test helper to write a valid session file
    • Returns the temp HOME path for use with the dot() wrapper's home option
  3. Add Layer 2 tests:
    • init.test.ts: init with existing valid session skips QR, reports address
    • init.test.ts: init reports green for allowances when session key is funded
    • session.test.ts: expired session prompts re-auth
    • session.test.ts: logout clears session files correctly
    • deploy.test.ts: phone-mode deploy reaches signing step (can't complete without real phone)
  4. Optionally add DOT_SESSION_DIR env var to src/utils/auth.ts for cleaner session dir override (currently using HOME override which works but is broader)

Reference

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions