Test: a second tab clicks the slide once the editor is shown
TestTidyCardFollowsSelection failed about half its runs since Q6 put it in Both view. The view is remembered for the origin, so its second tab opened in Both. In Both, the font gate's hold, which draws the slide with visibility: hidden, lifts only after the phone preview is fetched. The test clicked the shape as soon as the slide's id was on the stage, about 5ms before the hold lifted, and a hidden box takes no click: it landed on the stage. A timeline logged in the second tab showed it: no re-install around the click, the hold still on. The second tab now waits for the editor to be shown in its remembered view before clicking. TestTidyCardSurvivesBoxRemoval takes the same step in Desktop, with about 20ms to spare, and waits the same way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+12
−0
internal/slidestest/browser_editor_tidy_test.go+12 −0
diff --git a/internal/slidestest/browser_editor_tidy_test.go b/internal/slidestest/browser_editor_tidy_test.go| index 8d2de49..9619b4f 100644 |
| --- a/internal/slidestest/browser_editor_tidy_test.go |
| +++ b/internal/slidestest/browser_editor_tidy_test.go |
| @@ -1185,6 +1185,16 @@ func (te *tidyEditor) openOn(slide string) { |
| ) |
| } |
| +// editorShown is true once a newly opened editor is settled in the view |
| +// it will stay in: the remembered view (localStorage, shared by every |
| +// tab of the origin) is applied, and the font gate has lifted its hold |
| +// on the slide (html[data-slides-fonts="shown"]). Until then the slide |
| +// is drawn with visibility: hidden, which nothing can click: a click on |
| +// a box lands on the stage behind it. Both view holds longer than |
| +// Desktop, because the phone preview is fetched before the hold lifts. |
| +const editorShown = `document.documentElement.getAttribute('data-slides-fonts') === 'shown' && |
| + document.querySelector('[slides-stage-pane]').dataset.view === (localStorage.getItem('slides.editor.view') || 'desktop')` |
| + |
| // addCanvasShape adds a canvas slide holding one shape to this editor's |
| // deck, over the API, and returns the slide's id. |
| func (te *tidyEditor) addCanvasShape(t *testing.T) string { |
| @@ -1425,6 +1435,7 @@ func TestTidyCardFollowsSelection(t *testing.T) { |
| chromedp.EmulateViewport(1280, 720), |
| chromedp.Navigate(te.rig.Origin+te.path+"#"+slide), |
| waitFor(`document.querySelector('[slides-stage] [slides-slide]')?.dataset.id === '`+slide+`'`), |
| + waitFor(editorShown), |
| chromedp.Click(`[slides-stage] [data-block="shape"]`, chromedp.ByQuery), |
| waitFor(`document.querySelector('[slides-editor]').dataset.inspect === 'box'`), |
| ) |
| @@ -1451,6 +1462,7 @@ func TestTidyCardSurvivesBoxRemoval(t *testing.T) { |
| chromedp.EmulateViewport(1280, 720), |
| chromedp.Navigate(te.rig.Origin+te.path+"#"+slide), |
| waitFor(`document.querySelector('[slides-stage] [slides-slide]')?.dataset.id === '`+slide+`'`), |
| + waitFor(editorShown), |
| chromedp.Click(`[slides-stage] [data-block="shape"]`, chromedp.ByQuery), |
| waitFor(`document.querySelector('[slides-editor]').dataset.inspect === 'box'`), |
| ) |