Name the page behind a window a step fails on

Merged
YO
9d ago
+149-5

What

A browser step that fails while its operations work on a window another, still open, page opened now:

  • names that page in the step's error: the page read is a window that the page "<title>" opened and that is still open in front of it, and
  • when the step takes screenshots on failure, saves that page as NN-failure-opener.png beside NN-failure.png, and names the file in the error.

Why

A frames-based site's search opens a "searching" window and posts into a frame, whose answer closes the window (the case #3442 holds). When the answer is an error, for example a search text over the site's length limit, the site never closes the window. Operations then work on the window, as they do on any window still open past its opener's load, so the step failed with an expect like "the page only shows a communicating dialog", and its screenshot showed only that window. The error that told what went wrong was on the page behind it, which nothing reported, so the cause looked like a timing problem rather than bad input.

How it was found

On a live procurement site, five of 26 items of a foreach failed on every attempt with "the page only shows the communicating dialog". The page behind the window read "input text is too long": the site accepts at most 25 characters in its search field.

Tests

  • TestFailureOnAWindowCapturesThePageBehindIt: the error names the opener and both screenshots are saved.
  • Conformance TestBrowserNamesThePageBehindAWindowLeftOpen: the bids fixture answers a search with no region with an error that leaves the searching window open; the step fails naming the page behind it and its screenshot. TestBrowserSearchingWindow still passes.

Summary by cubic

A step that fails while working on a window another open page opened now names that page in its error, since the window hides it. When failure screenshots are enabled, it also saves that page as NN-failure-opener.png beside the failure screenshot.

Summary by CodeRabbit

  • New Features
    • When a browser step fails while a window is open, the error now identifies the page that opened it. If failure screenshots are enabled, the opener page is also captured.
  • Documentation
    • Updated the browser behavior specification to describe opener-page identification and screenshots on failure.