From 2e8f0e79a5f49118a47bcacdf7021e368ace2c5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Sun, 27 Sep 2026 13:20:37 -0400 Subject: [PATCH] =?UTF-8?q?Account=20=C2=B7=20Sign=20in:=20tests=20for=20e?= =?UTF-8?q?ach=20rest=20and=20wait?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New tests: Sign in waits for a password and rests while busy; Create account waits for a name; while one provider is on its way the other takes no press; Send again rests while a link is on its way. --- TASKS.md | 1 + src/account/tests/sign_in.rs | 78 +++++++++++++++++++++++++++++++++++- 2 files changed, 77 insertions(+), 2 deletions(-) diff --git a/TASKS.md b/TASKS.md index 26aa60e..f1db495 100644 --- a/TASKS.md +++ b/TASKS.md @@ -402,3 +402,4 @@ Per-component lines live in `tasks/`. Tags there: | T35 | 1 | FAIL | a row's control kept its full width past a 280px box; a notice's name shrank to nothing; privacy, notices and startup dropped edits with no handler; Apply's and the reset's rest and a box turned off untested | | T35 | 2 | FAIL | an accent picker of nine or more presets still ran past a 280px box | | T35 | 3 | PASS | | +| T36a | 1 | FAIL | Sign in waiting for a password and resting while busy, Create account waiting for a name, the other providers resting, and Send again resting while busy untested | diff --git a/src/account/tests/sign_in.rs b/src/account/tests/sign_in.rs index c53adcc..966bb55 100644 --- a/src/account/tests/sign_in.rs +++ b/src/account/tests/sign_in.rs @@ -100,8 +100,10 @@ fn a_provider_hands_its_key_and_rests_while_one_is_on_its_way(cx: &mut TestAppCo cx.notify(); }); settle(cx); - tab(1, cx); - tap("space", cx); + for stop in [1, 2] { + tab(stop, cx); + tap("space", cx); + } assert_eq!( said(&host, cx), ["google"], @@ -190,3 +192,75 @@ fn a_failed_code_clears_the_boxes_for_the_next(cx: &mut TestAppContext) { write("654321", cx); assert_eq!(said(&host, cx), ["123456", "654321"]); } + +/// Stops: email, password, its eye, the box, Forgot password. +#[gpui::test] +fn sign_in_waits_for_a_password(cx: &mut TestAppContext) { + let (host, cx) = bench(login, cx); + tab(1, cx); + write("ada@example.com", cx); + tap("enter", cx); + assert!( + said(&host, cx).is_empty(), + "an address alone signs nobody in" + ); +} + +fn busy_login(_: &Bench, owner: Entity) -> AnyElement { + LoginForm::new("login") + .busy(true) + .on_submit(move |login, _, cx| say(&owner, login.email.to_string(), cx)) + .into_any_element() +} + +/// Stops: email, password, its eye, the box; Sign in rests while busy, so a fifth Tab wraps to the email. +#[gpui::test] +fn sign_in_rests_while_busy(cx: &mut TestAppContext) { + let (host, cx) = bench(busy_login, cx); + tab(1, cx); + write("ada@example.com", cx); + tab(2, cx); + write("secret", cx); + tap("enter", cx); + tab(5, cx); + tap("space", cx); + assert!(said(&host, cx).is_empty()); +} + +/// Stops: name, email, password, its eye, the terms. +#[gpui::test] +fn sign_up_waits_for_a_name(cx: &mut TestAppContext) { + let (host, cx) = bench(signup, cx); + tab(2, cx); + write("ada@example.com", cx); + tab(3, cx); + write("abcdefg1", cx); + tab(5, cx); + tap("space", cx); + tab(3, cx); + tap("enter", cx); + assert!(said(&host, cx).is_empty(), "no name, no account"); + tab(1, cx); + write("Ada", cx); + tap("enter", cx); + assert_eq!(said(&host, cx), ["Ada ada@example.com abcdefg1"]); +} + +fn busy_sent(_: &Bench, owner: Entity) -> AnyElement { + let other = owner.clone(); + MagicLinkForm::new("magic") + .sent(true) + .busy(true) + .on_send(move |address, _, cx| say(&owner, format!("send {address}"), cx)) + .on_other(move |_, cx| say(&other, "other".into(), cx)) + .into_any_element() +} + +/// While a link is on its way Send again rests, so the first stop is Use another email. +#[gpui::test] +fn send_again_rests_while_busy(cx: &mut TestAppContext) { + let (host, cx) = bench(busy_sent, cx); + tab(1, cx); + tap("space", cx); + assert_eq!(said(&host, cx), ["other"]); +}