Closed Bug 1613322 Opened 4 years ago Closed 4 years ago

DevTools ToolboxTask should define common helpers info, is, ok ... for all tests

Categories

(DevTools :: General, task, P3)

task

Tracking

(firefox75 fixed)

RESOLVED FIXED
Firefox 75
Tracking Status
firefox75 --- fixed

People

(Reporter: jdescottes, Assigned: ochameau)

References

Details

Attachments

(1 file)

What were you doing?

Follow up to the review of https://phabricator.services.mozilla.com/D61570
Some tests in devtools/client/framework/browser-toolbox/test/ add helper functions to the "ToolboxTask" scope:

  await ToolboxTask.importFunctions({
    info: msg => dump(msg + "\n"),
    is: (a, b, description) => {
      let msg =
        "'" + JSON.stringify(a) + "' is equal to '" + JSON.stringify(b) + "'";
      if (description) {
        msg += " - " + description;
      }
      if (a !== b) {
        msg = "FAILURE: " + msg;
        dump(msg + "\n");
        throw new Error(msg);
      } else {
        msg = "SUCCESS: " + msg;
        dump(msg + "\n");
      }
    },
    ok: (a, description) => {
      let msg = "'" + JSON.stringify(a) + "' is true";
      if (description) {
        msg += " - " + description;
      }
      if (!a) {
        msg = "FAILURE: " + msg;
        dump(msg + "\n");
        throw new Error(msg);
      } else {
        msg = "SUCCESS: " + msg;
        dump(msg + "\n");
      }
    },
    waitUntil,
  });

What happened?

Each test has to redefine the imported functions, leading to inconsistent tests.

What should have happened?

Common helpers should be defined once and always inserted in the BrowserToolbox tasks.

Assignee: nobody → poirot.alex
Status: NEW → ASSIGNED
Pushed by apoirot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/05b8b0f2f8fe
Define common test helpers for browser toolbox tasks. r=jdescottes
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 75
Regressions: 1614925
No longer regressions: 1614925
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: