Nostro/tests/ShouldDriveTheApp/main.cpp
Jorijn van der Graaf b43ab124a6
feat: open payto links on the pay form, and take the checkout over D-Bus out
An app could have nostrod pay an order: it called Pay of
net.catcrafts.Nostro1.Checkout on the system bus, and nostrod paid from
an account the user had chosen, after a dialog of its own. On 2026-11-22
the owner decided that a link takes its place. The app registers for
payto links (RFC 8905), so that an app or a website can hand one to the
desktop, and shows a link as its pay form filled in.

The link:

- The app's desktop entry takes the scheme (Exec=nostro-app %u,
  MimeType=x-scheme-handler/payto), and nostro-app takes an argument
  that is no option as a link: it overwrites it in argv and hands it to
  App::Open once the app has started.
- ReadPaymentLink (Nostro.App:Forms) reads payto://iban/<IBAN> with the
  options amount, receiver-name and message, and refuses a link rather
  than guess at it, in a sentence of the app's own with nothing of the
  link in it. Among what it refuses: an IBAN whose check digits do not
  hold, one of the three options given twice, instruction, a comma in
  the amount, and a name or a message with a code point that is Unshown,
  or Blank and no plain space.
- A link that is read waits until the accounts are read and
  DefaultCheckoutAccount has answered or failed, with a line on the
  accounts' page. Then App::TakeLink fills in the pay form, which says
  in a banner that a link filled it in, and with more than one account
  opens it under the choice of accounts that the form's From row has. A
  link pays nothing: the form's button sends, and polkit's dialog
  confirms as for any payment (design rule 12, and 14, which is new).
- Unshown and Blank are the two tables the worker's Shown() works from.
  They move into Nostro:Utils, where the app's reader asks them too.
  The move is within the library. The reader holds a link's name to
  those two and to no more of Shown(): a name with an & is read, and
  the dialog shows it with a + as it does any name.

The checkout:

- nostrod serves one interface under one bus name. Gone are
  net.catcrafts.Nostro1.Checkout with its XML and its activation file,
  the polkit action Checkout, the module Nostro.Checkout with
  --product=checkout, and the worker's record of orders. That changes
  the published contract after a release, 0.0.0, and design rule 10
  records it as the owner's decision.
- DefaultCheckoutAccount and SetDefaultCheckoutAccount keep their names
  and signatures. The account they keep is where a link's pay form
  starts: nostrod's dialog for choosing it says "have pay links start
  from", the app's setting reads "Pay links start from", and `nostro
  checkout account` prints "pay links start from".
- The D-Bus policy still lets nostrod own the old name: the nostrod of
  0.0.0 asks for it when it starts, and the system files can be newer
  than the Flatpak it runs from. install.sh removes the old name's
  activation file. A user's checkouts.cdb is read by nothing any more,
  and is left where it is.
- The Arch package stops installing the checkout's two files, and its
  pkgrel goes up to 2. Where makepkg -si finds a package of the version
  already built it installs that one again, which would bring the
  activation file back. The guide now says that pkgrel goes up with a
  change to what the package installs.
- Bus::Interface goes too: the worker called it in two places, to tell
  a call to the checkout from one to the main interface.

The review's own files follow. gate0 loses the build of
--product=checkout, and the three lens sections that named the checkout
no longer do, and ask about a link.

The README has "Pay links" in place of "Checkout for apps", and
AGENTS.consumer.md says what the app reads of a link. Its line on
lib/json.hpp no longer gives a release: the file is of none, and the
guide names its commit. The pay form and the accounts' page change only
by a banner each, shown while a link is in play, which
docs/screenshots/take.sh never has: the README's pictures stand.

Tests: ShouldValidateForms reads and refuses links and fills the form
from one. ShouldDriveTheApp opens links against a real nostrod on the
fake bus: before the accounts are known, with no account, with one and
with several, with the accounts known and the system bus gone, for a
second user whose first connection pays their own accounts only, one
that cannot be read, one whose name has an &, and through polkit's
dialog to the payment. It now counts nostrod's answers to hold that the
account pay links start from is read again once a connection is
removed: the check it had there passed without that.
ShouldHandleMoneyAndText holds the two tables at the ends of their
ranges. ShouldServeEveryUser holds that nostrod serves no checkout, that
the bus's policy lets an older nostrod own the old name, and the account
pay links start from. ShouldRunCommands holds the CLI's wording.

The review's gate0 passes at this commit: the version check, 17 tests,
the builds of the CLI, the library, nostrod, the fake system, the app
and its --debug-api build, and five lint runs that report nothing.
tests/coverage.sh reports lines, functions and regions at 100.00%.

Looked at on 2026-11-22 on the made-up system (run fake), on a desktop
(KWin at a scale of 1.85). At 420x760, at --scale 3 --size 360x760 and
at 1100x720 in the light look: a link's pay form under the choice of
accounts, the form after a tap beside that choice, and the accounts'
page while a link waits, its line above the rows that stand in for the
accounts (--bank-delay 10000). At 420x760: that line above what the
page says when the accounts cannot be read (--polkit deny) and above
the accounts themselves (--polkit slow, the link opened in the running
app), the settings' row and page for the account pay links start from,
the sheet for a link that cannot be read, and with --empty the sheet
for no account.
2026-11-22 13:35:51 +01:00

2258 lines
126 KiB
C++

// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// Nostro's window without a window (Nostro.App): every screen built into a frame of the toolkit and pressed by name,
// against a real nostrod. nostrod is this executable again (its main is compiled in), on a fake system bus
// (tests/Support/FakeBus.inc) in front of a fake bunq (tests/Support/FakeBunq.inc), and every answer arrives through
// an sd-event loop, as in the app. What the screens say is read from the frame's draw list.
#include "../../lib/json.hpp"
#include <poll.h>
#include <signal.h>
#include <spawn.h>
#include <stdlib.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/wait.h>
#include <systemd/sd-bus.h>
#include <systemd/sd-event.h>
#include <systemd/sd-id128.h>
#include <time.h>
#include <unistd.h>
import std;
import Nostro;
import Nostro.Ui;
import Nostro.App;
import Crafter.Network;
#define main NostrodMain
#include "../../implementations/nostrod.cpp"
#undef main
#include "../Support/Check.inc"
#include "../Support/Ui.inc"
#include "../Support/FakeBunq.inc"
#include "../Support/FakeBus.inc"
using namespace Nostro;
using namespace Nostro::Ui;
using Nostro::App::Fingerprint;
using Nostro::App::GroupIban;
using Nostro::App::Operation;
using Test::Check;
using Test::Equal;
using Test::Hides;
using Test::Shows;
using json = nlohmann::json;
using Fault = Fake::Fault;
using Where = std::source_location;
namespace fs = std::filesystem;
namespace {
constexpr std::uint16_t port = 47307;
constexpr std::uint32_t uid = 4242;
// A second user of the machine, with connections of their own.
constexpr std::uint32_t erinUid = 4243;
constexpr std::string_view busName = "net.catcrafts.Nostro1";
const std::string aliceKey = "key-alice-0123456789abcdef";
const std::string aliceMain = "NL23BUNQ2025123456";
const std::string aliceSavings = "NL84BUNQ2025333333";
const std::string bobIban = "NL67BUNQ2025654321";
const std::string carolIban = "NL65BUNQ2025222222";
const std::string daveKey = "sandbox_dave_0123456789abcdef";
const std::string daveIban = "NL06BUNQ2025444444";
const std::string otherAliceIban = "NL25BUNQ2025555555";
const std::string strangerIban = "NL44BUNQ2025666666";
// A link as a website's pay button opens one: to Bob's account, under a shop's name, with what is owed and for what.
const std::string shopLink = std::format("payto://iban/{}?amount=EUR:12.50&receiver-name=Shop%20BV&message=Order%201234", bobIban);
void SetPolkit(Fake::Bus& bus, Fake::Polkit outcome, std::string_view action = {}) {
std::lock_guard lock(bus.mutex);
if(action.empty()) {
bus.polkit = outcome;
bus.polkitByAction.clear();
} else {
bus.polkitByAction[std::string(action)] = outcome;
}
}
// Runs the loop until `done` says so, for at most `limit`; whether it did.
template<typename Done>
bool RunUntil(sd_event* loop, Done&& done, std::chrono::seconds limit = std::chrono::seconds(60)) {
const std::chrono::steady_clock::time_point deadline = std::chrono::steady_clock::now() + limit;
while(!done()) {
if(std::chrono::steady_clock::now() >= deadline) {
return false;
}
sd_event_run(loop, 100000);
}
return true;
}
// The app with what a window gives it: a toolkit context of a phone's size, a client on the loop, a desktop that
// opens addresses, and a clock that stands still on 1 October 2026, the day the fake bunq dates what it makes.
struct Driver {
Fake::Bus& bus;
sd_event* loop;
std::chrono::seconds timeout = std::chrono::minutes(10);
bool noBus = false;
std::int32_t connects = 0;
std::vector<std::string> opened;
bool opens = true;
std::vector<std::string> answers;
std::int32_t settled = 0;
std::int64_t clock = 1000;
Box size{0, 0, 400, 800};
Context ui;
Nostro::App::App app;
// `bare`: with nothing but the connection, as a program that gives the app no more runs it.
Driver(Fake::Bus& bus, sd_event* loop, bool bare = false) : bus(bus), loop(loop), ui(Test::FixedMeasure()), app(ui, Host(bare)) {
if(!bare) {
app.onAnswer = [this](std::string_view member, bool failed) { answers.push_back(std::format("{} {}", member, failed ? "failed" : "ok")); };
app.onSettled = [this] { settled++; };
}
}
Nostro::App::Host Host(bool bare) {
Nostro::App::Host host;
host.connect = [this] {
connects++;
if(noBus) {
throw std::system_error(std::make_error_code(std::errc::connection_refused), "cannot connect to the system bus");
}
Client client = Client::System(timeout);
client.Attach(loop);
return client;
};
if(bare) {
return host;
}
host.openUri = [this](std::string_view uri, std::function<void(bool)> then) {
opened.emplace_back(uri);
then(opens);
};
host.now = [] { return ParseLocalDate("2026-10-01 15:00"); };
host.oauthState = [] { return std::string("state-1"); };
host.version = "1.2.3";
return host;
}
};
// The regions already said to be too small to press, so that each is said once.
std::set<std::string, std::less<>> tooSmall;
// And the screens already said to name a bank.
std::set<std::string, std::less<>> naming;
// No screen names a bank, or a way to connect to one, in the app's own words: an account's pages are the same
// whichever bank it is with. Only the settings' pages that add a connection and list them do, from what the app
// knows of each bank. What nostrod and the bank say in their own words is theirs to say: the library's warning
// about a connector, a bank's refusal with the call it refused, a link the bank made.
void NamesNoBank(Driver& d) {
const std::string screen = d.app.Screen();
if(screen.starts_with("add") || screen.starts_with("connections")) {
return;
}
std::string said;
for(const std::string& text : d.ui.Shown().draw.Texts()) {
said += text;
said += ' ';
}
for(const std::string_view theirs : {"bunq connector", "bunq GET", "bunq POST", "bunq PUT", "bunq DELETE", "bunq.me"}) {
for(std::size_t at = said.find(theirs); at != std::string::npos; at = said.find(theirs)) {
said.erase(at, theirs.size());
}
}
for(const std::string_view name : {"bunq", "OAuth"}) {
if(said.contains(name) && naming.insert(std::format("{} {}", screen, name)).second) {
std::println("FAIL: the screen {} says '{}', which is one bank's own. It says:\n{}", screen, name, Test::Said(d.ui));
Test::failures++;
}
}
}
void Build(Driver& d) {
Frame& frame = d.ui.Begin(d.size, 1, d.clock);
d.app.Build(frame);
d.ui.End();
NamesNoBank(d);
// On a phone, what can be pressed is at least as wide and as tall as a finger needs, on every screen the tests
// come by.
if(d.ui.Shown().sizeClass != SizeClass::Compact) {
return;
}
for(const Region& region : d.ui.Regions()) {
if(region.onTap && region.enabled && region.role != Role::Scrim && std::min(region.box.w, region.box.h) < Size::touch && tooSmall.insert(region.key).second) {
std::println("FAIL: on the screen {}, '{}' is {} by {}: less than a finger needs", d.app.Screen(), region.key, region.box.w, region.box.h);
Test::failures++;
}
}
}
// Waits until nostrod has answered everything the app asked, and draws what the user then sees.
void Settle(Driver& d, Where where = Where::current()) {
Check(RunUntil(d.loop, [&d] { return !d.app.Busy(); }), "nostrod answers", where);
Build(d);
}
// A tap on what is called `key`, and the frame after it; nostrod is not waited for.
void Tap(Driver& d, std::string_view key, Where where = Where::current()) {
Build(d);
if(!d.ui.Tap(key)) {
std::println("FAIL {}:{}: nothing called '{}' can be tapped. The screen ({}) says:\n{}", where.file_name(), where.line(), key, d.app.Screen(), Test::Said(d.ui));
Test::failures++;
}
Build(d);
}
// A tap, and what the user sees once nostrod has answered what it led to.
void Press(Driver& d, std::string_view key, Where where = Where::current()) {
Tap(d, key, where);
Settle(d, where);
}
// Types into the field of that name, after what it holds.
void Type(Driver& d, std::string_view key, std::string_view text, Where where = Where::current()) {
Tap(d, key, where);
d.ui.Text(text);
Build(d);
}
// Replaces what the field of that name holds.
void Retype(Driver& d, std::string_view key, std::string_view text, Where where = Where::current()) {
Tap(d, key, where);
d.ui.KeyDown(Key::A, {.control = true});
d.ui.KeyDown(Key::Backspace, {});
d.ui.Text(text);
Build(d);
}
bool Has(Driver& d, std::string_view key) {
return d.ui.Find(key) != nullptr;
}
// What the line called `label` says, of the sheet that is open: a press on it copies that. Nothing for no such line.
std::string Line(Driver& d, std::string_view label) {
Build(d);
if(!d.ui.Tap(std::format("copy.{}", label))) {
return {};
}
Build(d);
return d.ui.Take().copy.value_or(std::string());
}
// From the list of connections to the form of one of bunq's ways: the bank is chosen first, then the way.
void Adding(Driver& d, std::string_view way, Where where = Where::current()) {
Tap(d, "connections.add", where);
Tap(d, "bank.bunq", where);
Tap(d, std::format("way.{}", way), where);
}
// Out of every page that was gone into, back to the place they were gone into from.
void Out(Driver& d) {
Build(d);
while(Has(d, "bar.back")) {
Tap(d, "bar.back");
}
}
// Scrolls the page to its end, where what follows a long list is.
void Bottom(Driver& d) {
const std::string screen = d.app.Screen();
d.ui.Scroll(std::format("page:{}", screen.substr(0, screen.find('+')))).ScrollBy(1000000);
Build(d);
Build(d);
}
void Top(Driver& d) {
const std::string screen = d.app.Screen();
d.ui.Scroll(std::format("page:{}", screen.substr(0, screen.find('+')))).ScrollBy(-1000000);
Build(d);
}
// A tap beside a sheet, on what it covers: at the window's top, which no sheet reaches.
void TapBeside(Driver& d) {
Build(d);
Test::TapAt(d.ui, {200, 20}, d.clock);
Build(d);
}
// The key of the first row of a list: "incoming." gives the newest request received.
std::string Row(Driver& d, std::string_view prefix, std::size_t index = 0) {
std::size_t seen = 0;
for(const Region& region : d.ui.Regions()) {
if(region.key.starts_with(prefix) && seen++ == index) {
return region.key;
}
}
return std::format("no row {} of {}", index, prefix);
}
// How many lines of the screen say `text`.
std::size_t Count(Driver& d, std::string_view text) {
return static_cast<std::size_t>(std::ranges::count_if(d.ui.Shown().draw.Texts(), [text](const std::string& line) { return line.contains(text); }));
}
std::size_t Answers(const Driver& d, std::string_view answer) {
return static_cast<std::size_t>(std::ranges::count(d.answers, answer));
}
// nostrod's worker for the user: the other process on the bus besides nostrod itself.
pid_t Worker(Fake::Bus& bus, pid_t nostrod) {
for(const pid_t peer : bus.Peers()) {
if(peer != nostrod) {
return peer;
}
}
return -1;
}
// The polkit action of the last check that was for a change: every screen reads again after one, which is a
// check of its own.
std::string Action(Fake::Bus& bus) {
std::lock_guard lock(bus.mutex);
const auto change = std::ranges::find_if(std::views::reverse(bus.checks), [](const Fake::PolkitCheck& check) { return check.action != Bus::actionView; });
return change == std::views::reverse(bus.checks).end() ? std::string() : change->action;
}
// What the system's dialog said that change was: nostrod's own words for it, from its own data.
std::string Summary(Fake::Bus& bus) {
std::lock_guard lock(bus.mutex);
const auto change = std::ranges::find_if(std::views::reverse(bus.checks), [](const Fake::PolkitCheck& check) { return check.action != Bus::actionView; });
return change == std::views::reverse(bus.checks).end() || !change->details.contains("summary") ? std::string() : change->details.at("summary");
}
// How often polkit was asked about a change: what a screen reads is a check too, for looking.
std::size_t Changes(Fake::Bus& bus) {
std::lock_guard lock(bus.mutex);
return static_cast<std::size_t>(std::ranges::count_if(bus.checks, [](const Fake::PolkitCheck& check) { return check.action != Bus::actionView; }));
}
// What the bank was last sent as a payment or a draft of one.
std::string LastPayment(Fake::Bunq& bunq) {
const std::vector<Fake::Logged> log = bunq.Log();
const auto sent = std::ranges::find_if(std::views::reverse(log), [](const Fake::Logged& entry) { return entry.method == "POST" && entry.path.contains("payment"); });
return sent == std::views::reverse(log).end() ? std::string() : sent->body;
}
// Before nostrod runs: no system bus at all, then a bus without nostrod, then nostrod without a connection.
void Starting(Driver& d, pid_t& nostrod, const fs::path& state) {
d.noBus = true;
d.app.Start();
Check(!d.app.Busy() && !d.app.Changing(), "without a system bus nothing is waited for");
Build(d);
Shows(d.ui, "The system bus cannot be reached", "no system bus is said");
Shows(d.ui, "Connection refused", "with why");
Equal(d.app.Screen(), std::string("accounts"), "on the first screen");
Check(d.app.Overview().state == Nostro::App::LoadState::Failed, "nothing is known");
d.noBus = false;
Press(d, "overview.action");
Shows(d.ui, "Nostro's service is not running", "a bus without nostrod is said");
Shows(d.ui, "README", "with where to read how to install it");
Equal(d.answers.back(), std::string("Connectors failed"), "the answer is told to whoever listens");
nostrod = Fake::StartNostrod({"--state", state.string(), "--idle", "120", "--prompt-timeout", "2"});
Check(d.bus.WaitForName(busName), "nostrod owns its name");
Tap(d, "overview.action");
Check(d.app.Busy(), "nostrod is being asked");
Check(!Has(d, "overview.action"), "and the screen waits");
Settle(d);
Shows(d.ui, "Welcome to Nostro", "a user without a bank connection is welcomed");
Check(Has(d, "nav.accounts") && Has(d, "nav.cards") && Has(d, "nav.settings"), "the app's places are along the bottom");
Equal(d.connects, 2, "one connection to the bus is all it took");
// A link that asks for a payment, and no account to pay it from: that is said, and no form is opened.
Check(d.app.Open(shopLink), "a link is taken");
Settle(d);
Equal(d.app.Screen(), std::string("accounts+link"), "a link opens no form where there is no account to pay from");
Shows(d.ui, "No account to pay from", "which is said");
Shows(d.ui, "This link asks for a payment", "with what the link was for");
Hides(d.ui, "Shop BV", "and with nothing of what the link said");
Tap(d, "link.close");
Equal(d.app.Screen(), std::string("accounts"), "closed, it leaves the welcome");
Shows(d.ui, "Welcome to Nostro", "where a bank can be connected");
Hides(d.ui, "A link asks for a payment", "and the link waits for nothing");
// Every place says so when it has nothing to show.
Press(d, "nav.cards");
Shows(d.ui, "No cards", "no cards");
Press(d, "nav.settings");
Shows(d.ui, "0 connected", "no connections");
Tap(d, "settings.connections");
Shows(d.ui, "No bank is connected yet", "none to list");
Tap(d, "bar.back");
Tap(d, "settings.checkout");
Shows(d.ui, "No accounts to choose from", "and no account for a pay link to start from");
Tap(d, "bar.back");
Tap(d, "nav.accounts");
// A connection without an account: there is nothing to pay from.
Client other = Client::System();
other.AddBunq("key-eve", "*", "");
Press(d, "bar.refresh");
Shows(d.ui, "Eve", "a connection without accounts is listed");
Shows(d.ui, "No accounts", "as having none");
Check(!d.ui.Find("home.pay")->enabled && !d.ui.Find("home.request")->enabled, "and nothing can be paid or asked for");
Tap(d, "nav.settings");
Tap(d, "settings.connections");
Check(Has(d, "connection.Eve."), "and has a row among the connections");
Tap(d, "bar.back");
Tap(d, "nav.accounts");
other.RemoveConnector("Eve");
Press(d, "bar.refresh");
Shows(d.ui, "Welcome to Nostro", "without it the welcome is back");
// One account in all: a link's form opens from it at once, since there is nothing to choose between.
other.AddBunq(daveKey, "*", "");
Press(d, "bar.refresh");
Shows(d.ui, "Play money", "a single account");
Check(d.app.Open(shopLink), "a link is taken");
Build(d);
Equal(d.app.Screen(), std::string("pay"), "with one account a link opens its form without asking which account pays");
Shows(d.ui, "Play money", "from the one there is");
Shows(d.ui, "Shop BV", "filled in");
Tap(d, "bar.back");
other.RemoveConnector("Dave");
Press(d, "bar.refresh");
Shows(d.ui, "Welcome to Nostro", "and with that account gone the welcome is back");
// Connecting a bank from there: which bank first, then how, and then the form of that way.
Check(Has(d, "welcome.connect") && d.ui.Find("welcome.connect")->label == "Connect a bank", "which offers to connect a bank, whichever");
Tap(d, "welcome.connect");
Equal(d.app.Screen(), std::string("add"), "that leads to the banks there are");
Shows(d.ui, "Add a connection", "which is the first step of adding a connection");
Shows(d.ui, "Which bank is the account with?", "and asks which bank");
Check(Has(d, "bank.bunq") && !Has(d, "nav.accounts"), "bunq is one of them");
Shows(d.ui, "API key · OAuth", "listed with the ways it can be connected");
Tap(d, "bank.bunq");
Equal(d.app.Screen(), std::string("add:bunq"), "a bank leads to its ways");
Shows(d.ui, "How do you want to connect to bunq?", "which are asked for by the bank's name");
Check(Has(d, "way.key") && Has(d, "way.oauth"), "an API key and OAuth, for bunq");
Shows(d.ui, "Full access", "each with what it gives");
Tap(d, "way.oauth");
Equal(d.app.Screen(), std::string("add:bunq:oauth"), "and a way to its form");
Shows(d.ui, "bunq · OAuth", "which is called what was chosen");
Check(Has(d, "oauth.client"), "and is that way's own");
Tap(d, "bar.back");
Equal(d.app.Screen(), std::string("add:bunq"), "the way back is by the same steps: the ways");
Tap(d, "bar.back");
Equal(d.app.Screen(), std::string("add"), "the banks");
Tap(d, "bar.back");
Equal(d.app.Screen(), std::string("accounts"), "and the welcome it was gone into from");
Shows(d.ui, "Welcome to Nostro", "which is still there");
}
// The first connection, with an API key.
void Connecting(Driver& d, Fake::Bus& bus) {
Tap(d, "welcome.connect");
Tap(d, "bank.bunq");
Tap(d, "way.key");
Equal(d.app.Screen(), std::string("add:bunq:key"), "by the bank and the way, the welcome leads to the key's form");
Shows(d.ui, "bunq · API key", "which is called what was chosen");
Check(!Has(d, "nav.accounts") && Has(d, "bar.back"), "a page gone into has a way back and no way sideways");
Press(d, "key.connect");
Shows(d.ui, "The API key, from the bunq app", "a form without a key says so");
Equal(d.app.Screen(), std::string("add:bunq:key"), "and asks nostrod nothing");
Type(d, "key.key", aliceKey);
Shows(d.ui, std::format("Typed: {}", Fingerprint(aliceKey)), "what was typed is told by how it begins and how long it is");
Hides(d.ui, aliceKey.substr(aliceKey.size() - 4), "and not by how it ends, which is what was typed last");
Hides(d.ui, aliceKey, "and never shown");
Hides(d.ui, "The API key, from the bunq app", "the error goes once there is a key");
Check(!Has(d, "key.ips"), "the allowed addresses are tucked away");
Tap(d, "key.advanced");
Check(Has(d, "key.ips"), "until they are asked for");
Tap(d, "key.advanced");
Check(!Has(d, "key.ips"), "and can be put away again");
Check(!Has(d, "key.environment") && !Has(d, "key.environment.0"), "there is no environment to choose: the key says which it is of");
Shows(d.ui, "A key that starts with sandbox_", "which the form says");
// The password dialog closed without a password: nothing is added, and the key need not be typed again.
SetPolkit(bus, Fake::Polkit::Dismiss, Bus::actionConnectors);
Press(d, "key.connect");
Shows(d.ui, "Not confirmed", "a closed password dialog is said");
Equal(d.app.Screen(), std::string("add:bunq:key+problem"), "over the form");
Equal(d.settled, 1, "and the change is over");
Press(d, "problem.close");
Shows(d.ui, std::format("Typed: {}", Fingerprint(aliceKey)), "the key is still in its field");
SetPolkit(bus, Fake::Polkit::Password, Bus::actionConnectors);
Tap(d, "key.connect");
Shows(d.ui, "Connecting to bunq", "the change under way is shown");
Shows(d.ui, "Confirm it in your system's password dialog.", "with where to confirm it");
Check(d.app.Changing() && d.app.Busy() && d.app.Screen() == "add:bunq:key+working", "it is under way");
TapBeside(d);
Equal(d.app.Screen(), std::string("add:bunq:key+working"), "and cannot be sent away");
d.ui.KeyDown(Key::Escape, {});
Build(d);
Equal(d.app.Screen(), std::string("add:bunq:key+working"), "by Escape either");
Settle(d);
Shows(d.ui, "Connected Alice", "the connection is made");
Equal(Line(d, "Connected with"), std::string("API key"), "with the way that was chosen");
Equal(Line(d, "Environment"), std::string("Production"), "in the environment the key is of");
Equal(Action(bus), std::string(Bus::actionConnectors), "after the password for changing connections");
Check(!d.app.Changing() && d.settled == 2, "and whoever waits for it is told");
Press(d, "done.close");
Equal(d.app.Screen(), std::string("accounts"), "which leads to the accounts");
Shows(d.ui, "Main", "the account is listed");
Shows(d.ui, GroupIban(aliceMain), "with its IBAN in groups");
Shows(d.ui, "€1,000.00", "and its balance");
Shows(d.ui, "€2,500.00", "and so is the other one");
Hides(d.ui, "Welcome to Nostro", "the welcome is over");
Check(Has(d, "home.pay") && Has(d, "home.request"), "paying and asking are at hand");
Tap(d, "nav.settings");
Shows(d.ui, "No account chosen", "no account is chosen for pay links to start from yet");
Tap(d, "settings.connections");
Check(Has(d, "connections.add") && d.ui.Find("connections.add")->label == "Add a connection", "the settings add a connection too, of whichever bank");
Adding(d, "key");
Equal(d.app.Screen(), std::string("add:bunq:key"), "by the same steps");
Hides(d.ui, "Typed:", "a key that connected is forgotten");
Out(d);
Equal(d.app.Screen(), std::string("settings"), "and the way back leads to the settings they were gone into from");
Tap(d, "nav.accounts");
}
// The accounts' screen: what a refresh finds, a connection that does not work, the library's warnings, a reading
// that fails, and connections that change while they are read.
void Overview(Driver& d, Fake::Bus& bus, Fake::Bunq& bunq, std::uint64_t alice, pid_t nostrod) {
Client other = Client::System();
other.AddBunq(daveKey, "*", "");
Press(d, "bar.refresh");
Shows(d.ui, "Dave", "a connection made elsewhere is found by a refresh");
Shows(d.ui, "Sandbox", "and one of the sandbox is marked");
Shows(d.ui, "€123.45", "with its account");
Hides(d.ui, "Not working", "a connection that answers is not marked");
bunq.Fail(Fault{.method = "GET", .path = std::format("/user/{}", alice), .status = 500, .body = R"({"Error":[{"error_description":"Hiccup."}]})"});
Press(d, "bar.refresh");
Shows(d.ui, "Not working", "a connection the bank does not answer for is marked");
Shows(d.ui, "Main", "and its accounts are still there");
const std::size_t readings = Answers(d, "Connectors ok");
Build(d);
d.ui.KeyDown(Key::F5, {});
Settle(d);
Equal(Answers(d, "Connectors ok"), readings + 1, "F5 reads the connections again, as the bar's Refresh does");
// And by a finger: the list pulled down at its top, and let go.
d.ui.Pointer(PointerPhase::Down, {200, 300}, d.clock);
d.ui.Pointer(PointerPhase::Move, {200, 380}, d.clock + 100);
Build(d);
Shows(d.ui, "Pull down to refresh", "a list dragged down at its top says what that is for");
d.ui.Pointer(PointerPhase::Move, {200, 460}, d.clock + 200);
Build(d);
Shows(d.ui, "Let go to refresh", "and when it is far enough down");
d.ui.Pointer(PointerPhase::Up, {200, 460}, d.clock + 300);
Settle(d);
Equal(Answers(d, "Connectors ok"), readings + 2, "let go, the connections are read again");
Hides(d.ui, "to refresh", "and the list is back where it was");
// The accounts could not be read from the bank: the library says so, once however often it happens.
for(std::int32_t i = 0; i < 2; i++) {
bunq.Fail(Fault{.method = "GET", .path = std::format("/user/{}/monetary-account", alice), .status = 500, .body = R"({"Error":[{"error_description":"Hiccup."}]})"});
Press(d, "bar.refresh");
}
Equal(Count(d, "bunq connector 'Alice' is unavailable"), std::size_t{1}, "the library's warning is shown, once");
Hides(d.ui, "Not working", "the connection itself answers again");
// A reading that is refused: what was known stays, and why it is no newer is said, under the warning before.
SetPolkit(bus, Fake::Polkit::Deny, Bus::actionView);
Press(d, "bar.refresh");
Shows(d.ui, "The accounts could not be read again", "a refresh that fails says so");
Shows(d.ui, "is unavailable", "beside what was said before");
Shows(d.ui, "Main", "and leaves what was known");
Press(d, "notes.dismiss");
Hides(d.ui, "is unavailable", "until they are sent away");
SetPolkit(bus, Fake::Polkit::Allow, Bus::actionView);
// A second refresh asked for while the first is under way waits for it, and is then made.
const std::size_t rounds = Answers(d, "Connectors ok");
Tap(d, "bar.refresh");
Tap(d, "bar.refresh");
Tap(d, "bar.refresh");
Settle(d);
Equal(Answers(d, "Connectors ok"), rounds + 2, "of readings asked for while one is under way, the last is made after it");
// nostrod's worker ends under the second of the two calls: the same.
SetPolkit(bus, Fake::Polkit::Slow, Bus::actionView);
std::size_t before = Answers(d, "Connectors ok");
Tap(d, "bar.refresh");
Check(RunUntil(d.loop, [&d, before] { return Answers(d, "Connectors ok") > before; }), "the connections are read");
kill(Worker(bus, nostrod), SIGTERM);
Settle(d);
Equal(d.answers.back(), std::string("Accounts failed"), "the accounts are not");
Shows(d.ui, "The accounts could not be read again", "which is said");
Press(d, "notes.dismiss");
// A connection is added between the two calls: both are read again, and then agree.
before = Answers(d, "Connectors ok");
Tap(d, "bar.refresh");
Check(RunUntil(d.loop, [&d, before] { return Answers(d, "Connectors ok") > before; }), "the connections are read");
other.AddBunq("key-bob", "*", "");
Settle(d);
Equal(Answers(d, "Connectors ok"), before + 2, "connections that changed while they were read are read again");
Shows(d.ui, "Bob's", "and what is shown is what there is");
// And once more while they are read again: the reading gives up, and says so.
before = Answers(d, "Connectors ok");
const auto viewChecks = [&bus] {
std::lock_guard lock(bus.mutex);
return std::ranges::count_if(bus.checks, [](const Fake::PolkitCheck& check) { return check.action == Bus::actionView; });
};
const std::ptrdiff_t viewed = viewChecks();
Tap(d, "bar.refresh");
Check(RunUntil(d.loop, [&d, before] { return Answers(d, "Connectors ok") > before; }), "the connections are read");
// Removing a connection looks it up first, for which nostrod asks polkit whether the caller may see: that is
// answered at once here, once the app's reading of the accounts is at polkit, which answers that a second
// later whatever it is set to meanwhile.
Check(RunUntil(d.loop, [&viewChecks, viewed] { return viewChecks() >= viewed + 2; }), "and the accounts are being read");
SetPolkit(bus, Fake::Polkit::Allow, Bus::actionView);
other.RemoveConnector("Bob");
SetPolkit(bus, Fake::Polkit::Slow, Bus::actionView);
Check(RunUntil(d.loop, [&d, before] { return Answers(d, "Connectors ok") > before + 1; }), "and read again");
other.AddBunq("key-bob", "*", "");
Settle(d);
Shows(d.ui, "connections kept changing", "connections that keep changing are given up on");
Press(d, "notes.dismiss");
SetPolkit(bus, Fake::Polkit::Allow, Bus::actionView);
other.RemoveConnector("Bob");
Press(d, "bar.refresh");
Hides(d.ui, "Bob's", "a connection removed elsewhere is gone after a refresh");
}
// One account: its payments by day, the search, the filter, more of them, and one of them looked at.
void Activity(Driver& d, Fake::Bunq& bunq, std::uint64_t alice, std::uint64_t main) {
// Oldest first, as a bank makes them.
const std::uint64_t card = bunq.AddPayment(main, -999, "", "", "", {{"created", "2026-09-03 10:00:00.000000"}, {"type", "MASTERCARD"}, {"sub_type", "PAYMENT"}});
const std::uint64_t salary = bunq.AddPayment(main, 50000, "Employer", strangerIban, "salary", {{"created", "2026-09-30 08:00:00.000000"}, {"type", "EBA_SCT"}, {"sub_type", "SCT"}});
const std::uint64_t lunch = bunq.AddPayment(main, -1250, "Bob", bobIban, "lunch");
const std::string page = std::format("account:{}", aliceMain);
Press(d, "bar.refresh");
Press(d, std::format("account.{}", aliceMain));
Equal(d.app.Screen(), page, "a row leads to its account");
Shows(d.ui, "€1,477.51", "its balance");
Shows(d.ui, GroupIban(aliceMain), "its IBAN");
Tap(d, "account.copy");
Check(d.ui.Take().copy == std::optional<std::string>(aliceMain), "which can be copied");
Shows(d.ui, "IBAN copied", "and says so");
for(const std::string_view said : {"Today", "Bob", "lunch", "-€12.50", "12:00", "Yesterday", "Employer", "salary", "+€500.00", "Thursday 3 September", "Card payment", "-€9.99"}) {
Shows(d.ui, said, "the payments are listed by day");
}
const std::size_t readings = Answers(d, "Transactions ok");
d.ui.KeyDown(Key::R, {.control = true});
Settle(d);
Equal(Answers(d, "Transactions ok"), readings + 1, "Ctrl+R reads the account's payments again");
d.ui.KeyDown(Key::F, {.control = true});
Build(d);
Equal(d.ui.Focused(), std::string_view("search"), "Ctrl+F goes to the search");
d.ui.Focus({});
Press(d, Row(d, std::format("tx.{}.", lunch)));
Equal(d.app.Screen(), std::format("{}+transaction", page), "a payment opens");
for(const std::string& said : {std::string("To"), std::string("Bob"), GroupIban(bobIban), std::string("Description"), std::string("1 October 2026, 12:"), std::string("Payment within the bank"), std::string("Bank's number")}) {
Shows(d.ui, said, "with all of it");
}
Shows(d.ui, "Press a line to copy it", "and says how a line of it is taken along");
Tap(d, "copy.IBAN");
Check(d.ui.Take().copy == std::optional<std::string>(bobIban), "a press on the IBAN copies it, without the spaces it is read with");
Shows(d.ui, "Copied", "and says so");
Check(d.ui.LongPress("copy.Description") && d.ui.Take().copy == std::optional<std::string>("lunch"), "a long press on a line copies it as it is shown");
Tap(d, "detail.close");
Equal(d.app.Screen(), page, "and closes");
Tap(d, Row(d, std::format("tx.{}.", card)));
Check(!Has(d, "detail.pay") && !Has(d, "detail.request"), "a payment to nobody known cannot be made again");
Shows(d.ui, "Card payment", "its kind is said in words");
TapBeside(d);
Equal(d.app.Screen(), page, "a tap beside it closes it too");
Tap(d, Row(d, std::format("tx.{}.", salary)));
Shows(d.ui, "From", "money that came in is from someone");
Shows(d.ui, "Bank transfer", "by a transfer");
Tap(d, "detail.pay");
Equal(d.app.Screen(), std::string("pay"), "paying again opens the form");
for(const std::string_view said : {std::string_view(strangerIban), std::string_view("Employer"), std::string_view("500.00"), std::string_view("salary")}) {
Shows(d.ui, said, "filled in from the payment");
}
Tap(d, "bar.back");
Tap(d, Row(d, std::format("tx.{}.", salary)));
Tap(d, "detail.request");
Equal(d.app.Screen(), std::string("request"), "asking back opens the other form");
Shows(d.ui, strangerIban, "filled in too");
d.ui.KeyDown(Key::Escape, {});
Build(d);
Equal(d.app.Screen(), page, "Escape goes back");
// The search looks through what nostrod has stored of the list that is shown: with every letter typed, at
// once, and without a call to the bank.
const std::string listing = std::format("/user/{}/monetary-account/{}/payment", alice, main);
const std::size_t asked = Answers(d, "Transactions ok");
const std::size_t fetched = bunq.Count("GET", listing);
Type(d, "search", "lun");
Check(d.app.Busy(), "what is typed is looked for at once");
Settle(d);
Equal(Answers(d, "Transactions ok"), asked + 1, "nostrod is asked, once");
Equal(bunq.Count("GET", listing), fetched, "and the bank is not: the list was read from it when it was shown");
Shows(d.ui, "lunch", "what matches is listed");
Hides(d.ui, "salary", "what does not is not");
Retype(d, "search", "sal");
Settle(d);
Shows(d.ui, "salary", "each change of what is typed is looked for");
d.ui.KeyDown(Key::Enter, {});
Settle(d);
Retype(d, "search", "nothing like it");
Settle(d);
Shows(d.ui, "Nothing matches", "a search without a match says so");
Equal(bunq.Count("GET", listing), fetched, "none of which asked the bank, Enter neither");
// A search typed while the list is being read again waits for that, and is then looked for in what it brought.
Tap(d, "bar.refresh");
Retype(d, "search", "lun");
Settle(d);
Shows(d.ui, "lunch", "a search behind a reading is answered after it");
Equal(bunq.Count("GET", listing), fetched + 1, "and only the reading asked the bank");
Retype(d, "search", "");
Settle(d);
// The filter: an exact amount paid or received, and between which days.
Tap(d, "filter");
Equal(d.app.Screen(), std::format("{}+filter", page), "the filter opens over the list");
Type(d, "filter.amount", "1,234");
Shows(d.ui, "At most 2 decimals", "a mistake is said where it is");
Check(!d.ui.Find("filter.show")->enabled, "and nothing can be shown by it");
Retype(d, "filter.amount", "12,50");
Press(d, "filter.show");
Equal(d.app.Screen(), page, "showing closes it");
Shows(d.ui, "Paid €12.50", "what is asked for is said above the list");
Shows(d.ui, "lunch", "the payment of that amount is listed");
Hides(d.ui, "salary", "and no other");
Tap(d, "filter");
Tap(d, "filter.direction.1");
Press(d, "filter.show");
Shows(d.ui, "Received €12.50", "the same amount coming in");
Shows(d.ui, "Nothing matches", "matches nothing");
Tap(d, "filter");
Retype(d, "filter.amount", "");
Type(d, "filter.from", "2026-09-30");
Type(d, "filter.to", "2026-09-30");
Press(d, "filter.show");
Shows(d.ui, "From 30 Sep", "a day's payments");
Shows(d.ui, "Until 30 Sep", "from its start to its end");
Shows(d.ui, "salary", "are that day's");
Hides(d.ui, "lunch", "and no other day's");
Tap(d, "filter");
TapBeside(d);
Equal(d.app.Screen(), page, "a tap beside the filter leaves it as it was");
Shows(d.ui, "From 30 Sep", "with what it asked for");
Tap(d, "filter");
Press(d, "filter.clear");
Shows(d.ui, "lunch", "clearing it shows everything again");
Hides(d.ui, "From 30 Sep", "and says nothing above the list");
// More than the hundred that are asked for at first. What the bank has had since the list was read is not in
// what nostrod has stored, so a search does not find it until the list is read again.
for(std::int32_t i = 0; i < 120; i++) {
bunq.AddPayment(main, -100, "Shop", strangerIban, std::format("item {}", i));
}
Retype(d, "search", "item 7");
Settle(d);
Shows(d.ui, "Nothing matches", "a payment made since the list was read is not found by a search");
Press(d, "bar.refresh");
Shows(d.ui, "item 7", "until the list is read again, which asks the bank and keeps the search");
Retype(d, "search", "");
Settle(d);
Bottom(d);
Check(Has(d, "more"), "a list as long as was asked for may go on");
Hides(d.ui, "lunch", "and does not reach the older payments yet");
const std::size_t before = bunq.Count("GET", listing);
Press(d, "more");
Bottom(d);
Shows(d.ui, "Thursday 3 September", "more of it reaches them");
Equal(bunq.Count("GET", listing), before, "from what nostrod has stored: the bank is not asked for older payments again");
Check(!Has(d, "more"), "and a list shorter than was asked for is at its end");
Top(d);
// The bank refuses the reading: it can be tried again.
const Fault hiccup{.method = "GET", .path = listing, .status = 500, .body = R"({"Error":[{"error_description":"Hiccup."}]})"};
bunq.Fail(hiccup);
Press(d, "bar.refresh");
Shows(d.ui, "The bank refused", "a reading the bank refused is said");
Shows(d.ui, "Hiccup.", "with what it said");
Press(d, "activity.problem.action");
Shows(d.ui, "Shop", "and can be tried again");
// Where no list is shown there is nothing stored to look through that was just read: a search goes to the bank,
// which counts its calls, so it waits for the typing to stop, or for Enter.
bunq.Fail(hiccup);
Press(d, "bar.refresh");
Shows(d.ui, "The bank refused", "a list that could not be read");
const std::size_t tried = bunq.Count("GET", listing);
Type(d, "search", "sal");
Check(!d.app.Busy(), "a letter typed asks nothing yet");
d.clock += 399;
d.ui.Tick(d.clock);
Check(!d.app.Busy(), "nor does the wait that is not over");
d.clock += 1;
d.ui.Tick(d.clock);
Settle(d);
Equal(bunq.Count("GET", listing), tried + 1, "once the typing has stopped the bank is asked, once");
Shows(d.ui, "salary", "and what matches is listed");
bunq.Fail(hiccup);
Press(d, "bar.refresh");
Retype(d, "search", "lun");
Check(!d.app.Busy(), "again nothing is asked while it is typed");
d.ui.KeyDown(Key::Enter, {});
Settle(d);
Shows(d.ui, "lunch", "Enter asks at once");
d.clock += 1000;
d.ui.Tick(d.clock);
Check(!d.app.Busy() && bunq.Count("GET", listing) == tried + 3, "and the wait that was running is dropped");
Retype(d, "search", "");
Settle(d);
Tap(d, "bar.back");
Equal(d.app.Screen(), std::string("accounts"), "the way back leads to the accounts");
}
// Paying: the form and what it refuses, the account picker, the button that sends it with no question of the app's
// own, and each kind of payment made.
void Paying(Driver& d, Fake::Bus& bus, Fake::Bunq& bunq) {
const std::string page = std::format("account:{}", aliceMain);
Tap(d, "home.pay");
Equal(d.app.Screen(), std::string("pay"), "paying starts from the accounts");
Shows(d.ui, "Main", "from the first account");
Equal(d.ui.Find("pay.submit")->label, std::string("Pay"), "the form's button says what it does");
Tap(d, "pay.submit");
Shows(d.ui, "An IBAN, an e-mail address or a phone number", "a form without a payee says so");
Shows(d.ui, "Enter an amount", "and one without an amount");
Check(d.app.Screen() == "pay" && !d.app.Changing(), "and sends nothing");
Type(d, "pay.to", "NL23 BUNQ");
Shows(d.ui, "Not a valid IBAN", "an IBAN that is not one yet is said");
Retype(d, "pay.to", bobIban);
Shows(d.ui, "IBAN", "what kind of address it is is said under it");
Shows(d.ui, "The name of the account's holder", "an IBAN needs a name");
Type(d, "pay.name", "Bob");
Type(d, "pay.amount", "12,50");
Type(d, "pay.description", "lunch");
Hides(d.ui, "Enter an amount", "the errors go as they are mended");
// Which account pays.
Tap(d, "pay.from");
Equal(d.app.Screen(), std::string("pay+accounts"), "the paying account is chosen from a list");
Shows(d.ui, "Play money", "of every account");
Tap(d, std::format("pick.{}", aliceSavings));
Equal(d.app.Screen(), std::string("pay"), "choosing closes it");
Shows(d.ui, "Savings", "and the form pays from the chosen one");
Tap(d, "pay.from");
TapBeside(d);
Equal(d.app.Screen(), std::string("pay"), "a tap beside the list closes it");
Shows(d.ui, "Savings", "and changes nothing");
Tap(d, "pay.from");
Tap(d, std::format("pick.{}", aliceMain));
// The button sends it, by the keyboard here: the app asks nothing in between, since the system's password
// dialog is what confirms a payment. So the button must not be reached a second time while that is under way.
SetPolkit(bus, Fake::Polkit::Password, Bus::actionPay);
const std::size_t before = bunq.Count("POST", "/user/");
Build(d);
d.ui.Focus("pay.submit");
d.ui.KeyDown(Key::Enter, {});
d.ui.KeyDown(Key::Enter, {});
Build(d);
Equal(d.app.Screen(), std::string("pay+working"), "a form filled in is sent by its button, with no review of the app's own");
Shows(d.ui, "Paying €12.50 to Bob", "the payment under way is shown");
Shows(d.ui, "Confirm it in your system's password dialog.", "with where to confirm it");
Check(d.app.Changing(), "and is a change under way");
d.ui.KeyDown(Key::Enter, {});
d.ui.KeyDown(Key::Space, {});
d.ui.KeyDown(Key::Escape, {});
Check(!d.ui.Tap("pay.submit") && !d.ui.Tap("bar.back") && d.ui.Focused().empty(), "under which the form is out of reach: of a finger, and of the key that sent it");
Check(!d.app.Navigate("cards") && d.app.Screen() == "pay+working", "nor is the screen left by name while it is under way");
Check(!d.app.Open(shopLink) && d.app.Screen() == "pay+working", "or for a link that asks for another payment");
Settle(d);
Shows(d.ui, "Paid €12.50 to Bob", "the payment made is said");
Check(Has(d, "copy.Payment") && !Test::Says(d.ui, "Press a line to copy it"), "with the bank's number of it, which can be copied without a word about it");
Equal(Action(bus), std::string(Bus::actionPay), "after the password for paying");
Equal(bunq.Count("POST", "/user/"), before + 1, "and was made once, however often Enter was pressed");
Press(d, "done.close");
Equal(d.app.Screen(), std::string("accounts"), "which leads back to where paying began");
Tap(d, "home.pay");
Hides(d.ui, "lunch", "with the form empty for the next one");
// To an e-mail address, which needs no name, on a schedule.
Type(d, "pay.to", "bob@example.org");
Shows(d.ui, "E-mail address", "an e-mail address is known for one");
Type(d, "pay.amount", "5");
Tap(d, "pay.when.1");
Check(Has(d, "pay.day") && Has(d, "pay.time") && !Has(d, "pay.every"), "a schedule asks for its first day");
Bottom(d);
Equal(d.ui.Find("pay.submit")->label, std::string("Schedule"), "and its button says that it schedules");
Tap(d, "pay.submit");
Shows(d.ui, "A day: YYYY-MM-DD", "which it needs");
Check(!d.app.Changing(), "before anything is sent");
Type(d, "pay.day", "2026-10-02");
Type(d, "pay.time", "09:30");
Bottom(d);
Tap(d, "pay.unit.3");
Bottom(d);
Check(Has(d, "pay.every") && Has(d, "pay.until"), "one that repeats asks how often and until when");
Type(d, "pay.every", "2");
Type(d, "pay.until", "2027-01-01");
Bottom(d);
Tap(d, "pay.submit");
Shows(d.ui, "Scheduling €5.00 to bob@example.org", "a schedule is sent as one");
Shows(d.ui, "Confirm it in your system's password dialog.", "to confirm like a payment");
Settle(d);
Shows(d.ui, "Scheduled €5.00 to bob@example.org", "and made");
Shows(d.ui, "Every 2 weeks from 2 Oct, 09:30", "with when it runs");
Shows(d.ui, "until 1 Jan 2027", "and until when");
Equal(Action(bus), std::string(Bus::actionPay), "after the password for paying");
Press(d, "done.close");
// A draft: made now, paid once someone accepts it. Making one is a change, and is confirmed like any.
Tap(d, "home.pay");
Type(d, "pay.to", "+31612345678");
Shows(d.ui, "Phone number", "a phone number is known for one");
Type(d, "pay.amount", "2");
Tap(d, "pay.when.2");
Shows(d.ui, "A draft is paid once it is accepted", "what a draft is is said");
Bottom(d);
Equal(d.ui.Find("pay.submit")->label, std::string("Save as draft"), "and the button says that it saves one");
Tap(d, "pay.submit");
Shows(d.ui, "Saving a draft of €2.00 to +31612345678", "a draft is saved from the form's button, with no question of the app's before it");
Shows(d.ui, "Confirm it in your system's password dialog.", "and confirmed where every change is");
Settle(d);
Shows(d.ui, "Drafted €2.00 to +31612345678", "and is made");
Shows(d.ui, "It is paid once it is accepted", "with what that means");
Equal(Action(bus), std::string(Bus::actionChange), "as a change that moves no money");
Press(d, "done.close");
// What can go wrong with a payment, each said for what it is.
Press(d, std::format("account.{}", aliceMain));
Tap(d, "account.pay");
Shows(d.ui, "Main", "paying from an account's own page pays from it");
Type(d, "pay.to", bobIban);
Type(d, "pay.name", "Bob");
Type(d, "pay.amount", "1");
const auto refused = [&](std::string_view title, std::string_view detail, Where where = Where::current()) {
Press(d, "pay.submit", where);
Shows(d.ui, title, "the payment's failure has a name", where);
Shows(d.ui, detail, "and is explained", where);
Equal(d.app.Screen(), std::string("pay+problem"), "over the form", where);
};
SetPolkit(bus, Fake::Polkit::Dismiss, Bus::actionPay);
refused("Not confirmed", "Nothing was done");
Press(d, "problem.close");
Shows(d.ui, bobIban, "the form is still as it was filled in");
SetPolkit(bus, Fake::Polkit::Deny, Bus::actionPay);
refused("Not allowed", "the system's policy does not allow");
TapBeside(d);
Equal(d.app.Screen(), std::string("pay"), "a tap beside the explanation closes it");
SetPolkit(bus, Fake::Polkit::Absent, Bus::actionPay);
refused("Not allowed", "Nothing was done");
Press(d, "problem.close");
SetPolkit(bus, Fake::Polkit::Password, Bus::actionPay);
bunq.Fail(Fault{.method = "POST", .path = "/user/", .status = 400, .body = R"({"Error":[{"error_description":"Not enough money."}]})"});
refused("The bank refused", "Not enough money.");
Check(!Has(d, "problem.activity"), "a refusal leaves nothing to look for");
Press(d, "problem.close");
// bunq's 5xx leaves open whether it paid: that is said, the activity is offered, and trying again is not.
bunq.Fail(Fault{.method = "POST", .path = "/user/", .status = 500, .body = R"({"Error":[{"error_description":"Hiccup."}]})"});
refused("It may have been paid", "at the account's activity before trying again.");
Check(Has(d, "problem.activity") && !Has(d, "problem.draft"), "the account's activity is a press away");
Press(d, "problem.activity");
Equal(d.app.Screen(), page, "which shows the account");
Shows(d.ui, "Today", "and its payments");
Tap(d, "bar.back");
// A link that asks for a payment, while no account is chosen for links to start from: its form starts from
// the first account that pays anyone, which the bank lists the savings as, whichever account paid last. Which
// account pays is the first thing asked, over the form, and a tap beside the question keeps that one.
Tap(d, "home.pay");
Shows(d.ui, "Main", "the pay form pays from the account that paid last");
Tap(d, "bar.back");
Check(d.app.Open(shopLink), "a link is taken");
Build(d);
Equal(d.app.Screen(), std::string("pay+accounts"), "and opens the pay form, with the choice of the account that pays over it");
Shows(d.ui, "Choose an account", "which asks for one");
Check(Has(d, std::format("pick.{}", aliceMain)) && Has(d, std::format("pick.{}", aliceSavings)), "of every account there is");
Check(!d.ui.Tap("pay.submit") && !d.ui.Tap("bar.back"), "and covers the form, its button too");
TapBeside(d);
Equal(d.app.Screen(), std::string("pay"), "a tap beside it leaves the form");
Shows(d.ui, "Savings", "paying from the first account, where none was chosen for links to start from");
Hides(d.ui, "Main", "not from the one the form paid from last");
Tap(d, "pay.from");
Tap(d, std::format("pick.{}", aliceMain));
Tap(d, "bar.back");
Equal(d.app.Screen(), std::string("accounts"), "the way back from it leads to the accounts");
}
// Asking for money, and the request sent looked at and revoked.
void Requesting(Driver& d, Fake::Bus& bus, Fake::Bunq& bunq) {
const std::string page = std::format("account:{}", aliceMain);
Tap(d, "home.request");
Equal(d.app.Screen(), std::string("request"), "asking starts from the accounts");
Bottom(d);
Shows(d.ui, "Your bank asks them where it can reach them", "what asking does is said on the form");
const Region* submit = d.ui.Find("request.submit");
Check(submit != nullptr && submit->label == "Ask", "whose button is named for what it does");
Tap(d, "request.submit");
Shows(d.ui, "Enter an amount", "a form that is empty says what it lacks");
Equal(d.app.Screen(), std::string("request"), "and asks nostrod nothing");
Top(d);
Tap(d, "request.into");
Tap(d, std::format("pick.{}", aliceMain));
Type(d, "request.from", bobIban);
Tap(d, "request.submit");
Shows(d.ui, "The name of the account's holder", "an IBAN needs a name here too");
Type(d, "request.name", "Bob");
Type(d, "request.amount", "5");
Type(d, "request.description", "back");
// The button sends what is filled in, as the pay form's does: there is no review of the app's own, since the
// system's password dialog is what confirms a request.
Bottom(d);
Tap(d, "request.submit");
Equal(d.app.Screen(), std::string("request+working"), "a request is sent by the form's button, with no question of the app's before it");
Shows(d.ui, "Asking Bob for €5.00", "the change under way is shown as what it is");
Shows(d.ui, "Confirm it in your system's password dialog.", "with where to confirm it");
Settle(d);
Shows(d.ui, "Asked Bob for €5.00", "the request is made");
Equal(Action(bus), std::string(Bus::actionChange), "as a change that moves no money");
Shows(d.ui, "https://bunq.me/t/", "with the link anyone can pay through");
const std::vector<std::string> said = d.ui.Shown().draw.Texts();
const std::string link = *std::ranges::find_if(said, [](const std::string& line) { return line.starts_with("https://bunq.me/"); });
Tap(d, "dialog.copy");
Check(d.ui.Take().copy == std::optional<std::string>(link), "which can be copied");
Shows(d.ui, "Link copied", "and says so");
Tap(d, "dialog.open");
Check(d.opened.size() == 1 && d.opened.back() == link, "or opened");
d.opens = false;
Tap(d, "dialog.open");
Shows(d.ui, "No browser could be opened", "and when it cannot be, that is said");
d.opens = true;
Press(d, "done.close");
Equal(d.app.Screen(), std::string("accounts"), "which leads back");
// A request that leaves open whether it was made is not left in its form either.
Tap(d, "home.request");
Type(d, "request.from", "+31612345678");
Type(d, "request.amount", "3");
bunq.Fail(Fault{.method = "POST", .path = "/user/", .status = 500, .body = R"({"Error":[{"error_description":"Hiccup."}]})"});
Bottom(d);
Tap(d, "request.submit");
Shows(d.ui, "Asking +31612345678 for €3.00", "someone asked by phone number is named by it");
Settle(d);
Shows(d.ui, "It may have been done", "a request without a clear answer may have been made");
Check(Has(d, "problem.activity"), "and the account is a press away");
Press(d, "problem.close");
Hides(d.ui, "+31612345678", "with its form emptied");
Tap(d, "bar.back");
// Dave pays a request of Alice's: it is listed as paid, with what was paid.
Client other = Client::System();
other.Request(aliceMain, daveIban, "Dave", 400, "owed");
SetPolkit(bus, Fake::Polkit::Password, Bus::actionPay);
other.RespondToRequest(daveIban, other.IncomingRequests(daveIban).front().id, true);
Press(d, std::format("account.{}", aliceMain));
Tap(d, "account.request");
Equal(d.app.Screen(), std::string("request"), "an account's own page asks into it");
Tap(d, "bar.back");
Press(d, "tabs.1");
Shows(d.ui, "Accepted · owed", "a request that was paid is listed as such");
Tap(d, Row(d, "request."));
Shows(d.ui, "Paid", "with what was paid");
Check(!Has(d, "detail.revoke"), "and nothing left to take back");
Tap(d, "detail.close");
Shows(d.ui, "Bob", "the request sent is listed");
Shows(d.ui, "Pending · back", "with how it stands");
const std::string row = Row(d, "request.", 1);
Tap(d, row);
Equal(d.app.Screen(), std::format("{}+request", page), "and opens");
Shows(d.ui, "€5.00 asked of Bob", "as what it is");
Check(Has(d, "dialog.copy") && Has(d, "detail.revoke"), "with its link, and a way to take it back");
Tap(d, "detail.revoke");
Equal(d.app.Screen(), std::format("{}+confirm", page), "taking it back is asked about first");
Shows(d.ui, "Revoke the request to Bob?", "by name");
Shows(d.ui, "Your system asks for your password", "and with where it is confirmed: no change is made without the password");
Tap(d, "confirm.no");
Equal(d.app.Screen(), page, "and can be thought better of");
Tap(d, row);
Tap(d, "detail.revoke");
Press(d, "confirm.yes");
Shows(d.ui, "Request revoked", "a revoked request is said");
Shows(d.ui, "Revoked · back", "and listed as such");
Equal(Action(bus), std::string(Bus::actionChange), "as a change");
Tap(d, row);
Check(!Has(d, "detail.revoke"), "what is revoked cannot be revoked again");
Tap(d, "detail.close");
Press(d, "tabs.0");
Tap(d, "bar.back");
}
// An account's other lists: what was asked of it, what is scheduled from it, and what waits to be accepted.
void Lists(Driver& d, Fake::Bus& bus, Fake::Bunq& bunq, std::uint64_t alice, std::uint64_t main) {
const std::string page = std::format("account:{}", aliceMain);
Client other = Client::System();
// Dave asks Alice for money, twice.
other.Request(daveIban, aliceMain, "Alice", 700, "rent");
other.Request(daveIban, aliceMain, "Alice", 800, "food");
Press(d, std::format("account.{}", aliceMain));
Press(d, "tabs.2");
Shows(d.ui, "Dave", "a request received is listed");
Shows(d.ui, "Pending · food", "with how it stands");
Shows(d.ui, "€8.00", "and what it asks");
Tap(d, Row(d, "incoming."));
Equal(d.app.Screen(), std::format("{}+incoming", page), "and opens");
Shows(d.ui, "Dave asks for €8.00", "as what it is");
Shows(d.ui, "Internal", "with its kind");
Check(d.ui.Find("detail.pay")->enabled, "it can be paid");
Tap(d, "detail.pay");
Shows(d.ui, "Pay €8.00 to Dave?", "paying it is asked about first");
Shows(d.ui, "Your system asks for your password", "and needs the password");
SetPolkit(bus, Fake::Polkit::Password, Bus::actionPay);
Tap(d, "confirm.yes");
Shows(d.ui, "Confirm it in your system's password dialog.", "which the wait says");
Settle(d);
Shows(d.ui, "Paid €8.00 to Dave", "a request paid is said");
Equal(Action(bus), std::string(Bus::actionPay), "after the password for paying");
Press(d, "done.close");
Equal(d.app.Screen(), page, "which leads back to the list");
Shows(d.ui, "Accepted · food", "where it is listed as paid");
Tap(d, Row(d, "incoming.", 1));
Tap(d, "detail.reject");
Shows(d.ui, "Reject the request from Dave?", "rejecting is asked about first");
Shows(d.ui, "Your system asks for your password", "and needs the password too, as every change does");
Press(d, "confirm.yes");
Shows(d.ui, "Request rejected", "a request rejected is said");
Shows(d.ui, "Rejected · rent", "and listed as such");
Equal(Action(bus), std::string(Bus::actionChange), "as a change that moves no money");
Tap(d, Row(d, "incoming.", 1));
Check(!Has(d, "detail.pay") && !Has(d, "detail.reject"), "what was answered cannot be answered again");
Tap(d, "detail.close");
// bunq names nobody for a payee it knows by an e-mail address or a phone number alone.
Press(d, "tabs.3");
Shows(d.ui, "Unknown", "the schedule made earlier is listed");
Shows(d.ui, "Active", "as running");
Tap(d, Row(d, "scheduled."));
Equal(d.app.Screen(), std::format("{}+scheduled", page), "and opens");
Shows(d.ui, "€5.00 to Unknown", "as what it is");
Tap(d, "detail.cancel");
Shows(d.ui, "Cancel the payments of €5.00 to Unknown?", "cancelling is asked about first");
Press(d, "confirm.yes");
Shows(d.ui, "Schedule cancelled", "a schedule cancelled is said");
Equal(Action(bus), std::string(Bus::actionChange), "as a change");
Shows(d.ui, "No payments are scheduled from this account", "and gone from the list");
// One that has run its course is listed, and has nothing left to cancel.
other.Schedule(aliceMain, bobIban, "Bob", 300, "rent", BunqSchedule{.start = ParseLocalDate("2026-10-02"), .unit = "MONTHLY"});
{
std::lock_guard lock(bunq.mutex);
bunq.schedules[main].front()["ScheduledPayment"]["status"] = "FINISHED";
}
Press(d, "bar.refresh");
Shows(d.ui, "Every month from 2 Oct", "a schedule made elsewhere is found by a refresh");
Tap(d, Row(d, "scheduled."));
for(const std::string_view said : {"€3.00 to Bob", "Finished", "Next", "IBAN", "Description", "rent"}) {
Shows(d.ui, said, "with all of it");
}
Check(!Has(d, "detail.cancel"), "what is over cannot be cancelled");
Tap(d, "detail.close");
Press(d, "tabs.4");
Shows(d.ui, "Pending · Alice", "the draft made earlier is listed, with who made it");
Shows(d.ui, "€2.00", "and its sum");
Tap(d, Row(d, "draft."));
Equal(d.app.Screen(), std::format("{}+draft", page), "and opens");
Shows(d.ui, "A draft of €2.00", "as what it is");
Tap(d, "detail.accept");
Shows(d.ui, "Accept the draft and pay €2.00?", "accepting is asked about first");
Press(d, "confirm.yes");
Shows(d.ui, "Draft accepted: €2.00 paid", "a draft accepted is said");
Equal(Action(bus), std::string(Bus::actionPay), "after the password for paying");
Press(d, "done.close");
other.Draft(aliceMain, bobIban, "Bob", 300, "gift");
Press(d, "bar.refresh");
Shows(d.ui, "Pending · Alice", "a draft made elsewhere is found by a refresh");
Tap(d, Row(d, "draft."));
Shows(d.ui, "€3.00 · gift", "with what it is for");
Tap(d, "detail.reject");
Shows(d.ui, "Reject the draft of €3.00?", "rejecting is asked about first");
Press(d, "confirm.yes");
Shows(d.ui, "Draft rejected", "a draft rejected is said");
Equal(Action(bus), std::string(Bus::actionChange), "as a change");
Tap(d, Row(d, "draft."));
Check(!Has(d, "detail.accept"), "what was answered cannot be answered again");
Tap(d, "detail.close");
// The bank refuses a list: it can be tried again, and is by coming back to it.
bunq.Fail(Fault{.method = "GET", .path = std::format("/user/{}/monetary-account/{}/draft-payment", alice, main), .status = 500, .body = R"({"Error":[{"error_description":"Hiccup."}]})"});
Press(d, "bar.refresh");
Shows(d.ui, "The bank refused", "a list the bank refused is said");
Press(d, "list.problem.action");
Shows(d.ui, "Rejected · Alice", "and can be tried again");
bunq.Fail(Fault{.method = "GET", .path = std::format("/user/{}/monetary-account/{}/draft-payment", alice, main), .status = 500, .body = R"({"Error":[{"error_description":"Hiccup."}]})"});
Press(d, "bar.refresh");
Shows(d.ui, "The bank refused", "a list that failed");
Press(d, "tabs.3");
Press(d, "tabs.4");
Shows(d.ui, "Rejected · Alice", "is read again when it is come back to");
// A draft of several payments is named by the first, and one of none by nobody.
{
std::lock_guard lock(bunq.mutex);
const json entry = bunq.drafts[main].front()["DraftPayment"]["entries"][0];
bunq.drafts[main].insert(bunq.drafts[main].begin(), json{{"DraftPayment", json{{"id", 990001}, {"status", "PENDING"}, {"entries", json::array({entry, entry})}}}});
bunq.drafts[main].insert(bunq.drafts[main].begin(), json{{"DraftPayment", json{{"id", 990002}, {"status", "CANCELLED"}, {"entries", json::array()}}}});
}
Press(d, "bar.refresh");
Shows(d.ui, "Bob and 1 more", "a draft of two payments");
Shows(d.ui, "€6.00", "sums them");
Shows(d.ui, "Cancelled", "and one of none is listed by its status alone");
Tap(d, "draft.990001");
Shows(d.ui, "A draft of €6.00", "and opens as their sum");
Check(Has(d, "copy.Bob") && Has(d, "copy.Bob.2"), "its two payments to one payee are two lines, each with a name of its own");
Tap(d, "copy.Bob.2");
Check(d.ui.Take().copy.value_or("").starts_with("€3.00"), "and each can be copied");
Tap(d, "detail.close");
Tap(d, "draft.990002");
Shows(d.ui, "A draft of €0.00", "as one of none opens as nothing");
Tap(d, "detail.close");
Press(d, "tabs.0");
Tap(d, "bar.back");
// An account nothing has happened on says so, list by list.
Press(d, std::format("account.{}", aliceSavings));
Shows(d.ui, "No payments yet", "an account without payments");
const std::array<std::string_view, 4> none = {"No requests sent from this account", "Nobody has asked this account for money", "No payments are scheduled from this account", "No draft payments wait for this account"};
for(std::size_t tab = 0; tab < none.size(); tab++) {
Tap(d, std::format("tabs.{}", tab + 1));
Check(Count(d, "No payments yet") == 0 && Has(d, "tabs.0"), "a list being read shows its place");
Settle(d);
Shows(d.ui, none[tab], "an empty list says what it would hold");
}
Tap(d, "tabs.0");
Tap(d, "bar.back");
}
// The cards: frozen and unfrozen, one bunq keeps as it is, and reported lost or stolen, which is asked twice.
void Cards(Driver& d, Fake::Bus& bus, Fake::Bunq& bunq, std::uint64_t alice) {
Tap(d, "nav.cards");
Check(d.app.Busy() && d.app.Screen() == "cards", "the cards are read when they are first looked at");
Settle(d);
Shows(d.ui, "No cards", "a user without cards");
const std::uint64_t card = bunq.AddCard(alice, "ACTIVE", json{{"label_monetary_account_current", json{{"iban", aliceMain}}}});
const std::uint64_t spare = bunq.AddCard(alice, "DEACTIVATED", json{{"primary_account_numbers", json::array({json{{"four_digit", "9876"}}})}, {"name_on_card", ""}, {"second_line", ""}, {"expiry_date", ""}, {"label_monetary_account_current", json{{"iban", strangerIban}}}});
// A virtual card, which the bank has as deactivated however well it pays.
const std::uint64_t number = bunq.AddCard(alice, "DEACTIVATED", json{{"order_status", "VIRTUAL_DELIVERY"}, {"primary_account_numbers", json::array({json{{"four_digit", "4321"}}})}});
Press(d, "bar.refresh");
for(const std::string_view said : {"Alice", "Mastercard debit •••• 1234", "J. Tester · until 11/30", "Active", "Mastercard debit •••• 9876", "Deactivated", "Mastercard debit •••• 4321", "Virtual"}) {
Shows(d.ui, said, "the cards are listed by connection");
}
Equal(Count(d, "Deactivated"), std::size_t{1}, "and a virtual card is not said to be deactivated, which the bank's word for it would have it");
const std::size_t readings = Answers(d, "Cards ok");
d.ui.KeyDown(Key::F5, {});
Settle(d);
Equal(Answers(d, "Cards ok"), readings + 1, "F5 reads the cards again");
Tap(d, std::format("card.{}", card));
Equal(d.app.Screen(), std::string("cards+card"), "a card opens");
for(const std::string_view said : {"Name on card", "J. Tester · Nostro", "Expires", "11/30", "Pays from"}) {
Shows(d.ui, said, "with what is on it");
}
Shows(d.ui, std::format("Main · {}", GroupIban(aliceMain)), "and the account it pays from, by name");
Equal(Line(d, "Status"), std::string("Active"), "its status as the bank reports it");
Equal(Line(d, "Order status"), std::string("Delivered to customer"), "and how far the bank is with the card itself");
Hides(d.ui, "Deactivated is what the bank reports", "with nothing to explain about a card that works");
Check(Has(d, "detail.freeze") && !Has(d, "detail.unfreeze") && Has(d, "detail.lost") && Has(d, "detail.stolen"), "a card in use can be frozen or reported");
Tap(d, "detail.freeze");
Shows(d.ui, "Freezing card •••• 1234", "freezing is under way at once");
Shows(d.ui, "Confirm it in your system's password dialog.", "and is confirmed there, as unfreezing is: the app freezes no card by itself");
Settle(d);
Shows(d.ui, "Card •••• 1234 is now Deactivated", "a frozen card is said");
Equal(Action(bus), std::string(Bus::actionChange), "as a change");
Equal(d.app.Screen(), std::string("cards"), "over the list");
// A card that was never activated: bunq answers with the card as it is, which is not as it was asked to be.
{
std::lock_guard lock(bunq.mutex);
bunq.cardsActivate = false;
}
SetPolkit(bus, Fake::Polkit::Password, Bus::actionUnfreezeCard);
Tap(d, std::format("card.{}", spare));
Check(!Has(d, "detail.freeze") && Has(d, "detail.unfreeze"), "a frozen card can be unfrozen");
Shows(d.ui, "Deactivated is what the bank reports", "a card the bank has as deactivated says what the bank means by that: frozen, or never activated");
Shows(d.ui, GroupIban(strangerIban), "an account that is not the user's is said by its IBAN");
Hides(d.ui, "Name on card", "and what a card lacks is left out");
Tap(d, "detail.unfreeze");
Shows(d.ui, "Confirm it in your system's password dialog.", "unfreezing needs the password");
Settle(d);
Shows(d.ui, "That did not work", "a card bunq kept as it was is said");
Shows(d.ui, "Your bank kept card", "as the bank having kept it");
Shows(d.ui, "once it has been activated", "with why it may have");
Equal(Action(bus), std::string(Bus::actionUnfreezeCard), "after the password for unfreezing");
Press(d, "problem.close");
{
std::lock_guard lock(bunq.mutex);
bunq.cardsActivate = true;
}
Tap(d, std::format("card.{}", card));
Press(d, "detail.unfreeze");
Shows(d.ui, "Card •••• 1234 is now Active", "a card unfrozen is said");
// Lost or stolen blocks a card for good, and is asked twice.
SetPolkit(bus, Fake::Polkit::Password, Bus::actionBlockCard);
Tap(d, std::format("card.{}", card));
Tap(d, "detail.lost");
Equal(d.app.Screen(), std::string("cards+confirm"), "reporting a card is asked about");
Shows(d.ui, "Report card •••• 1234 lost?", "by what it does");
Tap(d, "confirm.no");
Equal(d.app.Screen(), std::string("cards"), "and can be thought better of");
Tap(d, std::format("card.{}", card));
Tap(d, "detail.lost");
Tap(d, "confirm.yes");
Equal(d.app.Screen(), std::string("cards+confirm.again"), "and asked about again");
Shows(d.ui, "Block card •••• 1234 for good?", "in other words");
Tap(d, "confirm.no");
Equal(d.app.Screen(), std::string("cards"), "and thought better of again");
Tap(d, std::format("card.{}", card));
Tap(d, "detail.lost");
Tap(d, "confirm.yes");
Press(d, "confirm.yes");
Shows(d.ui, "Card •••• 1234 is now Lost", "a card reported lost is said");
Equal(Action(bus), std::string(Bus::actionBlockCard), "after the password for blocking");
Tap(d, std::format("card.{}", card));
Check(!Has(d, "detail.freeze") && !Has(d, "detail.unfreeze") && !Has(d, "detail.lost"), "a blocked card can be nothing else");
Tap(d, "detail.close");
Tap(d, std::format("card.{}", spare));
Tap(d, "detail.stolen");
Shows(d.ui, "Report card •••• 9876 stolen?", "a stolen card is reported the same way");
Tap(d, "confirm.yes");
Press(d, "confirm.yes");
Shows(d.ui, "Card •••• 9876 is now Stolen", "and said");
// A virtual card stands as that. The bank does not say whether one is frozen and leaves it as it is when asked
// to freeze or unfreeze it, so neither is offered; reporting it is, which the bank does do.
Tap(d, std::format("card.{}", number));
Shows(d.ui, "This is a virtual card.", "a virtual card says what it is");
Hides(d.ui, "Deactivated is what the bank reports", "and nothing about plastic");
Equal(Line(d, "Status"), std::string("Virtual"), "it stands as virtual, whatever the bank's word for it");
Check(!Has(d, "copy.Order status"), "with nothing more to say of how it was made");
Check(!Has(d, "detail.freeze") && !Has(d, "detail.unfreeze") && Has(d, "detail.lost") && Has(d, "detail.stolen"), "it can be reported, and not frozen or unfrozen");
const std::size_t changes = bunq.Count("PUT", "/user/");
Tap(d, "detail.lost");
Shows(d.ui, "Report card •••• 4321 lost?", "reporting it is asked about like any card's");
Tap(d, "confirm.yes");
Press(d, "confirm.yes");
Shows(d.ui, "Card •••• 4321 is now Lost", "and done");
Equal(bunq.Count("PUT", "/user/"), changes + 1, "by the one call to the bank");
Tap(d, std::format("card.{}", number));
Equal(Line(d, "Status"), std::string("Lost"), "after which it stands as the bank says: gone for good");
Hides(d.ui, "This is a virtual card.", "which is all there is to say of it");
Tap(d, "detail.close");
bunq.Fail(Fault{.method = "GET", .path = std::format("/user/{}/card", alice), .status = 500, .body = R"({"Error":[{"error_description":"Hiccup."}]})"});
Press(d, "bar.refresh");
Shows(d.ui, "The bank refused", "cards the bank refused to list are said");
Press(d, "cards.problem.action");
Shows(d.ui, "Lost", "and can be tried again");
// A card with a name and nothing under it, frozen without a clear answer: it may have been.
const std::uint64_t plain = bunq.AddCard(alice, "ACTIVE", json{{"primary_account_numbers", json::array({json{{"four_digit", "5555"}}})}, {"name_on_card", "A. Other"}, {"second_line", ""}});
std::uint64_t last = 0;
for(std::int32_t i = 0; i < 12; i++) {
last = bunq.AddCard(alice, "ACTIVE", json{{"primary_account_numbers", json::array({json{{"four_digit", std::format("{:04}", 7000 + i)}}})}});
}
Press(d, "bar.refresh");
Check(!Has(d, std::format("card.{}", last)), "of more cards than the window shows, those below it are not drawn");
Bottom(d);
Check(Has(d, std::format("card.{}", last)), "until they are scrolled to");
Top(d);
Tap(d, std::format("card.{}", plain));
Shows(d.ui, "A. Other", "a card with a name alone says the name");
bunq.Fail(Fault{.method = "PUT", .path = std::format("/user/{}/card", alice), .status = 500, .body = R"({"Error":[{"error_description":"Hiccup."}]})"});
Press(d, "detail.freeze");
Shows(d.ui, "It may have been done", "a card change without a clear answer may have been made");
Check(!Has(d, "problem.activity"), "which no account's activity would show");
Press(d, "problem.close");
Tap(d, "nav.accounts");
Tap(d, "nav.cards");
Check(!d.app.Busy(), "cards that are known are not read again by looking at them");
Tap(d, "nav.accounts");
}
// The settings: the account a pay link's form starts from, what the app is, and the connections, removed by name
// and, where two have one name, by number.
void Settings(Driver& d, Fake::Bus& bus, Fake::Bunq& bunq) {
Tap(d, "nav.settings");
for(const std::string_view said : {"Bank connections", "2 connected", "Pay links start from", "No account chosen", "About and security", "Nostro 1.2.3"}) {
Shows(d.ui, said, "the settings are listed");
}
Tap(d, "settings.about");
Equal(d.app.Screen(), std::string("about"), "what the app is has a page");
Shows(d.ui, "Nostro is a banking client for Linux", "which says so");
Shows(d.ui, "Nostro 1.2.3", "with its version");
Shows(d.ui, "GPL-3.0-only", "and its licence");
Hides(d.ui, "LGPL", "which is the app's own, not the library's");
Tap(d, "bar.back");
Tap(d, "settings.checkout");
Equal(d.app.Screen(), std::string("checkout"), "the account pay links start from has a page");
Shows(d.ui, "Pay links", "called after what it is for");
Shows(d.ui, "A shop's pay link opens Nostro", "which says what a pay link is");
Shows(d.ui, "choose another one", "and that the account is only where its form starts");
Shows(d.ui, "Play money", "and lists the accounts");
SetPolkit(bus, Fake::Polkit::Password, Bus::actionConnectors);
Tap(d, std::format("checkout.{}", aliceMain));
Shows(d.ui, "Having pay links start from Main", "choosing one is under way");
Shows(d.ui, "Confirm it in your system's password dialog.", "and needs the password");
Settle(d);
Shows(d.ui, "Pay links now start from Main", "the choice is said");
Equal(Action(bus), std::string(Bus::actionConnectors), "after the password for changing connections");
Equal(Summary(bus), std::format("have pay links start from {} (Main)", aliceMain), "which the system's dialog asked for in nostrod's words for it");
Tap(d, "bar.back");
Shows(d.ui, std::format("Main · {}", GroupIban(aliceMain)), "and shown in the settings");
Tap(d, "settings.connections");
Equal(d.app.Screen(), std::string("connections"), "the connections have a page");
for(const std::string_view said : {"bunq · Production · API key", "bunq · Sandbox · API key", "Working"}) {
Shows(d.ui, said, "which lists them");
}
const std::string dave = std::format("connection.Dave.{}", daveIban);
Tap(d, dave);
Equal(d.app.Screen(), std::string("connections+connection"), "a connection opens");
for(const std::string_view said : {"Bank", "Environment", "Sandbox", "Connected with", "Accounts", "Working"}) {
Shows(d.ui, said, "with what it is");
}
Equal(Line(d, "Bank"), std::string("bunq"), "its bank by the bank's own name");
Equal(Line(d, "Connected with"), std::string("API key"), "and the way it was connected");
Check(!Has(d, "copy.Pays"), "with nothing about what it can pay, which is anyone");
Tap(d, "detail.close");
Equal(d.app.Screen(), std::string("connections"), "and closes");
Tap(d, dave);
Tap(d, "detail.remove");
Shows(d.ui, "Remove Dave?", "removing it is asked about first");
Shows(d.ui, "The API key itself stays valid", "with what stays valid at its bank, by the way it was connected");
Tap(d, "confirm.no");
Equal(d.app.Screen(), std::string("connections"), "and can be thought better of");
const std::size_t reads = Answers(d, "DefaultCheckoutAccount ok");
Tap(d, dave);
Tap(d, "detail.remove");
Tap(d, "confirm.yes");
Shows(d.ui, "Removing Dave", "removing is under way");
Settle(d);
Shows(d.ui, "Removed Dave", "a connection removed is said");
Equal(Action(bus), std::string(Bus::actionConnectors), "after the password for changing connections");
Check(!Has(d, dave), "and no longer listed");
Tap(d, "bar.back");
Shows(d.ui, "1 connected", "one is left");
Equal(Answers(d, "DefaultCheckoutAccount ok"), reads + 1, "and the account pay links start from is read again: the connection may have held it");
// Two connections of one name: the one to remove is told apart by its accounts, and removed by its number.
Client other = Client::System();
other.AddBunq("key-alice-two", "*", "");
Tap(d, "nav.accounts");
Press(d, "bar.refresh");
Shows(d.ui, "Other", "a second Alice is connected");
Tap(d, "nav.settings");
Tap(d, "settings.connections");
const std::string second = std::format("connection.Alice.{}", otherAliceIban);
const std::string first = Row(d, "connection.Alice.") == second ? Row(d, "connection.Alice.", 1) : Row(d, "connection.Alice.");
Check(Has(d, second) && Has(d, first) && first != second, "each has a row of its own");
// The list cannot be read: nothing is removed.
Tap(d, second);
Tap(d, "detail.remove");
SetPolkit(bus, Fake::Polkit::Deny, Bus::actionView);
Press(d, "confirm.yes");
Shows(d.ui, "Not allowed", "a list that cannot be read is said");
Equal(d.app.Screen(), std::string("connections+problem"), "and removing stops there");
Press(d, "problem.close");
SetPolkit(bus, Fake::Polkit::Allow, Bus::actionView);
// It went meanwhile: which one is meant is no longer clear.
other.RemoveConnector("2");
Tap(d, second);
Tap(d, "detail.remove");
Press(d, "confirm.yes");
Shows(d.ui, "The connections changed", "a connection that went meanwhile is not guessed at");
Press(d, "problem.close");
Check(!Has(d, second), "and the list is read again");
other.AddBunq("key-alice-two", "*", "");
Tap(d, "bar.back");
Tap(d, "nav.accounts");
Press(d, "bar.refresh");
Tap(d, "nav.settings");
Tap(d, "settings.connections");
Tap(d, second);
Tap(d, "detail.remove");
Press(d, "confirm.yes");
Shows(d.ui, "Removed Alice", "the second of two is removed");
Check(!Has(d, second) && Has(d, first), "and the first is still there");
Tap(d, "bar.back");
Tap(d, "nav.accounts");
// A connection the bank does not answer for says so on its own sheet.
bunq.Fail(Fault{.method = "GET", .path = "/user/", .status = 500, .body = R"({"Error":[{"error_description":"Hiccup."}]})"});
Press(d, "bar.refresh");
Tap(d, "nav.settings");
Tap(d, "settings.connections");
Shows(d.ui, "Not working", "a connection that does not work is listed as such");
Tap(d, first);
Shows(d.ui, "Failing: the bank did not", "and says so when it is opened");
Tap(d, "detail.close");
Tap(d, "bar.back");
Tap(d, "nav.accounts");
Press(d, "bar.refresh");
}
// A connection through OAuth, and what bunq lets such a connection do.
void OAuth(Driver& d, Fake::Bus& bus, Fake::Bunq& bunq) {
Tap(d, "nav.settings");
Tap(d, "settings.connections");
Adding(d, "oauth");
Equal(d.app.Screen(), std::string("add:bunq:oauth"), "OAuth has a form of its own");
Bottom(d);
Tap(d, "oauth.continue");
Top(d);
for(const std::string_view said : {"The client id bunq gave the OAuth client", "registered with the client", "The client's secret"}) {
Shows(d.ui, said, "an empty form says what it lacks");
}
Type(d, "oauth.client", "someone-else");
Tap(d, "bar.back");
Tap(d, "way.oauth");
Hides(d.ui, "someone-else", "a form that was left is forgotten");
Type(d, "oauth.client", "fake-client");
Type(d, "oauth.redirect", "http://127.0.0.1/cb");
Type(d, "oauth.secret", "fake-secret");
Shows(d.ui, "Typed: 11 characters", "the secret is told by nothing of itself but how long it is");
Hides(d.ui, "fake-secret", "and never shown");
Bottom(d);
Tap(d, "oauth.environment.1");
Tap(d, "oauth.continue");
Check(d.app.OAuthState() == "state-1" && Has(d, "oauth.redirected"), "a form filled in leads to the address to approve at");
Tap(d, "oauth.open");
Check(d.opened.back().starts_with("https://oauth.sandbox.bunq.com/auth?") && d.opened.back().ends_with("state=state-1"), "which is the sandbox's when that was chosen");
// A code bunq does not know: nostrod's trade for a token is refused, and nothing is connected.
Type(d, "oauth.redirected", "http://127.0.0.1/cb?code=not-a-code&state=state-1");
Bottom(d);
Press(d, "oauth.connect");
Equal(d.app.Screen(), std::string("add:bunq:oauth+problem"), "a code bunq refuses connects nothing");
Press(d, "problem.close");
Bottom(d);
Tap(d, "oauth.restart");
Check(Has(d, "oauth.client") && !Has(d, "oauth.redirected"), "starting over shows the form again");
Shows(d.ui, "fake-client", "as it was filled in");
Bottom(d);
Tap(d, "oauth.environment.0");
Tap(d, "oauth.continue");
Shows(d.ui, "Open this address and approve the connection", "what to do with the address is said");
Tap(d, "oauth.open");
Check(d.opened.back().starts_with("https://oauth.bunq.com/auth?"), "the address is opened in the browser");
d.opens = false;
Tap(d, "oauth.open");
Shows(d.ui, "No browser could be opened", "or said not to have been");
d.opens = true;
Tap(d, "oauth.copy");
Check(d.ui.Take().copy == std::optional<std::string>(d.opened.back()), "or copied");
Shows(d.ui, "Address copied", "which is said");
Bottom(d);
Tap(d, "oauth.connect");
Shows(d.ui, "that address has no code= in it", "an address without a code is refused");
Type(d, "oauth.redirected", "http://127.0.0.1/cb?error=access_denied&error_description=Nope");
Bottom(d);
Tap(d, "oauth.connect");
Shows(d.ui, "bunq did not authorize", "bunq's refusal is said");
Retype(d, "oauth.redirected", "http://127.0.0.1/cb?code=code-carol&state=someone-elses");
Bottom(d);
Tap(d, "oauth.connect");
Shows(d.ui, "state differs): start again", "an answer to another request is refused");
Retype(d, "oauth.redirected", "http://127.0.0.1/cb?code=code-carol&state=state-1");
d.ui.KeyDown(Key::Enter, {});
Build(d);
Shows(d.ui, "Connecting to bunq", "the right address connects, by Enter too");
Settle(d);
Shows(d.ui, "Connected Carol", "a connection through OAuth is made");
Equal(Line(d, "Connected with"), std::string("OAuth"), "and said to be");
Equal(Action(bus), std::string(Bus::actionConnectors), "after the password for changing connections");
Press(d, "done.close");
Shows(d.ui, "Limited", "and marked in the list of accounts for what it cannot do, not for how it was made");
Shows(d.ui, "Shared", "with its account");
Tap(d, "nav.settings");
Tap(d, "settings.connections");
Shows(d.ui, "bunq · Production · OAuth", "the settings list it with its bank and its way");
Tap(d, std::format("connection.Carol.{}", carolIban));
Equal(Line(d, "Connected with"), std::string("OAuth"), "its sheet says how it is connected");
Equal(Line(d, "Pays"), std::string("Your own accounts only"), "and what that lets it pay");
Tap(d, "detail.remove");
Shows(d.ui, "The permission itself stays valid", "and removing it what stays valid at its bank");
Tap(d, "confirm.no");
Tap(d, "bar.back");
Tap(d, "nav.accounts");
// bunq lets it pay the user's own accounts only: a payment to anyone else can only be a draft.
const std::string page = std::format("account:{}", carolIban);
Press(d, std::format("account.{}", carolIban));
Shows(d.ui, "This account's connection pays between", "the account says what its connection can pay");
Tap(d, "account.pay");
Shows(d.ui, "A payment to anyone else", "the form says what becomes of a payment to anyone else");
Check(!d.ui.Find("pay.when.0")->enabled, "and offers no other way to pay");
Type(d, "pay.to", bobIban);
Type(d, "pay.name", "Bob");
Type(d, "pay.amount", "1");
Bottom(d);
Equal(d.ui.Find("pay.submit")->label, std::string("Save as draft"), "its button says that a payment to someone else is saved as a draft");
Press(d, "pay.submit");
Shows(d.ui, "Drafted €1.00 to Bob", "and it is made as one");
Equal(Action(bus), std::string(Bus::actionChange), "as a change that moves no money");
Press(d, "done.close");
// To one of the user's own it may pay, and when bunq refuses all the same a draft is offered.
Tap(d, "account.pay");
Type(d, "pay.to", aliceMain);
Type(d, "pay.name", "Alice");
Type(d, "pay.amount", "1");
Check(d.ui.Find("pay.when.0")->enabled, "a payment to an account of the user's own may be made at once");
Hides(d.ui, "A payment to anyone else", "and nothing is said against it");
Bottom(d);
Equal(d.ui.Find("pay.submit")->label, std::string("Pay"), "and its button pays");
bunq.Fail(Fault{.method = "POST", .path = "/user/", .status = 403, .body = R"({"Error":[{"error_description":"Not allowed for this user."}]})"});
Press(d, "pay.submit");
Shows(d.ui, "This connection cannot pay others", "bunq's refusal of it is said for what it is");
Check(Has(d, "problem.draft"), "and a draft is offered");
Press(d, "problem.draft");
Shows(d.ui, "Drafted €1.00 to Alice", "which a press saves, of what the form still holds");
Press(d, "done.close");
Equal(d.app.Screen(), page, "which leads back to the account");
// A request it received cannot be paid from here either.
Client other = Client::System();
other.Request(aliceMain, carolIban, "Carol", 300, "share");
Press(d, "tabs.2");
Tap(d, Row(d, "incoming."));
Check(Has(d, "detail.pay") && !d.ui.Find("detail.pay")->enabled && d.ui.Find("detail.reject")->enabled, "a request to an account through OAuth can be rejected, not paid");
Shows(d.ui, "A request cannot be paid from here", "and why is said");
Tap(d, "detail.close");
Press(d, "tabs.0");
Tap(d, "bar.back");
Tap(d, "nav.settings");
Tap(d, "settings.checkout");
Check(!d.ui.Find(std::format("checkout.{}", carolIban))->enabled && d.ui.Find(std::format("checkout.{}", aliceMain))->enabled, "nor can a pay link be set to start from it");
Shows(d.ui, "Pays your own accounts only", "which is said");
Tap(d, "bar.back");
Tap(d, "nav.accounts");
}
// A link that asks for a payment, as a website's pay button opens one. It fills in the pay form and does no more:
// whoever wrote it chose the payee and the amount, so nothing is sent before the user presses the form's button
// and the system's password dialog has said, in nostrod's own words, what is paid to whom.
void Linking(Driver& d, Fake::Bus& bus, Fake::Bunq& bunq) {
// One the app cannot read is said to be so over wherever the user is, with why, in the app's own words.
Check(d.app.Open("payto://iban/NL00MARK?message=MARK"), "a link that cannot be read is taken all the same");
Build(d);
Equal(d.app.Screen(), std::string("accounts+link"), "and said to be one, over the accounts");
Shows(d.ui, "This link cannot be opened", "by name");
Shows(d.ui, "The IBAN in it is not a valid one.", "with why");
Hides(d.ui, "MARK", "and with nothing of the link itself");
TapBeside(d);
Equal(d.app.Screen(), std::string("accounts"), "a tap beside it closes it");
Check(d.app.Navigate("cards"), "the cards");
Settle(d);
Check(d.app.Open("https://example.org/pay"), "any other address is no payment");
Build(d);
Equal(d.app.Screen(), std::string("cards+link"), "which is said over the place the user is at: nothing is gone to for it");
Shows(d.ui, "It is not a link to pay an IBAN", "with why");
Tap(d, "link.close");
Equal(d.app.Screen(), std::string("cards"), "and closed again");
// A link that can be read, from a page gone into: the pay form, filled in, and nothing asked or sent. Which
// account pays is asked first, over the form, with the one chosen for pay links to start from as what the
// form holds: Main, since the settings were gone through, which is not the account the bank lists first.
Tap(d, "nav.settings");
Tap(d, "settings.checkout");
Equal(d.app.Screen(), std::string("checkout"), "a page of the settings");
const std::size_t posts = bunq.Count("POST", "/user/");
const std::size_t changes = Changes(bus);
Check(d.app.Open(shopLink), "a link is taken from wherever the user is");
Build(d);
Equal(d.app.Screen(), std::string("pay+accounts"), "and opens the pay form, asking first which account pays");
Shows(d.ui, "Choose an account", "in a list of the accounts");
Check(Has(d, std::format("pick.{}", aliceMain)) && Has(d, std::format("pick.{}", aliceSavings)) && Has(d, std::format("pick.{}", carolIban)), "every one of them, whichever connection it is of");
Shows(d.ui, "A link filled this in, not you.", "the form under it says that a link filled it in");
for(const std::string_view said : {std::string_view(bobIban), std::string_view("Shop BV"), std::string_view("12.50"), std::string_view("Order 1234")}) {
Shows(d.ui, said, "with what the link said, in the form's own fields");
}
// The question covers the form, as any sheet covers its page: the form's button cannot be pressed through it,
// by a finger or by a key.
d.ui.KeyDown(Key::Enter, {});
d.ui.KeyDown(Key::Space, {});
Check(!d.ui.Tap("pay.submit") && !d.ui.Tap("bar.back") && !d.ui.Tap("pay.to"), "the form is out of reach until the account is settled");
Settle(d);
Check(d.app.Screen() == "pay+accounts" && bunq.Count("POST", "/user/") == posts && Changes(bus) == changes && !d.app.Changing(), "nothing is sent, and the user is asked for no password: a link fills in a form");
d.ui.KeyDown(Key::Escape, {});
Build(d);
Equal(d.app.Screen(), std::string("pay"), "Escape leaves the question");
Shows(d.ui, "Main", "and the form paying from the account chosen for pay links to start from");
Hides(d.ui, "Savings", "not from the first one");
Bottom(d);
Equal(d.ui.Find("pay.submit")->label, std::string("Pay"), "its button pays, as any pay form's does");
// The system's password dialog is where it is confirmed. Closed, nothing is paid, and the form is still the link's.
SetPolkit(bus, Fake::Polkit::Dismiss, Bus::actionPay);
Press(d, "pay.submit");
Equal(d.app.Screen(), std::string("pay+problem"), "the button sends it to that dialog, with no question of the app's own before it");
Shows(d.ui, "Not confirmed", "and a dialog closed is a payment not made");
Equal(bunq.Count("POST", "/user/"), posts, "of which the bank hears nothing");
Equal(Summary(bus), std::format("pay €12.50 to {} (Shop BV) from {} (Main)", bobIban, aliceMain), "the dialog said what the link asks for in nostrod's own words: the amount, the address before the name, and the account the form showed");
Press(d, "problem.close");
Top(d);
Shows(d.ui, "A link filled this in, not you.", "the form is still said to be a link's");
Shows(d.ui, "Order 1234", "and is as the link filled it in");
SetPolkit(bus, Fake::Polkit::Password, Bus::actionPay);
Bottom(d);
Press(d, "pay.submit");
Shows(d.ui, "Paid €12.50 to Shop BV", "confirmed there, it is paid");
Equal(Action(bus), std::string(Bus::actionPay), "after the password for paying");
Equal(bunq.Count("POST", "/user/"), posts + 1, "once");
const std::string sent = LastPayment(bunq);
Check(sent.contains(bobIban) && sent.contains("Shop BV") && sent.contains("12.50") && sent.contains("Order 1234"), "and the bank is sent what the form showed");
Press(d, "done.close");
Equal(d.app.Screen(), std::string("accounts"), "which leads to the accounts");
Tap(d, "home.pay");
Hides(d.ui, "A link filled this in", "the next pay form is nobody's but the user's");
Hides(d.ui, "Order 1234", "and empty");
Tap(d, "bar.back");
// An account picked from the choice a link opens with is the one that pays: the form shows it, and the
// system's dialog names it. A tap beside the choice, like Escape, keeps the one the form started from.
Check(d.app.Open(shopLink), "the link again");
Tap(d, std::format("pick.{}", aliceSavings));
Equal(d.app.Screen(), std::string("pay"), "an account picked there closes the choice");
Shows(d.ui, "Savings", "and is the one the form pays from");
Hides(d.ui, "Main", "in place of the one it started from");
Shows(d.ui, "A link filled this in, not you.", "which leaves the form a link's");
SetPolkit(bus, Fake::Polkit::Dismiss, Bus::actionPay);
Bottom(d);
Press(d, "pay.submit");
Equal(Summary(bus), std::format("pay €12.50 to {} (Shop BV) from {} (Savings)", bobIban, aliceSavings), "the dialog names the account that was picked");
SetPolkit(bus, Fake::Polkit::Password, Bus::actionPay);
Press(d, "problem.close");
Tap(d, "bar.back");
Check(d.app.Open(shopLink), "and again");
TapBeside(d);
Equal(d.app.Screen(), std::string("pay"), "a tap beside the choice closes it too");
Shows(d.ui, "Main", "with the account the form started from");
Tap(d, "bar.back");
// A link that says no more than who is paid: the rest is the user's to fill in, and the form is checked as any.
Check(d.app.Open(std::format("payto://iban/{}", bobIban)), "a link with an IBAN alone");
TapBeside(d);
Shows(d.ui, bobIban, "fills in who is paid");
Bottom(d);
Tap(d, "pay.submit");
Top(d);
Shows(d.ui, "The name of the account's holder", "and its form still lacks a name");
Shows(d.ui, "Enter an amount", "and an amount");
Check(!d.app.Changing() && bunq.Count("POST", "/user/") == posts + 1, "so nothing is sent");
Tap(d, "bar.back");
// A name with an & in it, which the system's dialog does not show as it is: the form and the bank have the
// link's name, and the dialog has it the way nostrod makes any name fit to show there, after the IBAN.
Check(d.app.Open(std::format("payto://iban/{}?amount=EUR:1&receiver-name=Fish%20%26%20Chips", bobIban)), "a link whose name has an &");
TapBeside(d);
Shows(d.ui, "Fish & Chips", "has that name on its form as the link has it");
Bottom(d);
Press(d, "pay.submit");
Shows(d.ui, "Paid €1.00 to Fish & Chips", "and is paid under it");
Equal(Summary(bus), std::format("pay €1.00 to {} (Fish + Chips) from {} (Main)", bobIban, aliceMain), "the dialog showed the name in nostrod's way, after the IBAN it shows whole");
Check(LastPayment(bunq).contains("Fish & Chips"), "and the bank is sent the name as the form had it");
Press(d, "done.close");
// From an account whose connection pays between the user's own accounts only, what a link asks for is saved as
// a draft, as anything paid to someone else from there is. The choice a link opens with offers that account
// too, as the form's own does.
Check(d.app.Open(shopLink), "the link again");
Tap(d, std::format("pick.{}", carolIban));
Shows(d.ui, "A payment to anyone else", "the form says what becomes of it from such an account");
Bottom(d);
Equal(d.ui.Find("pay.submit")->label, std::string("Save as draft"), "and its button that it saves a draft");
Press(d, "pay.submit");
Shows(d.ui, "Drafted €12.50 to Shop BV", "which it does");
Equal(Action(bus), std::string(Bus::actionChange), "as a change that moves no money");
Press(d, "done.close");
// A wide window has the app's places beside every page. A link's form left sideways is not opened again by
// itself, and when the user goes back to it, what it holds is still said to be a link's.
d.size = {0, 0, 1280, 800};
Check(d.app.Open(shopLink), "the link in a wide window");
Build(d);
Equal(d.app.Screen(), std::string("pay+accounts"), "opens its form there too, under the same question");
Check(!d.ui.Tap("nav.accounts") && !d.ui.Tap("pay.submit"), "which covers the places beside the form as well as the form");
TapBeside(d);
Equal(d.app.Screen(), std::string("pay"), "and is left by a tap beside it");
Press(d, "nav.accounts");
Press(d, "bar.refresh");
Equal(d.app.Screen(), std::string("accounts"), "the accounts read again do not bring it back");
Hides(d.ui, "A link asks for a payment", "and nothing waits");
Tap(d, "home.pay");
Shows(d.ui, "A link filled this in, not you.", "gone back to, the form is still said to be a link's");
Shows(d.ui, "Order 1234", "for as long as it holds what the link said");
Tap(d, "bar.back");
Tap(d, "home.pay");
Hides(d.ui, "A link filled this in", "which the way back empties it of");
Tap(d, "bar.back");
d.size = {0, 0, 400, 800};
Build(d);
}
// A link the app is started with is read before anything of the accounts is known: its form waits for them, and for
// which of them pay links start from, and the accounts' page says that it does.
void LinkWaiting(Fake::Bus& bus, sd_event* loop) {
{
Driver d(bus, loop);
d.app.Start();
Check(d.app.Open(shopLink), "a link is taken before the accounts are known");
Build(d);
Check(d.app.Busy() && d.app.Screen() == "accounts", "and waits for them, on the page they will be on");
Shows(d.ui, "A link asks for a payment.", "which says that it does");
Hides(d.ui, "Shop BV", "and nothing of what the link asks, which the form is for");
Settle(d);
Equal(d.app.Screen(), std::string("pay+accounts"), "its form opens once they are known, asking which of them pays");
Shows(d.ui, "A link filled this in, not you.", "as a link's");
Shows(d.ui, "Order 1234", "filled in");
TapBeside(d);
Equal(d.app.Screen(), std::string("pay"), "a tap beside the question leaves the form");
Shows(d.ui, "Main", "paying from the account pay links start from");
Hides(d.ui, "Savings", "which is not the first one");
Tap(d, "bar.back");
Hides(d.ui, "A link asks for a payment", "and the accounts' page has no more to say of it");
}
{
// The accounts known, and which of them pay links start from not: that is read first.
Driver d(bus, loop);
d.app.Start();
Settle(d);
Check(d.app.Open(shopLink), "a link is taken once the accounts are known");
Build(d);
Check(d.app.Busy() && d.app.Screen() == "accounts", "and waits to hear which of them pay links start from");
Shows(d.ui, "A link asks for a payment.", "saying so above the accounts");
Shows(d.ui, "Savings", "which are listed meanwhile");
Settle(d);
Equal(d.app.Screen(), std::string("pay+accounts"), "and then opens its form, with the question over it");
TapBeside(d);
Shows(d.ui, "Main", "which pays from that account when it is left as it is");
Hides(d.ui, "Savings", "and from no other");
}
{
// No system bus: the link waits until the accounts can be read, which is tried again by hand.
Driver d(bus, loop);
d.noBus = true;
d.app.Start();
Check(d.app.Open(shopLink), "a link is taken without a system bus");
Build(d);
Shows(d.ui, "The system bus cannot be reached", "which is said as ever");
Shows(d.ui, "A link asks for a payment.", "above the link that waits");
d.noBus = false;
Press(d, "overview.action");
Equal(d.app.Screen(), std::string("pay+accounts"), "a link whose accounts could not be read opens when they can be");
Shows(d.ui, "Order 1234", "as the link filled it in");
TapBeside(d);
Shows(d.ui, "Main", "from the account pay links start from, which is read with them");
Hides(d.ui, "Savings", "and not from the first");
}
{
// The user gone elsewhere while the accounts are read: what they are doing is not taken from them.
Driver d(bus, loop);
d.app.Start();
Check(d.app.Open(shopLink), "a link is taken");
Tap(d, "nav.cards");
Settle(d);
Equal(d.app.Screen(), std::string("cards"), "a user who went to another place meanwhile stays there");
Shows(d.ui, "The link's payment was not opened", "and is told that the link was not opened");
Tap(d, "nav.accounts");
Hides(d.ui, "A link asks for a payment", "the link is dropped");
Tap(d, "home.pay");
Hides(d.ui, "A link filled this in", "and nothing of it is in the pay form");
Hides(d.ui, "Order 1234", "which is empty");
}
{
// The user being told something when the accounts arrive: the form is not opened over that either.
Driver d(bus, loop);
d.app.Start();
Check(d.app.Open(shopLink) && d.app.Open("payto://iban/NL00MARK"), "a link that cannot be read, after one that waits");
Settle(d);
Equal(d.app.Screen(), std::string("accounts+link"), "is said to be one, and stays said");
Shows(d.ui, "This link cannot be opened", "by name");
Tap(d, "link.close");
Equal(d.app.Screen(), std::string("accounts"), "and the link that waited is not opened under it");
Tap(d, "home.pay");
Hides(d.ui, "Order 1234", "nor left in the pay form");
}
{
// The accounts known, and the system bus gone by the time the link comes: the reading of the account pay
// links start from fails at once, inside the call that opens the link. The form opens all the same, once.
Driver d(bus, loop);
d.app.Start();
Settle(d);
d.noBus = true;
bus.DisconnectOwn();
RunUntil(d.loop, [] { return false; }, std::chrono::seconds(1));
Check(d.app.Open(shopLink), "a link is taken with the accounts known and the system bus gone");
Build(d);
Equal(d.app.Screen(), std::string("pay+accounts"), "and opens its form from the accounts as they were known");
Hides(d.ui, "The link's payment was not opened", "which is not said to be unopened over its own form");
TapBeside(d);
Shows(d.ui, "Order 1234", "and is filled in as the link has it");
}
{
// Another user of the machine, who chose no account for pay links to start from, and whose first connection
// pays between their own accounts only: the form starts from the first account that pays anybody, which is
// their second connection's.
{
std::lock_guard lock(bus.mutex);
bus.clientUid = erinUid;
bus.logindNames[erinUid] = "erin";
}
Client erin = Client::System();
erin.AddBunqOAuth("production", "fake-client", "fake-secret", "http://127.0.0.1/cb", "code-carol-erin");
erin.AddBunq(daveKey, "*", "");
Driver d(bus, loop);
d.app.Start();
Check(d.app.Open(shopLink), "a link for a user who chose no account to start from");
Settle(d);
Equal(d.app.Screen(), std::string("pay+accounts"), "opens its form under the choice of their accounts");
Check(Has(d, std::format("pick.{}", carolIban)) && Has(d, std::format("pick.{}", daveIban)), "both of them");
TapBeside(d);
Shows(d.ui, "Play money", "and starts from the first account that pays anybody");
Hides(d.ui, "Shared", "which is not their first account: that one's connection pays their own accounts only");
{
std::lock_guard lock(bus.mutex);
bus.clientUid = uid;
}
}
}
// An account that goes while the app is looking at it: nostrod no longer knows it, and the app looks again.
void Vanishing(Driver& d, Fake::Bus& bus, Fake::Bunq& bunq) {
Client other = Client::System();
other.AddBunq(daveKey, "*", "");
Press(d, "bar.refresh");
const std::string page = std::format("account:{}", daveIban);
Press(d, std::format("account.{}", daveIban));
Tap(d, "account.request");
Tap(d, "bar.back");
Tap(d, "filter");
Equal(d.app.Screen(), std::format("{}+filter", page), "the filter is open over the account");
TapBeside(d);
// A payment from it that leaves open whether it was made, and the account gone before its activity is looked
// at: the way there leads nowhere.
Tap(d, "account.pay");
Type(d, "pay.to", bobIban);
Type(d, "pay.name", "Bob");
Type(d, "pay.amount", "1");
SetPolkit(bus, Fake::Polkit::Password, Bus::actionPay);
bunq.Fail(Fault{.method = "POST", .path = "/user/", .status = 500, .body = R"({"Error":[{"error_description":"Hiccup."}]})"});
Press(d, "pay.submit");
Shows(d.ui, "It may have been paid", "a payment without a clear answer");
Tap(d, "problem.close");
Hides(d.ui, bobIban, "is not left in its form to be sent again");
Type(d, "pay.to", bobIban);
Type(d, "pay.name", "Bob");
Type(d, "pay.amount", "1");
bunq.Fail(Fault{.method = "POST", .path = "/user/", .status = 500, .body = R"({"Error":[{"error_description":"Hiccup."}]})"});
Press(d, "pay.submit");
other.RemoveConnector("Dave");
d.app.Start();
Settle(d);
Tap(d, "problem.activity");
Equal(d.app.Screen(), std::string("accounts"), "the activity of an account that went is not gone to");
Hides(d.ui, "Play money", "and the account is no longer listed");
// Paying from an account that went: nostrod refuses, the app reads the connections again, and the form has
// no account until one is chosen.
other.AddBunq(daveKey, "*", "");
Press(d, "bar.refresh");
Press(d, std::format("account.{}", daveIban));
Tap(d, "account.pay");
Type(d, "pay.to", bobIban);
Type(d, "pay.name", "Bob");
Type(d, "pay.amount", "1");
other.RemoveConnector("Dave");
Press(d, "pay.submit");
Shows(d.ui, "That cannot be done", "a payment from an account that went is refused");
Shows(d.ui, "Nothing was sent.", "with nothing sent");
Press(d, "problem.close");
Equal(d.app.Screen(), std::string("pay"), "the form is still there");
Shows(d.ui, "Choose an account", "without an account to pay from");
Check(!d.ui.Find("pay.submit")->enabled, "and cannot be sent");
Tap(d, "pay.from");
Tap(d, std::format("pick.{}", aliceMain));
Check(d.ui.Find("pay.submit")->enabled, "until one is chosen");
Tap(d, "bar.back");
Equal(d.app.Screen(), std::string("accounts"), "and the page of the account that went is not gone back to");
// Looking at an account that went: its list says why not, and the app is back at the accounts.
other.AddBunq(daveKey, "*", "");
Press(d, "bar.refresh");
Press(d, std::format("account.{}", daveIban));
other.RemoveConnector("Dave");
const std::size_t failed = Answers(d, "Transactions failed");
Tap(d, "bar.refresh");
Check(RunUntil(d.loop, [&d, failed] { return Answers(d, "Transactions failed") > failed; }), "its payments cannot be read");
Build(d);
Shows(d.ui, "That cannot be done", "which is said");
Check(!Has(d, "activity.problem.action"), "with nothing to try again");
Settle(d);
Equal(d.app.Screen(), std::string("accounts"), "and the app is back at the accounts, without it");
}
// nostrod not answering in time: a reading is only late, a payment may have been made.
void Late(Fake::Bus& bus, sd_event* loop) {
Driver d(bus, loop);
d.timeout = std::chrono::seconds(1);
SetPolkit(bus, Fake::Polkit::Silent, Bus::actionView);
d.app.Start();
Build(d);
Check(d.app.Busy() && !Has(d, "overview.action"), "the first screen waits");
Check(d.app.Navigate("connections"), "the connections' page");
Build(d);
Check(d.app.Busy() && !Has(d, "overview.action"), "which waits too");
Settle(d);
Shows(d.ui, "No answer yet", "a reading that got no answer in time is said to be late");
Check(Has(d, "overview.action"), "there as on the first screen");
Press(d, "overview.action");
Shows(d.ui, "No answer yet", "and tried again from there, to the same end");
Tap(d, "bar.back");
Tap(d, "nav.accounts");
Shows(d.ui, "No answer yet", "where it is said too");
// The settings while the account pay links start from cannot be read.
SetPolkit(bus, Fake::Polkit::Deny, Bus::actionView);
Check(d.app.Navigate("settings"), "the settings");
Build(d);
Shows(d.ui, "…", "what is being read is waited for");
Settle(d);
Shows(d.ui, "Not allowed", "and what could not be read is said in its place");
Press(d, "settings.checkout");
Shows(d.ui, "Not allowed", "and on its own page");
SetPolkit(bus, Fake::Polkit::Allow, Bus::actionView);
Press(d, "checkout.problem.action");
Hides(d.ui, "Not allowed", "where it can be tried again");
Tap(d, "bar.back");
Tap(d, "nav.accounts");
Press(d, "overview.action");
Shows(d.ui, "Main", "as the accounts can");
SetPolkit(bus, Fake::Polkit::Silent, Bus::actionPay);
Tap(d, "home.pay");
Type(d, "pay.to", bobIban);
Type(d, "pay.name", "Bob");
Type(d, "pay.amount", "1");
Press(d, "pay.submit");
Shows(d.ui, "It may have been paid", "a payment that got no answer in time may have been made");
Check(Has(d, "problem.activity"), "and its account's activity is offered");
Press(d, "problem.close");
SetPolkit(bus, Fake::Polkit::Password, Bus::actionPay);
}
// The connection to the system bus breaks: what it carried fails, and the next thing asked connects again.
void Reconnecting(Fake::Bus& bus, sd_event* loop) {
Driver d(bus, loop);
d.app.Start();
Settle(d);
Shows(d.ui, "Main", "the accounts are read");
const std::int32_t connects = d.connects;
SetPolkit(bus, Fake::Polkit::Slow, Bus::actionView);
Tap(d, "bar.refresh");
Tap(d, "nav.cards");
const auto failures = [&d] { return std::ranges::count_if(d.answers, [](const std::string& answer) { return answer.ends_with("failed"); }); };
Equal(failures(), std::ptrdiff_t{0}, "two readings are under way");
bus.DisconnectOwn();
Check(RunUntil(d.loop, [&failures] { return failures() == 1; }), "the first of them fails with the connection");
Check(d.app.Busy(), "the second is still to fail");
// Asked for while the old connection's answers are still coming in: it fails like them.
Check(d.app.Navigate("settings"), "the settings");
Build(d);
Shows(d.ui, "That did not work", "what is asked meanwhile fails too");
Settle(d);
Equal(failures(), std::ptrdiff_t{2}, "and so does the second reading");
Equal(d.connects, connects, "no new connection was made yet");
SetPolkit(bus, Fake::Polkit::Allow, Bus::actionView);
Check(d.app.Navigate("accounts"), "the accounts");
Press(d, "bar.refresh");
Equal(d.connects, connects + 1, "the next thing asked connects again");
Shows(d.ui, "Main", "and is answered");
}
// The app given nothing but a connection: the system's clock, no desktop to open addresses, and no version.
void Bare(Fake::Bus& bus, sd_event* loop) {
Driver d(bus, loop, true);
d.app.Start();
Settle(d);
Shows(d.ui, "Main", "it lists the accounts all the same");
Tap(d, "home.request");
Equal(d.app.Screen(), std::string("request"), "asking from the start");
Shows(d.ui, "Into", "asks into the first account");
Tap(d, "bar.back");
Press(d, std::format("account.{}", aliceMain));
Hides(d.ui, "Today", "payments of October 2026 are not today's by the system's clock");
Tap(d, "bar.back");
Tap(d, "nav.settings");
Check(Count(d, "Nostro") == 1 && Count(d, "Nostro 1") == 0, "the settings name the app without a version");
Tap(d, "settings.about");
Shows(d.ui, "Nostro, © 2026 Catcrafts.", "and so does what it says of itself");
Tap(d, "bar.back");
Tap(d, "settings.connections");
Adding(d, "oauth");
Type(d, "oauth.client", "fake-client");
Type(d, "oauth.redirect", "http://127.0.0.1/cb");
Type(d, "oauth.secret", "fake-secret");
Bottom(d);
Tap(d, "oauth.continue");
const std::string_view state = d.app.OAuthState();
Check(state.size() == 32 && std::ranges::all_of(state, [](char c) { return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f'); }), "an OAuth request gets a state nobody can guess");
Check(Has(d, "oauth.open") && !d.ui.Find("oauth.open")->enabled && d.ui.Find("oauth.copy")->enabled, "and an address that can be copied where it cannot be opened");
}
// nostrod gone, and then the bus: a change says so, and nothing is sent.
void Gone(Driver& d, Fake::Bus& bus, pid_t nostrod) {
bus.Disconnect(busName);
Equal(Fake::Wait(nostrod), 0, "nostrod ends when the bus lets go of it");
Press(d, "bar.refresh");
Shows(d.ui, "The accounts could not be read again.", "accounts that cannot be read again are said");
Shows(d.ui, "Nostro's service is not running.", "with why, in a line");
Shows(d.ui, "Main", "and stay as they were known");
Press(d, "notes.dismiss");
Tap(d, "home.pay");
Type(d, "pay.to", bobIban);
Type(d, "pay.name", "Bob");
Type(d, "pay.amount", "1");
Press(d, "pay.submit");
Shows(d.ui, "Nostro's service is not running", "a payment without nostrod is not made, and says why");
Press(d, "problem.close");
Shows(d.ui, bobIban, "its form is still as it was filled in");
d.noBus = true;
bus.DisconnectOwn();
RunUntil(d.loop, [] { return false; }, std::chrono::seconds(1));
Press(d, "pay.submit");
Shows(d.ui, "The system bus cannot be reached", "nor is one without a system bus");
Shows(d.ui, "Connection refused", "which is said");
Check(!d.app.Changing(), "and is not under way");
}
// A wider window: the places, and where there is room the accounts themselves, down its side.
void Sizes(Driver& d) {
d.size = {0, 0, 1280, 800};
Build(d);
Check(Has(d, "side") && !Has(d, "nav") && Has(d, "nav.accounts") && Has(d, std::format("side.{}", aliceSavings)), "a wide window lists the places and the accounts down its side");
Press(d, std::format("side.{}", aliceSavings));
Equal(d.app.Screen(), std::format("account:{}", aliceSavings), "an account there leads to its page");
Check(Has(d, "side") && Has(d, "bar.back"), "beside which the list stays");
Press(d, std::format("side.{}", aliceMain));
Equal(d.app.Screen(), std::format("account:{}", aliceMain), "and another account is a press away");
Press(d, "nav.cards");
Equal(d.app.Screen(), std::string("cards"), "as is another place");
Tap(d, Row(d, "card."));
const Region* panel = d.ui.Find("dialog.panel");
Check(panel != nullptr && panel->box.w == 480 && panel->box.x == 400, "what is asked over a wide window is a dialog in its middle");
Tap(d, "detail.close");
Tap(d, "nav.settings");
Tap(d, "settings.about");
Check(Has(d, "side") && Has(d, "bar.back") && d.app.Screen() == "about", "a page of the settings has the places beside it too");
Tap(d, "bar.back");
// With the places beside it a form can be left sideways: a key typed into it goes with it all the same.
Tap(d, "settings.connections");
Adding(d, "key");
Type(d, "key.key", aliceKey);
Shows(d.ui, "Typed:", "a key is typed into its form");
Press(d, "nav.cards");
Tap(d, "nav.settings");
Tap(d, "settings.connections");
Adding(d, "key");
Equal(d.app.Screen(), std::string("add:bunq:key"), "the form, gone back to");
Hides(d.ui, "Typed:", "has not kept the key that was typed before it was left");
Tap(d, "nav.accounts");
d.size = {0, 0, 700, 800};
Build(d);
Check(Has(d, "side") && Has(d, "nav.settings") && !Has(d, std::format("side.{}", aliceSavings)), "a window in between lists the places alone");
d.size = {0, 0, 400, 800};
Build(d);
Check(!Has(d, "side") && Has(d, "nav"), "and a narrow one has them along its bottom");
}
// Places by name, for a command line and a debugger.
void Routes(Driver& d) {
for(const std::string_view place : {"cards", "settings", "accounts"}) {
Check(d.app.Navigate(place) && d.app.Screen() == place, std::format("{} is a place", place));
}
for(const std::string_view page : {"connections", "add", "add:bunq", "add:bunq:key", "add:bunq:oauth", "checkout", "about"}) {
Check(d.app.Navigate(page) && d.app.Screen() == page, std::format("{} is a page", page));
Settle(d);
Check(Has(d, "bar.back"), "with a way back");
Tap(d, "bar.back");
Equal(d.app.Screen(), std::string("settings"), "which leads to the settings");
}
for(const std::string_view nowhere : {"add:", "add:thrift", "add:thrift:key", "add:bunq:", "add:bunq:handshake", "add-key", "adding"}) {
Check(!d.app.Navigate(nowhere) && d.app.Screen() == "settings", std::format("{} is no step of adding a connection", nowhere));
}
const std::string account = std::format("account:{}", aliceMain);
Check(d.app.Navigate(account) && d.app.Screen() == account, "an account by its IBAN");
Settle(d);
Check(!d.app.Navigate("account:NL00NOPE") && !d.app.Navigate("nowhere") && d.app.Screen() == account, "and nothing else");
Check(d.app.Navigate("accounts"), "back to the start");
Settle(d);
}
}
int main(int argc, char* argv[]) {
// nostrod, and each of its workers, is this executable again.
if(Fake::IsNostrod()) {
Fake::Bunq::RedirectFromEnvironment();
return NostrodMain(argc, argv);
}
const Test::Directory directory("app");
const fs::path state = directory.path / "state";
// What nostrod reads from the environment is set before any thread starts, and so is the time zone the app words
// its days in.
setenv("TZ", "Europe/Amsterdam", 1);
tzset();
setenv("XDG_DATA_HOME", (directory.path / "data").c_str(), 1);
Fake::Bunq::ExportRedirect(port, directory.path / "bunq.pem");
setenv("DBUS_SYSTEM_BUS_ADDRESS", Fake::Bus::Address(directory.path / "bus").c_str(), 1);
Fake::Bus bus(directory.path / "bus");
{
std::lock_guard lock(bus.mutex);
bus.clientUid = uid;
bus.logindNames = {{uid, "alice"}};
}
Fake::Bunq bunq(port);
const std::uint64_t alice = bunq.AddPerson("Alice", aliceKey);
const std::uint64_t main = bunq.AddAccount(alice, aliceMain, "Main", 100000);
bunq.AddAccount(alice, aliceSavings, "Savings", 250000, "MonetaryAccountSavings");
bunq.AddAccount(bunq.AddPerson("Bob", "key-bob"), bobIban, "Bob's", 0);
const std::uint64_t carol = bunq.AddPerson("Carol", "key-carol");
bunq.AddAccount(carol, carolIban, "Shared", 500);
bunq.AddGrant(carol, "code-carol", "token-carol");
bunq.AddGrant(carol, "code-carol-erin", "token-carol-erin");
const std::uint64_t dave = bunq.AddPerson("Dave", daveKey);
bunq.AddAccount(dave, daveIban, "Play money", 12345);
bunq.AddAccount(bunq.AddPerson("Alice", "key-alice-two"), otherAliceIban, "Other", 100);
bunq.AddPerson("Eve", "key-eve");
sd_event* loop = nullptr;
sd_event_new(&loop);
pid_t nostrod = -1;
{
Driver d(bus, loop);
Starting(d, nostrod, state);
Connecting(d, bus);
Overview(d, bus, bunq, alice, nostrod);
Activity(d, bunq, alice, main);
Paying(d, bus, bunq);
Requesting(d, bus, bunq);
Lists(d, bus, bunq, alice, main);
Cards(d, bus, bunq, alice);
Settings(d, bus, bunq);
OAuth(d, bus, bunq);
Linking(d, bus, bunq);
Vanishing(d, bus, bunq);
Sizes(d);
Routes(d);
Late(bus, loop);
Bare(bus, loop);
LinkWaiting(bus, loop);
Reconnecting(bus, loop);
Gone(d, bus, nostrod);
}
sd_event_unref(loop);
return Test::Result();
}