The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
feat(mobile): one set-up page — signed in, it is the download menu that watches and pairs
dee97c7d727cd96
diff --git a/mobile/lib/phone/welcome/connect_computer.dart b/mobile/lib/phone/welcome/connect_computer.dartindex 07fc58a71..753267c92 100644--- a/mobile/lib/phone/welcome/connect_computer.dart+++ b/mobile/lib/phone/welcome/connect_computer.dart@@ -2,32 +2,36 @@ import 'dart:async';import 'package:flutter/material.dart';import 'package:flutter/services.dart';-import 'package:url_launcher/url_launcher.dart';import 'package:harness_mobile/shared/theme/app_theme.dart';import 'package:harness_mobile/state/app_state.dart';import '../tty.dart';import '../tty_controls.dart';-import 'how_it_works.dart';+import 'scan_to_connect.dart';+import 'set_up_computer.dart';-/// The commands that put Harness on a computer, in order — the README's "Get started".-const kSetUpCommands = [- 'curl -fsSL https://harness.autonomous.ai/cli/install.sh | bash',- 'harness login',- 'harness remote-password set',- 'harness start',-];--/// Where the desktop app is downloaded.-const kDesktopAppUrl = 'https://harness.autonomous.ai/desktop';--/// How to put Harness on a computer, for someone who has not — the one idea a phone app for agents-/// has to get across first: **the agents run on your computer, and the phone connects to it.**+/// Setting up a computer, for a phone that is signed in — the same page as the first screen's "Not+/// yet" ([SetUpComputerPage]: the website's download menu, sent to the computer), and the one thing+/// only a signed-in phone can do on it: watch for the computer to appear (every few seconds, since+/// nothing tells the phone) and pair with it by the code its Harness ▸ Add Phone… shows.+///+/// ```+/// Get Harness for+/// your computer+/// [| Signed in as ada@… Waiting for your computer…]+///+/// Send it to your computer: (the download menu)+/// …+/// Then open it, and scan the code it shows.+/// Scan to connect ›+/// See how it works ▶+/// Try the sample while you wait+/// ```///-/// Two ways, the app or a terminal, each with its steps to copy. Signed in, the page also watches-/// for the computer to appear (every few seconds, since nothing tells the phone), and the app moves-/// on by itself the moment it does. Signed out, it is the "New here?" page behind the welcome.+/// It replaces a page of its own — an email of the steps, a Terminal/Mac tab, four commands to+/// copy — that told a newcomer the same thing a second way, with `harness login` and a phone+/// password the QR has since made unnecessary.class ConnectComputerPage extends StatefulWidget {const ConnectComputerPage({super.key,@@ -35,6 +39,8 @@ class ConnectComputerPage extends StatefulWidget {this.signedIn = true,this.onBack,this.onTrySample,+ this.scanCamera,+ this.loadDownloads,});final AppNotifier notifier;@@ -48,53 +54,20 @@ class ConnectComputerPage extends StatefulWidget {/// Opens the sample; see `PhoneWelcome.onTrySample`.final Future<Object?> Function(BuildContext context)? onTrySample;+ /// Stand-ins for the camera and the release manifest, in tests.+ final Widget? scanCamera;+ final DesktopDownloadsLoader? loadDownloads;+@overrideState<ConnectComputerPage> createState() => _ConnectComputerPageState();}class _ConnectComputerPageState extends State<ConnectComputerPage> {Timer? _watch;- String? _copied;- Timer? _copiedTimer;-- /// Which way the steps are shown: the terminal first — who this is for lives in one — or the- /// Mac app.- bool _terminal = true;-- /// The steps, sent to [email] through the phone's own Mail — there is no server doing it, and a- /// message in your own inbox is where the computer will find it.- Future<void> _emailSteps(String? email) async {- final body = [- 'Set up Harness on your computer:',- '',- 'Mac app: $kDesktopAppUrl',- ' Sign in${email == null ? '' : ' with $email'}, then Machines → this computer → Set password.',- '',- 'Or, in a terminal:',- for (final line in kSetUpCommands) ' $line',- '',- 'Then open Harness on your phone — it finds the computer by itself.',- ].join('\n');- final uri = Uri(- scheme: 'mailto',- path: email ?? '',- query: _mailQuery({- 'subject': 'Set up Harness on your computer',- 'body': body,- }),- );- try {- final opened = await launchUrl(uri);- if (!opened && mounted) _copy('commands', body);- } on Exception {- if (mounted) _copy('commands', body);- }- }- /// `mailto:` wants `%20`, not `+`, between words.- static String _mailQuery(Map<String, String> fields) => fields.entries- .map((e) => '${e.key}=${Uri.encodeComponent(e.value)}')- .join('&');+ /// What the last scan came to, while it is worth saying: pairing, or why it did not.+ String? _scanned;+ bool _scanFailed = false;@overridevoid initState() {@@ -110,18 +83,61 @@ class _ConnectComputerPageState extends State<ConnectComputerPage> {@overridevoid dispose() {_watch?.cancel();- _copiedTimer?.cancel();super.dispose();}- void _copy(String what, String text) {- unawaited(Clipboard.setData(ClipboardData(text: text)));- HapticFeedback.lightImpact();- _copiedTimer?.cancel();- setState(() => _copied = what);- _copiedTimer = Timer(const Duration(seconds: 2), () {- if (mounted) setState(() => _copied = null);- });+ void _say(String? message, {bool failed = false}) => setState(() {+ _scanned = message;+ _scanFailed = failed;+ });++ /// The code the new computer's Add Phone shows: the phone pairs with it there and then. The+ /// computer is asked for first — it may have joined the account a moment ago, too recently for+ /// the list the phone holds.+ Future<void> _scanToPair() async {+ final code = await scanForCode(+ context,+ fallbackLabel: 'Not now',+ camera: widget.scanCamera,+ );+ if (!mounted || code == null) return;+ final machineId = code.machineId, pairCode = code.pairCode;+ if (machineId == null || pairCode == null) {+ _say(+ "That code can't pair a computer. Scan the one in Harness ▸ Add Phone….",+ failed: true,+ );+ return;+ }+ _say('Pairing…');+ if (!widget.notifier.machineStates.containsKey(machineId)) {+ // Bounded: a slow network is a reason to say so, not to leave "Pairing…" up for good.+ await widget.notifier.refreshMachines().timeout(+ const Duration(seconds: 5),+ onTimeout: () {},+ );+ }+ if (!mounted) return;+ if (!widget.notifier.machineStates.containsKey(machineId)) {+ _say(+ "That computer isn't on your account. Sign in to Harness on it "+ 'with ${widget.notifier.currentUser?.email ?? 'this account'}.',+ failed: true,+ );+ return;+ }+ final error = await widget.notifier.connectWithCode(machineId, pairCode);+ if (!mounted) return;+ if (error == null) {+ HapticFeedback.mediumImpact();+ _say(null);+ // From Computers, the list it came from has the computer now; at home, the shell moves on+ // by itself once a computer is ready.+ if (widget.onBack case final back?) back();+ } else {+ HapticFeedback.heavyImpact();+ _say(error, failed: true);+ }}@override@@ -129,146 +145,47 @@ class _ConnectComputerPageState extends State<ConnectComputerPage> {AppTheme.watch(context);final tty = Tty.of(context);final email = widget.notifier.currentUser?.email;- final account = email == null ? 'the same account' : email;+ final scanned = _scanned;return Scaffold(backgroundColor: tty.ground,body: SafeArea(- child: Column(- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [- if (widget.onBack != null)- Align(- alignment: Alignment.centerLeft,- child: TtyBackButton(onPressed: widget.onBack),- ),- Expanded(- child: ListView(- padding: const EdgeInsets.fromLTRB(- Tty.origin,- 16,- Tty.origin,- 24,- ),- children: [- TtyText(- 'Set up your computer',- size: 24,- weight: FontWeight.w600,- ),- const SizedBox(height: 12),- Text(- 'Your agents run on your computer — this phone is the '- 'remote. It takes about two minutes, once.',- style: tty.style(size: TtySize.row, color: tty.faint),- ),- const SizedBox(height: 24),- // Signed in: say so — and that the page is watching — where it is read first.- if (widget.signedIn) ...[- _Watching(account: email),- const SizedBox(height: 16),- ],- // Most people meet this page on the phone, away from the computer: the one thing- // to do from here is send the steps to where they will be read.- TtyPrimaryButton(- label: 'Email me the setup link',- onPressed: () => unawaited(_emailSteps(email)),- ),- const SizedBox(height: 6),- Center(- child: TtyText(- 'Open it on your Mac or Linux computer.',- size: TtySize.meta,- color: tty.faint,- ),- ),- const SizedBox(height: 32),- TtyText(- 'Already at your computer?',- size: TtySize.row,- weight: FontWeight.w600,- ),- const SizedBox(height: 12),- _Choice(- options: const ['Terminal', 'Mac app'],- selected: _terminal ? 0 : 1,- onSelected: (index) =>- setState(() => _terminal = index == 0),- ),- const SizedBox(height: 14),- if (!_terminal) ...[- _CopyLine(- text: 'harness.autonomous.ai/desktop',- copied: _copied == 'link',- onCopy: () => _copy('link', kDesktopAppUrl),- ),- const SizedBox(height: 10),- Text(- 'Download it, sign in with $account, then open Machines '- '(your computers) → this Mac → Set password. That is '- 'the phone password you type here next.',- style: tty.style(size: TtySize.meta, color: tty.faint),- ),- ] else ...[- _CommandBlock(- lines: kSetUpCommands,- copied: _copied == 'commands',- onCopy: () =>- _copy('commands', kSetUpCommands.join('\n')),- ),- const SizedBox(height: 10),- Text.rich(- TextSpan(- style: tty.style(size: TtySize.meta, color: tty.faint),- children: [- TextSpan(- text: 'harness login',- style: tty.style(- size: TtySize.meta,- color: tty.green,- ),- ),- TextSpan(- text: ' signs the computer in to $account. ',- ),- TextSpan(- text: 'remote-password',- style: tty.style(- size: TtySize.meta,- color: tty.green,- ),- ),- const TextSpan(- text:- ' sets your phone password — what this '- 'phone unlocks it with. It never leaves your '- 'devices.',+ child: SetUpComputerPage(+ onBack: widget.onBack,+ onScan: () => unawaited(_scanToPair()),+ loadDownloads: widget.loadDownloads,+ status: widget.signedIn || scanned != null+ ? Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ if (widget.signedIn) _Watching(account: email),+ if (scanned != null)+ Padding(+ padding: const EdgeInsets.only(top: 10),+ child: Text(+ _scanFailed ? '✗ $scanned' : scanned,+ key: const ValueKey('connect-scan-status'),+ style: tty.style(+ size: TtySize.meta,+ color: _scanFailed ? tty.red : tty.faint,),- ],+ ),),- ),],- const SizedBox(height: 32),- Center(- child: TtyTextButton(- label: 'How Harness works',- onPressed: () => unawaited(openHowItWorks(context)),- ),+ )+ : null,+ trailing: [+ if (widget.onTrySample case final trySample?)+ Align(+ alignment: Alignment.centerLeft,+ child: Transform.translate(+ offset: const Offset(-12, 0),+ child: TtyTextButton(+ label: 'Try the sample while you wait',+ color: tty.faint,+ onPressed: () => unawaited(trySample(context)),),- if (widget.onTrySample != null) ...[- const SizedBox(height: 16),- Center(- child: TtyTextButton(- label: widget.signedIn- ? 'Try the sample while you wait'- : 'Try the sample',- onPressed: () =>- unawaited(widget.onTrySample!(context)),- ),- ),- ],- ],+ ),),- ),],),),@@ -276,164 +193,6 @@ class _ConnectComputerPageState extends State<ConnectComputerPage> {}}-/// Two or three ways to do one thing, one chosen — iOS's segmented control, drawn flat.-class _Choice extends StatelessWidget {- const _Choice({- required this.options,- required this.selected,- required this.onSelected,- });-- final List<String> options;- final int selected;- final ValueChanged<int> onSelected;-- @override- Widget build(BuildContext context) {- final tty = Tty.of(context);- return Container(- height: 40,- padding: const EdgeInsets.all(3),- decoration: BoxDecoration(- color: ttyRaised(tty),- borderRadius: BorderRadius.circular(8),- ),- child: Row(- children: [- for (var i = 0; i < options.length; i++)- Expanded(- child: Semantics(- button: true,- selected: i == selected,- label: options[i],- excludeSemantics: true,- child: GestureDetector(- behavior: HitTestBehavior.opaque,- onTap: () {- HapticFeedback.selectionClick();- onSelected(i);- },- child: Container(- alignment: Alignment.center,- decoration: BoxDecoration(- // The chosen one lifts off the track, as iOS draws it.- color: i == selected- ? Color.alphaBlend(- tty.text.withValues(alpha: 0.2),- tty.ground,- )- : Colors.transparent,- borderRadius: BorderRadius.circular(6),- ),- child: TtyText(- options[i],- size: TtySize.meta,- weight: i == selected ? FontWeight.w600 : FontWeight.w400,- color: i == selected ? tty.text : tty.faint,- ),- ),- ),- ),- ),- ],- ),- );- }-}--/// One line to copy — a link — with `Copy` at its end.-class _CopyLine extends StatelessWidget {- const _CopyLine({- required this.text,- required this.copied,- required this.onCopy,- });-- final String text;- final bool copied;- final VoidCallback onCopy;-- @override- Widget build(BuildContext context) {- final tty = Tty.of(context);- return Container(- decoration: BoxDecoration(- color: ttyRaised(tty),- borderRadius: BorderRadius.circular(6),- ),- padding: const EdgeInsets.only(left: 12),- child: Row(- children: [- Expanded(- child: TtyText(text, size: TtySize.meta, color: tty.text),- ),- TtyTextButton(- label: copied ? 'Copied' : 'Copy',- color: copied ? tty.green : null,- onPressed: onCopy,- ),- ],- ),- );- }-}--/// Commands as a terminal would show them, `$ ` in front of each, and `Copy all` under them.-class _CommandBlock extends StatelessWidget {- const _CommandBlock({- required this.lines,- required this.copied,- required this.onCopy,- });-- final List<String> lines;- final bool copied;- final VoidCallback onCopy;-- @override- Widget build(BuildContext context) {- final tty = Tty.of(context);- return Container(- decoration: BoxDecoration(- color: ttyRaised(tty),- borderRadius: BorderRadius.circular(6),- ),- padding: const EdgeInsets.fromLTRB(12, 10, 0, 0),- child: Column(- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [- for (final line in lines)- Padding(- padding: const EdgeInsets.only(bottom: 6, right: 12),- child: Text.rich(- TextSpan(- children: [- TextSpan(- text: r'$ ',- style: tty.style(color: tty.green, size: TtySize.meta),- ),- TextSpan(- text: line,- style: tty.style(size: TtySize.meta),- ),- ],- ),- ),- ),- Align(- alignment: Alignment.centerRight,- child: TtyTextButton(- label: copied ? 'Copied' : 'Copy all',- color: copied ? tty.green : null,- onPressed: onCopy,- ),- ),- ],- ),- );- }-}-/// `Looking for your computer…` with a terminal spinner — the page is watching.class _Watching extends StatefulWidget {const _Watching({this.account});diff --git a/mobile/lib/phone/welcome/scan_to_connect.dart b/mobile/lib/phone/welcome/scan_to_connect.dartindex 2a80d1eb5..dd6ea0607 100644--- a/mobile/lib/phone/welcome/scan_to_connect.dart+++ b/mobile/lib/phone/welcome/scan_to_connect.dart@@ -4,6 +4,7 @@ import 'package:mobile_scanner/mobile_scanner.dart';import 'package:harness_mobile/shared/theme/app_theme.dart';+import '../phone_navigation.dart' show phoneRoute;import '../tty.dart';import '../tty_controls.dart';import 'connect_code.dart';@@ -145,3 +146,34 @@ class _ScanToConnectPageState extends State<ScanToConnectPage> {);}}++/// The camera over the current page, and the code it read — null when the person went back or+/// took the other way ([fallbackLabel]). For a phone that is already signed in and wants a+/// computer: unlocking one, or pairing with one just set up.+Future<ConnectCode?> scanForCode(+ BuildContext context, {+ required String fallbackLabel,+ Widget? camera,+}) async {+ ConnectCode? scanned;+ await Navigator.of(context).push(+ phoneRoute(+ (page) => Scaffold(+ backgroundColor: Tty.of(page).ground,+ body: SafeArea(+ child: ScanToConnectPage(+ camera: camera,+ fallbackLabel: fallbackLabel,+ onCode: (code) {+ scanned = code;+ Navigator.of(page).pop();+ },+ onUseEmail: () => Navigator.of(page).pop(),+ onBack: () => Navigator.of(page).pop(),+ ),+ ),+ ),+ ),+ );+ return scanned;+}diff --git a/mobile/lib/phone/welcome/set_up_computer.dart b/mobile/lib/phone/welcome/set_up_computer.dartindex dfd7e91fb..74c3ac7ff 100644--- a/mobile/lib/phone/welcome/set_up_computer.dart+++ b/mobile/lib/phone/welcome/set_up_computer.dart@@ -115,13 +115,24 @@ class SetUpComputerPage extends StatefulWidget {const SetUpComputerPage({super.key,required this.onScan,- required this.onBack,+ this.onBack,+ this.status,+ this.trailing = const [],this.loadDownloads,});- /// Back to the first screen's other answer, once the app is on the computer.+ /// Back to the first screen's other answer, once the app is on the computer — or, signed in,+ /// the scan that pairs this phone with the computer just set up.final VoidCallback onScan;- final VoidCallback onBack;++ /// Null draws no back button: the page is a home screen, not a pushed one.+ final VoidCallback? onBack;++ /// A line under the title about what is going on — signed in, the watch for the computer.+ final Widget? status;++ /// Rows after everything else — signed in, the sample to try while waiting.+ final List<Widget> trailing;/// Stands in for the manifest in tests. Null reads [kDesktopManifestUrl].final DesktopDownloadsLoader? loadDownloads;@@ -179,10 +190,13 @@ class _SetUpComputerPageState extends State<SetUpComputerPage> {return Column(crossAxisAlignment: CrossAxisAlignment.stretch,children: [- Align(- alignment: Alignment.centerLeft,- child: TtyBackButton(onPressed: widget.onBack),- ),+ if (widget.onBack case final onBack?)+ Align(+ alignment: Alignment.centerLeft,+ child: TtyBackButton(onPressed: onBack),+ )+ else+ const SizedBox(height: 44),Expanded(child: ListView(padding: const EdgeInsets.fromLTRB(Tty.origin, 8, Tty.origin, 24),@@ -193,6 +207,10 @@ class _SetUpComputerPageState extends State<SetUpComputerPage> {.style(size: TtySize.display, weight: FontWeight.w600).copyWith(height: 34 / 28, letterSpacing: -0.6),),+ if (widget.status case final status?) ...[+ const SizedBox(height: 18),+ status,+ ],const SizedBox(height: 28),Text('Send it to your computer:', style: faint),const SizedBox(height: 8),@@ -276,6 +294,7 @@ class _SetUpComputerPageState extends State<SetUpComputerPage> {),),),+ ...widget.trailing,],),),diff --git a/mobile/lib/phone/welcome/unlock_computer.dart b/mobile/lib/phone/welcome/unlock_computer.dartindex e3c351267..8852c2983 100644--- a/mobile/lib/phone/welcome/unlock_computer.dart+++ b/mobile/lib/phone/welcome/unlock_computer.dart@@ -6,10 +6,8 @@ import 'package:lucide_icons_flutter/lucide_icons.dart';import 'package:harness_mobile/state/app_state.dart';-import '../phone_navigation.dart' show phoneRoute;import '../tty.dart';import '../tty_controls.dart';-import 'connect_code.dart';import 'scan_to_connect.dart';/// Unlocking a computer from this phone — the page behind a locked computer's row. The way the@@ -121,27 +119,11 @@ class _UnlockComputerState extends State<UnlockComputer> {/// first one was added — its one-time code, armed by its Add Phone dialog, and no password.Future<void> _scan() async {if (_busy || _pairing) return;- ConnectCode? scanned;- await Navigator.of(context).push(- phoneRoute(- (page) => Scaffold(- backgroundColor: Tty.of(page).ground,- body: SafeArea(- child: ScanToConnectPage(- camera: widget.scanCamera,- fallbackLabel: 'Use its password instead',- onCode: (code) {- scanned = code;- Navigator.of(page).pop();- },- onUseEmail: () => Navigator.of(page).pop(),- onBack: () => Navigator.of(page).pop(),- ),- ),- ),- ),+ final code = await scanForCode(+ context,+ fallbackLabel: 'Use its password instead',+ camera: widget.scanCamera,);- final code = scanned;if (!mounted || code == null) return;final machine = widget.machineState.machine;final pairCode = code.pairCode;diff --git a/mobile/test/connect_computer_test.dart b/mobile/test/connect_computer_test.dartnew file mode 100644index 000000000..1e98cb92a--- /dev/null+++ b/mobile/test/connect_computer_test.dart@@ -0,0 +1,147 @@+import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness_mobile/auth/auth_session.dart';+import 'package:harness_mobile/auth/cli_link.dart';+import 'package:harness_mobile/auth/peer_link_client.dart';+import 'package:harness_mobile/core/config.dart';+import 'package:harness_mobile/core/models.dart';+import 'package:harness_mobile/phone/welcome/connect_code.dart';+import 'package:harness_mobile/phone/welcome/connect_computer.dart';+import 'package:harness_mobile/phone/welcome/scan_to_connect.dart';+import 'package:harness_mobile/phone/welcome/set_up_computer.dart';+import 'package:harness_mobile/state/app_state.dart';++class _Links implements PeerLinkClient {+ final codes = <(String, String)>[];++ @override+ Future<CliLinkConnectResult> connectWithCode(+ String machineId,+ String code, {+ required String label,+ String? displayName,+ }) async {+ codes.add((machineId, code));+ return CliLinkConnectResult(linkedMachineId: machineId);+ }++ @override+ Future<CliLinkConnectResult> connect(+ String machineId,+ String password, {+ void Function(String stage)? onProgress,+ String? displayName,+ }) async => const CliLinkConnectResult(error: 'not used');++ @override+ Future<CliLinkListResult> list() async =>+ const CliLinkListResult(machines: []);++ @override+ Future<String?> unlink(String machineId) async => null;+}++/// Setting up a computer from a signed-in phone is the first screen's download menu, plus what only+/// a signed-in phone can do there: watch for the computer, and pair with it by its code.+void main() {+ late _Links links;+ late AppNotifier app;+ late List<bool> backs;++ setUp(() {+ links = _Links();+ app = AppNotifier(+ config: AppConfig.dev,+ authSession: AuthSession(),+ configStore: null,+ peerLinks: links,+ );+ backs = [];+ });+ tearDown(() => app.dispose());++ Future<void> pump(WidgetTester tester) async {+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = const Size(430, 1400);+ addTearDown(tester.view.reset);+ await tester.pumpWidget(+ MaterialApp(+ home: ConnectComputerPage(+ notifier: app,+ onBack: () => backs.add(true),+ onTrySample: (_) async => null,+ scanCamera: const SizedBox(),+ loadDownloads: () async => const {},+ ),+ ),+ );+ await tester.pump();+ }++ Future<void> scan(WidgetTester tester, String link) async {+ await tester.tap(find.text('Scan to connect ›'));+ await tester.pumpAndSettle();+ tester+ .widget<ScanToConnectPage>(find.byType(ScanToConnectPage))+ .onCode(ConnectCode.parse(link)!);+ await tester.pumpAndSettle();+ }++ Future<void> unmount(WidgetTester tester) async {+ await tester.pumpWidget(const SizedBox());+ await tester.pump(const Duration(seconds: 6));+ }++ testWidgets('the download menu, watching, and the sample to try meanwhile', (+ tester,+ ) async {+ await pump(tester);+ expect(find.byType(SetUpComputerPage), findsOneWidget);+ expect(find.text('Apple Silicon'), findsOneWidget);+ expect(find.textContaining('Waiting for your computer'), findsOneWidget);+ expect(find.text('Try the sample while you wait'), findsOneWidget);+ // The old page's second way of saying all this is gone.+ expect(find.text('Email me the setup link'), findsNothing);+ expect(find.textContaining('remote-password'), findsNothing);+ await unmount(tester);+ });++ testWidgets('scanning the new computer\'s code pairs it and goes back', (+ tester,+ ) async {+ const studio = Machine(+ machineId: 'studio',+ authMode: MachineAuthMode.remote,+ name: 'studio',+ );+ app.machines = [studio];+ app.machineStates['studio'] = MachineState(studio)+ ..nodeOnline = true+ ..needsLink = true;+ await pump(tester);+ await scan(+ tester,+ ConnectCode.link('[email protected]', machineId: 'studio', pairCode: 'K7QM4XPT'),+ );+ expect(links.codes, [('studio', 'K7QM4XPT')]);+ expect(backs, [true]);+ await unmount(tester);+ });++ testWidgets('a computer on another account is refused, and says so', (+ tester,+ ) async {+ await pump(tester);+ await scan(+ tester,+ ConnectCode.link('[email protected]', machineId: 'elsewhere', pairCode: 'K7QM4XPT'),+ );+ // The page asks for the list again first, and gives that five seconds.+ await tester.pump(const Duration(seconds: 6));+ await tester.pump();+ expect(links.codes, isEmpty);+ expect(backs, isEmpty);+ expect(find.textContaining("isn't on your account"), findsOneWidget);+ await unmount(tester);+ });+}diff --git a/mobile/test/first_computer_flow_test.dart b/mobile/test/first_computer_flow_test.dartindex 0a3178b73..cb916aae5 100644--- a/mobile/test/first_computer_flow_test.dart+++ b/mobile/test/first_computer_flow_test.dart@@ -66,7 +66,7 @@ void main() {}await settle();- expect(find.text('Set up your computer'), findsOneWidget);+ expect(find.text('Get Harness for\nyour computer'), findsOneWidget);// It appears — awake, and waiting for its phone password.const studio = Machine(