Commit 4a306e65 4a306e6509aefec19065898c94c52409e99ed564 by Nicolas Perriault

refs #728 - added notes about preconfigured casper test instance overriding

1 parent 8bbd83e0
...@@ -99,6 +99,7 @@ The `casperjs` command has three available options: ...@@ -99,6 +99,7 @@ The `casperjs` command has three available options:
99 .. warning:: 99 .. warning::
100 100
101 .. deprecated:: 1.1 101 .. deprecated:: 1.1
102
102 ``--direct`` option has been renamed to ``--verbose``, though ``--direct`` will still works, while is to be considered deprecated. 103 ``--direct`` option has been renamed to ``--verbose``, though ``--direct`` will still works, while is to be considered deprecated.
103 104
104 Example: 105 Example:
......
...@@ -330,6 +330,17 @@ Of course, it's a whole lot more verbose, but Casper provides convenient methods ...@@ -330,6 +330,17 @@ Of course, it's a whole lot more verbose, but Casper provides convenient methods
330 this.echo('Element HTML is now: ' + this.getElementInfo('h1').html); 330 this.echo('Element HTML is now: ' + this.getElementInfo('h1').html);
331 }); 331 });
332 332
333 .. _faq_test_casper_instance:
334
335 Why can't I create a new `casper` instance in a test environment?
336 -----------------------------------------------------------------
337
338 The `casperjs test` :ref:`subcommand <test_subcomand>` is a convenient utility which bootstraps and configures a :ref:`test environment <testing>` for you, so a preconfigured `casper` object is already available in your test script when using this command.
339
340 As of 1.1-beta3, you're prevented to override this preconfigured instance at this practice prevents the test runner to work properly. If you try to create a new casper instance in a test script, you'll get an error and CasperJS will exit with an error message with a link pointing to the documentation.
341
342 One may argue this is mostly related to some hostorical bad design decision, and she might be true. This behavior is not likely exist anymore in a future 2.0.
343
333 .. _faq_javascript: 344 .. _faq_javascript:
334 345
335 Okay, honestly, I'm stuck with Javascript. 346 Okay, honestly, I'm stuck with Javascript.
......
...@@ -12,9 +12,10 @@ CasperJS ships with its own :doc:`testing framework <modules/tester>`, providing ...@@ -12,9 +12,10 @@ CasperJS ships with its own :doc:`testing framework <modules/tester>`, providing
12 12
13 .. versionchanged:: 1.1 13 .. versionchanged:: 1.1
14 14
15 The testing framework — hence its whole API — can only be used when using the ``casperjs test`` subcommand. 15 The testing framework — hence its whole API — can only be used when using the ``casperjs test`` subcommand:
16 16
17 If you try to use the ``casper.test`` property out of the testing environment, you'll get an error. 17 - If you try to use the ``casper.test`` property out of the testing environment, you'll get an error;
18 - As of 1.1-beta3, you can't override the preconfigured ``casper`` instance in this test environment. You can read more about the whys in the :ref:`dedicated FAQ entry <faq_test_casper_instance>`.
18 19
19 .. index:: Unit testing 20 .. index:: Unit testing
20 21
...@@ -135,6 +136,7 @@ The :ref:`Tester#begin() <tester_begin>` accepts either a function or an object ...@@ -135,6 +136,7 @@ The :ref:`Tester#begin() <tester_begin>` accepts either a function or an object
135 } 136 }
136 }); 137 });
137 138
139 .. _test_subcomand:
138 140
139 Test command args and options 141 Test command args and options
140 ----------------------------- 142 -----------------------------
......