Playwright · Electron E2E

E2E Test Protocol
Dogecoin HD Wallet (Save & Open)

File  tests/playwright/e2e/dogecoin_hd_wallet_usecase.test.js
Suite  Use Case - Dogecoin HD Wallet : generate, save, open, edit, save
Tests  1 (complete 6-phase scenario)
Blockchain  Dogecoin
General Context

This test drives the Cryptocalc application as a real user would, through its Electron GUI. It launches a fresh instance of the application, performs UI interactions, and verifies the resulting state of wallet fields as well as files saved in the _output/ folder.

Confirmed Application Behavior
Save
No file-picker. Direct write to _output/<timestamp>_<COIN>_<LANG>/ followed by an iziToast with "Show" and "Close" buttons
Open
Native OS dialog to choose the file — mocked via electronApp.evaluate({ dialog })
Key Technical Constraints
#account_id, #address_index_id
Read-only fields — modified via page.evaluate() to bypass Playwright's refusal to fill readonly inputs
#refresh_btn_id, #save_icon_id, #file_open_icon_id
May be disabled — clicked via evaluate() after removing the disabled attribute
Address generation
Asynchronous — 5s pause after each clickRefresh()
Save operation
5s wait after iziToast appears to allow file writes to complete
_output/ directory
Cleaned before each test to prevent interference
Shared Helpers
switchToHDWallet(page)Navigate to Wallet tab, select "HD Wallet" mode
selectBlockchain(page, blockchain)Select a blockchain from the dynamic dropdown
setFieldValue(page, id, val)Inject a value into any field (readonly-safe), dispatches input + change
clickRefresh(page)Trigger refresh via evaluate() — generates a new address
getDisplayedAddress(page)Read the current text content of #address_id
saveWallet(page)Click Save, wait for iziToast, dismiss it, and return the path to the created .wits file
openWallet(page, electronApp, filePath)Mock the open dialog and click the open icon
logWalletState(page, label)Log the state of main fields for debugging
cleanupOutputDir()Delete all folders and files in _output/
Test Protocol
01
Complete Workflow
Generate, save, open, and modify a Dogecoin HD wallet
Objective

Verify the complete lifecycle of a Dogecoin HD wallet: Phase 1 Initial setup (account=1, index=3)
Phase 2 Generation + address format validation
Phase 3 Save → verify JSON file in _output/
Phase 4 Reopen file → verify reload
Phase 5 Modify (account=4, index=7) + refresh
Phase 6 Second save → verify update

Preconditions
App launched & ready Wallet tab active Mode: HD Wallet Blockchain: Dogecoin _output/ folder empty
Detailed Phases
PhaseActionMethod
1Set account=1, index=3setFieldValue(page, 'account_id', '1')
setFieldValue(page, 'address_index_id', '3')
2Trigger address generationclickRefresh(page)
2bRead generated addressgetDisplayedAddress(page) → initialAddress
PhaseActionMethod
3Save walletsaveWallet(page) → savedPath1
3bVerify file existsfs.existsSync(savedPath1) === true
3cVerify JSON contains addressJSON.parse() .includes(initialAddress)
PhaseActionMethod
4Open saved fileopenWallet(page, electronApp, savedPath1)
4bRead reloaded addressgetDisplayedAddress(page) → reloadedAddress
PhaseActionMethod
5Modify account=4, index=7setFieldValue(page, 'account_id', '4')
setFieldValue(page, 'address_index_id', '7')
5bRefreshclickRefresh(page)
5cRead new addressgetDisplayedAddress(page) → updatedAddress
PhaseActionMethod
6Save modified walletsaveWallet(page) → savedPath2
6bVerify second file existsfs.existsSync(savedPath2) === true
6cVerify JSON contains new addressJSON.parse() .includes(updatedAddress)
6dVerify old address is not present! .includes(initialAddress)
Assertions
/^D[1-9A-HJ-NP-Za-km-z]{32,34}$/ ← valid Dogecoin address format
updatedAddress ≠ initialAddress
reloadedAddress = initialAddress
Failure Scenarios
  • Empty address — generation did not complete within timeout
  • Invalid address format — regex not satisfied (wrong blockchain or derivation error)
  • No file created — save failed (incorrect path or write error)
  • reloadedAddress ≠ initialAddress — open did not properly reload the wallet
  • updatedAddress = initialAddress — parameter changes were not applied
  • Second file contains old address — update was not saved
Implementation Note
Open dialog mock: Attempting to mock via electronApp.evaluate() may fail with ReferenceError: require is not defined. The test is designed to continue even if the mock fails — in that case, the real system dialog would appear, but in CI/headless environments, the application typically uses a default path or the test is configured to run without user interaction.

Cleanup: The _output/ folder is completely cleaned before each test to ensure no residual files from previous runs interfere.
Summary
PhaseActionAssertionBlockchain
1-2 Initial generation (account=1, index=3) regex Dogecoin
3 First save file created + contains address Dogecoin
4 Reopen file reloaded address = initial address Dogecoin
5 Modify (account=4, index=7) new address ≠ old address Dogecoin
6 Second save second file created + contains new address Dogecoin