130
edits
(Removing the custom asyncTest function with the native add_task) |
(Remove content DOM node access in example since that wouldn't work with e10s.) |
||
| Line 150: | Line 150: | ||
const TESTS = [ | const TESTS = [ | ||
{desc: "add a class", cssSelector: "#id1", | {desc: "add a class", cssSelector: "#id1", makeChanges: function*() {...}}, | ||
{desc: "change href", cssSelector: "a.the-link", | {desc: "change href", cssSelector: "a.the-link", makeChanges: function*() {...}}, | ||
... | ... | ||
]; | ]; | ||
| Line 161: | Line 161: | ||
info("Testing step: " + step.desc); | info("Testing step: " + step.desc); | ||
yield selectNode(desc.cssSelector, inspector); | yield selectNode(desc.cssSelector, inspector); | ||
desc. | yield desc.makeChanges(); | ||
} | } | ||
}); | }); | ||
As shown in this code example, you can add as many test cases as you want in the TESTS array and the actual test code will remain very short, and easy to understand and maintain (note that when looping through test arrays, it's always a good idea to add a "desc" property that will be used in an info() log output). | As shown in this code example, you can add as many test cases as you want in the TESTS array and the actual test code will remain very short, and easy to understand and maintain (note that when looping through test arrays, it's always a good idea to add a "desc" property that will be used in an info() log output). | ||
edits