Test: the strip test waits for its new slide before navigating
TestQuieterStrip pressed New slide, saw the eleventh thumbnail (drawn from the local change) and navigated to the last slide at once. New slide moves the stage to the new slide once its save lands, so a slow save overwrote the test's navigation and it waited 20s for a slide that was no longer wanted. The test now waits until the new slide is saved and on the stage first. The product's late navigation is unchanged here; it predates the branch and is recorded for the owner.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+13
−0
internal/slidestest/browser_quieter_test.go+13 −0
diff --git a/internal/slidestest/browser_quieter_test.go b/internal/slidestest/browser_quieter_test.go| index a34e15c..e7d16cd 100644 |
| --- a/internal/slidestest/browser_quieter_test.go |
| +++ b/internal/slidestest/browser_quieter_test.go |
| @@ -300,6 +300,19 @@ func TestQuieterStrip(t *testing.T) { |
| waitFor(`document.querySelectorAll('[slides-strip-item][data-slide-id]').length === 11`), |
| waitFor(`document.querySelector('[slides-strip]').lastElementChild.matches('[slides-strip-new]')`), |
| ) |
| + // New slide moves the stage to the new slide once its save has |
| + // landed: until it has, a navigation of the test's own would be |
| + // overwritten by that move. So the new slide is waited for, saved |
| + // and on the stage, before the test goes anywhere else. |
| + var made string |
| + te.rig.Run(chromedp.Evaluate(`[...document.querySelectorAll('[slides-strip-item][data-slide-id]')].map(li => li.dataset.slideId).find(id => !`+jsArray(ids)+`.includes(id)) || ''`, &made)) |
| + if made == "" { |
| + t.Fatal("New slide added a thumbnail, but no slide the deck did not have before") |
| + } |
| + te.rig.Run( |
| + waitFor(`location.hash.slice(1) === '`+made+`' && document.querySelector('[slides-stage] [slides-slide]')?.dataset.id === '`+made+`'`), |
| + waitFor(`document.querySelector('[estilo-save-status]').dataset.state === 'saved'`), |
| + ) |
| // From the last slide: the new one is the last thumbnail, before |
| // the row. |
| te.rig.Run( |