Compatibility/System Addon/Interventions: Difference between revisions

fix typo
(add link to automated testing page)
(fix typo)
Line 70: Line 70:
([https://bugzilla.mozilla.org/show_bug.cgi?id=1968407 Coming soon!]) To test interventions which have only soft requirements for running on a specific platform, pass the <code>--platform-override/-P</code> option to the test framework (with a value of <code>android</code>, <code>linux</code>, <code>mac</code>, or <code>windows</code>). This runs the tests as though running on that platform, complete with user-agent string and key <code>navigator</code> properties set to their anticipated values, and responsive design mode started up for <code>android</code>. Since interventions only rarely need to actually run on the actual platform they are designed for, this can really save time (though do actually test on the device in question, as especially RDM might not mimic the real thing well enough!).
([https://bugzilla.mozilla.org/show_bug.cgi?id=1968407 Coming soon!]) To test interventions which have only soft requirements for running on a specific platform, pass the <code>--platform-override/-P</code> option to the test framework (with a value of <code>android</code>, <code>linux</code>, <code>mac</code>, or <code>windows</code>). This runs the tests as though running on that platform, complete with user-agent string and key <code>navigator</code> properties set to their anticipated values, and responsive design mode started up for <code>android</code>. Since interventions only rarely need to actually run on the actual platform they are designed for, this can really save time (though do actually test on the device in question, as especially RDM might not mimic the real thing well enough!).


This platform overriding capability may also be very useful for actually developing an intervention. It's possible to work on a test-case while developing an intervention, having that test-case start up a debugging environment for another platform for you, with or without interventions active, and even performing some of the steps to reproduce for you. By simply adding a long-stalling line of code in an appropriate point of the test (like <code>client.await_css("will never match anything", timeout=4000)</code>) it's possible to save quit a bit of time while prototyping an intervention for another platform, especially Android (where the WebCompat issue reproduces in responsive design mode, at least).
This platform overriding capability may also be very useful for actually developing an intervention. It's possible to work on a test-case while developing an intervention, having that test-case start up a debugging environment for another platform for you, with or without interventions active, and even performing some of the steps to reproduce for you. By simply adding a long-stalling line of code in an appropriate point of the test (like <code>client.await_css("will never match anything", timeout=4000)</code>) it's possible to save quite a bit of time while prototyping an intervention for another platform, especially Android (where the WebCompat issue reproduces in responsive design mode, at least).


=== Examples ===
=== Examples ===
31

edits