Electrolysis/e10s test tips: Difference between revisions

Added Assert.jsm reference.
(→‎loadFrameScript: mention opposite is SpecialPowers.loadChromeScript)
(Added Assert.jsm reference.)
Line 104: Line 104:
Remember to yield from <code>ContentTask.spawn</code> so that the test correctly waits for the task to complete.  
Remember to yield from <code>ContentTask.spawn</code> so that the test correctly waits for the task to complete.  


You can also just use the ok() and is() testing functions directly within the ContentTask body, which is useful if you want to check multiple results or perform multiple steps. These use <code>===</code> for comparisons so make sure the right types are used. For example:
You can also just use the [https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Assert.jsm Assert.jsm] testing functions directly within the ContentTask body, which is useful if you want to check multiple results or perform multiple steps. For example:


   yield ContentTask.spawn(browser, "link", function* (arg) {
   yield ContentTask.spawn(browser, "link", function* (arg) {
     ok(String(content.document.getSelection()), "Hello")
     Assert.ok(String(content.document.getSelection()), "Hello");
   }
   }


Confirmed users
74

edits