Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Generating simulated Brave Payments data for testing

Suguru Hirahara edited this page Nov 1, 2017 · 2 revisions

This wiki became obsolete due to the recent ledger updates.

Generating simulated Brave Payments data for testing

Simulated Browsing History

**depends on code in PR #4714: https://github.com/brave/browser-laptop/pull/4714 **

What

How to generate a browsing history for testing Brave Payments so you do not need to browse pages to test it.

Steps

  • Clear Brave user data (npm run clean userData)
  • Run Brave, enable Payments
  • Observe empty synopsis table (no publishers listed)
  • In a terminal, run npm run add-simulated-synopsis-visits
  • Back in Brave, toggle Payments
  • Observe Synopsis table is populated with random Publishers with random visit counts and durations

Illustration

add_synopsis_visits gif final

Simulated Payment History

What

How to generate a simulated Payment History, allowing testing of features (e.g. Payment History or Payment Receipt export) that depend on transactions without spending BTC or waiting.

Steps

  1. Clear user data (npm run clean userData)
  2. Start Brave
  3. Enable Brave Payments
  4. Observe no transactions, empty wallet, Payment History link is unavailable
  5. Run npm run add-simulated-payment-history
  6. Switch to Brave and Toggle Payments
  7. Observe Payment History link is available
  8. Open Payment History.
  9. Observe 10 months of randomized Payments data
  10. Open /\<UserDataPath\>/ledger-state.json and confirm transactions are present

Illustration

(Please forgive the bits of the GIF where I am just highlighting the raw generated data in Emacs, that is for those who are interested in what data looks like, in ledger-state.json. You only have to run npm run add-simulated-payment-history, not do any other emacs/terminal-fu, I promise! :-) ) simulated_payments_history_script