test(gui): the live viewer's "update" test waits for the line it asserts on
A newer wanderbooks writes its lines one at a time, and the viewer may look between two of them. With the unknown line last, nothing can check it, so the viewer says "newer or damaged" (BS-format-1); once the next line lands it says "update". Both are right. The test took the first error it saw and held it to the "update" wording, so a look that fell between the test's two appends failed it. The loader is unchanged by the fault: the test read the first of two correct messages. The loader path is the same on main (0 of 30 runs failed there, 0 of 30 on the branch: the natural failure is rare, and shows on a loaded machine); the branch's load only makes the gap likelier. Seen deterministically by pausing the test 300 ms between its two appends. The test now waits for the "update" and holds every message before it to the "newer or damaged" one; a new test pins the between-the-lines look by waiting on the viewer's first error before it writes the second line. The same shape was in the background-tab test: it waited for the tab's seq to move, which an entry's first journal line does, then asserted the posted cash. It now waits for the cash itself. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c1fbeab7c1
commit
dce7898e96
2 files changed
+64
-13
No files matched your search
@@ -457,7 +457,7 @@ fn a_background_tab_follows_its_journal_and_is_current_when_shown() {
|
||||
let mut h = start_with_prefs(&w, &[("open_companies", "alpha,beta")]);
|
||||
loaded(&mut h);
|
||||
assert_eq!(h.state().active(), Some(0));
|
||||
let beta_seq = h.state().views()[1].books().unwrap().seq();
|
||||
let beta_cash = h.state().views()[1].books().unwrap().kpis.cash;
|
||||
|
||||
// Beta's journal changes while alpha is in front: 100.00 more cash.
|
||||
let mut s = Store::open(&b.data).unwrap();
|
||||
@@ -470,8 +470,12 @@ fn a_background_tab_follows_its_journal_and_is_current_when_shown() {
|
||||
10_000,
|
||||
);
|
||||
drop(s);
|
||||
// The entry is several journal lines, and the tab may read some of
|
||||
// them first (its seq moves): wait for the one that posts it, whose
|
||||
// 100.00 lands in cash.
|
||||
let beta_cash_after = beta_cash + Decimal::new(10_000, 2);
|
||||
until(&mut h, "the background tab reads the new entry", |a| {
|
||||
a.views()[1].books().unwrap().seq() > beta_seq
|
||||
a.views()[1].books().unwrap().kpis.cash == beta_cash_after
|
||||
});
|
||||
assert_eq!(h.state().active(), Some(0), "nothing brought beta forward");
|
||||
|
||||
|
||||
Reference in new issue
Block a user