Closed Bug 1828742 Opened 2 years ago Closed 9 months ago

Create a shareable module of useful SessionStore test helpers

Categories

(Firefox :: Session Restore, task, P3)

task

Tracking

()

RESOLVED DUPLICATE of bug 1833522

People

(Reporter: sfoster, Unassigned)

References

Details

(Whiteboard: [fidefe-firefox-view] )

There are some handy test helpers in browser/components/sessionstore/test/head.js that would be useful to import into tests in other components. In a couple of cases these have been already duplicated or re-implemented. It would be good to refactor these into a es6 module e.g. browser/components/sessionstore/test/SessionStoreTestUtils.sys.mjs. We did a similar exercise in bug 1784979.

As a first pass, it looks we could:

  • remove waitForTopic in favor of TestUtils.waitForTopic
  • move forgetClosedWindows and forgetClosedTabs into a new SessionStoreTestUtils.sys.mjs
  • move promiseRemoveTabAndSessionState into the new utils module. Maybe the 'session state' part is implicit in the module name so this could just be removeTab?
  • move openAndCloseTab into the new utils module. It looks like some of this implementation could be replaced by using BrowserTestUtils.openNewForegroundTab

(In reply to Sam Foster [:sfoster] (he/him) from comment #0)

  • move openAndCloseTab into the new utils module. It looks like some of this implementation could be replaced by using BrowserTestUtils.openNewForegroundTab

Maybe just BrowserTestUtils.withNewTab()?

We got a start on this in bug 1833522. There are more helpers in head.js that might be good to move but this is underway.

Status: NEW → RESOLVED
Closed: 9 months ago
Duplicate of bug: 1833522
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.