Open Bug 1551283 Opened 6 years ago Updated 1 year ago

mochitest should attempt to close open tabs when failing to obtain focus

Categories

(Testing :: Mochitest, enhancement, P3)

enhancement

Tracking

(Not tracked)

People

(Reporter: bc, Unassigned)

Details

Attachments

(1 obsolete file)

When the browser is unable to focus the main test window, mochitest will issue the following error:

INFO Error: Unable to restore focus, expect failures and timeouts.

I have found during inspection of test runs that this condition can occur if a tab has been left open and selected.

We can help the situation when we hit this condition if we:

  1. select the main tab
  2. close all other tabs
  3. issue a test failure on the currently running test.

#1 and #2 will help prevent the test run from stalling or causing failures in subsequent tests while #3 would help in identifying and fixing problematic tests.

arai: I was wondering if you could help guide me on how to approach this?

Flags: needinfo?(arai.unmht)
  1. select the main tab
  2. close all other tabs

afaik, TestRunner.js is running in tab content, and has no direct access to tabs.
so we should add SpecialPowers API [1] for those steps I think.
(there may be other ways that I'm not aware of tho, I don't know much about mochitest env)

  1. issue a test failure on the currently running test.

TestRunner._makeIframe [2] fails on the other test than the problematic test, so, it should remember the previous test's URL to report,
that I think could be stored in the global variable.

Also, given the problematic test doesn't finish properly, the subsequent tests may run with non-clean environment (prefs etc), so the warning about the failure should still be shown.

let me know if there's anything unclear.

[1] https://searchfox.org/mozilla-central/source/testing/specialpowers/content/specialpowersAPI.js
[2] https://searchfox.org/mozilla-central/rev/cc280c4be94ff8cf64a27cc9b3d6831ffa49fa45/testing/mochitest/tests/SimpleTest/TestRunner.js#304

Flags: needinfo?(arai.unmht)

I'm not likely to look at this any time soon.

Assignee: bob → nobody
Status: ASSIGNED → NEW
Priority: -- → P3
Severity: normal → S3
Attachment #9387489 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: