Open Bug 1828742 Opened 1 year ago Updated 1 year ago

Create a shareable module of useful SessionStore test helpers

Categories

(Firefox :: Session Restore, task, P3)

task

Tracking

()

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()?

You need to log in before you can comment on or make changes to this bug.