Open Bug 1757982 Opened 3 years ago Updated 3 years ago

Expose an API in mochitest-chrome and mochitest-browser to easily retrieve test file URLs

Categories

(Testing :: Mochitest, enhancement)

Default
enhancement

Tracking

(Not tracked)

ASSIGNED

People

(Reporter: ochameau, Assigned: ochameau)

Details

Attachments

(1 file)

For now, in order to reference some tests files, a lot of tests are either doing:

const TEST_PATH = getRootDirectory(gTestPath).replace(
  "chrome://mochitests/content",
  "https://example.com"
);
...
const testUrl = TEST_PATH + "test-page.html";

https://searchfox.org/mozilla-central/search?q=%22chrome%3A%2F%2Fmochitests%2Fcontent%22&path=&case=true&regexp=false
(~300 tests)

Or are simply hardcoding the test URL:

const testPath =
    "https://example.com/browser/browser/base/content/test/favicons/file_insecure_favicon.html";

https://searchfox.org/mozilla-central/search?q=%22https%3A%2F%2Fexample.com%2Fbrowser%2F&path=&case=true&regexp=false
https://searchfox.org/mozilla-central/search?q=%22https%3A%2F%2Fexample.org%2Fbrowser&path=&case=true&regexp=false
https://searchfox.org/mozilla-central/search?q=%22https%3A%2F%2Fexample.com%2Ftests%2F&path=&case=true&regexp=false
(~500+50+200 tests)

There might even be some other pattern I'm not aware of.

It would be nice if it was easier to retrieve the URL of any test file.
We already have a getTestFilePath, we would probably benefit from have a getTestFileUrl method.

Assignee: nobody → poirot.alex
Status: NEW → ASSIGNED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: