@@ -9,24 +9,58 @@ Front-end testing
9
9
=================
10
10
11
11
Bedrock runs a suite of front-end `Jasmine `_ behavioral/unit tests, which use
12
- `Karma `_ as a test runner. We also have a suite of functional tests using
12
+ `Jasmine Browser Runner `_ as a test runner. We also have a suite of functional tests using
13
13
`Selenium `_ and `pytest `_. This allows us to emulate users interacting with a
14
- real browser. All these test suites live in the ``tests `` directory.
14
+ real browser. All these test suites live in the ``tests `` directory. To run the tests locally,
15
+ you must also first download `geckodriver `_ and `chromedriver `_ and make it available
16
+ in your system path. You can alternatively specify the path to geckodriver and chromedriver
17
+ using the command line (see the `pytest-selenium documentation `_ for more information).
15
18
16
19
The ``tests `` directory comprises of:
17
20
18
21
* ``/functional `` contains pytest tests.
19
22
* ``/pages `` contains Python page objects.
20
- * ``/unit `` contains the Jasmine tests and Karma config file.
23
+ * ``/unit `` contains the Jasmine tests and Jasmine Browser Runner config file.
21
24
22
25
Installation
23
26
------------
24
27
25
28
First follow the :ref: `installation instructions for bedrock<install> `, which
26
29
will install the dependencies required to run the various front-end test suites.
27
30
31
+ To download geckodriver and chromedriver and have it ready to run in your system, there are a couple of ways:
28
32
29
- Running Jasmine tests using Karma
33
+ - Download geckdriver's `latest release `_ and add it to your system path:
34
+
35
+ .. code-block :: bash
36
+
37
+ cd /path/to/your/downloaded/files/
38
+ mv geckodriver /usr/local/bin/
39
+
40
+ - If you're on MacOS, download geckodriver directly using Homebrew, which automatically places it in your system path:
41
+
42
+ .. code-block :: bash
43
+
44
+ brew install geckodriver
45
+
46
+
47
+ - Download chromedriver's `latest release <https://chromedriver.chromium.org/downloads >`_ and add it to your system path:
48
+
49
+ .. code-block :: bash
50
+
51
+ cd /path/to/your/downloaded/files/
52
+ mv chromedriver /usr/local/bin/
53
+
54
+ - If you're on MacOS, download chromedriver directly using Homebrew/Cask, which automatically places it in your system path:
55
+
56
+ .. code-block :: bash
57
+
58
+ brew tap homebrew/cask
59
+
60
+ brew cask install chromedriver
61
+
62
+
63
+ Running Jasmine tests using Jasmine Browser Runner
30
64
---------------------------------
31
65
32
66
To perform a single run of the Jasmine test suite using Firefox and Chrome,
49
83
50
84
.. code-block :: bash
51
85
52
- $ npm run karma
86
+ $ npm run test
53
87
54
88
See the `Jasmine `_ documentation for tips on how to write JS behavioral or unit
55
89
tests. We also use `Sinon `_ for creating test spies, stubs and mocks.
@@ -62,25 +96,7 @@ Running functional tests
62
96
Before running the functional tests, please make sure to follow the bedrock
63
97
:ref: `installation docs<install> `, including the database sync that is needed
64
98
to pull in external data such as event/blog feeds etc. These are required for
65
- some of the tests to pass. To run the tests using Firefox, you must also first
66
- download `geckodriver `_ and make it available in your system path. You can
67
- alternatively specify the path to geckodriver using the command line (see the
68
- `pytest-selenium documentation `_ for more information).
69
-
70
- To download geckodriver and have it ready to run in your system, there are a couple of ways:
71
-
72
- - Download its `latest release `_ and add it to your system path:
73
-
74
- .. code-block :: bash
75
-
76
- cd /path/to/your/downloaded/files/
77
- mv geckodriver /usr/local/bin/
78
-
79
- - If you're on MacOS, download it directly using Homebrew, which automatically places it in your system path:
80
-
81
- .. code-block :: bash
82
-
83
- brew install geckodriver
99
+ some of the tests to pass.
84
100
85
101
To run the full functional test suite against your local bedrock instance in
86
102
Mozorg mode:
@@ -320,7 +336,7 @@ These tests and are run as part of the pipeline to ensure that download links co
320
336
via product details are well formed and return valid 200 responses.
321
337
322
338
.. _Jasmine : https://jasmine.github.io/index.html
323
- .. _ Karma : https://karma-runner .github.io/
339
+ .. _ Jasmine Browser Runner : https://jasmine .github.io/setup/browser.html
324
340
.. _Sinon : http://sinonjs.org/
325
341
.. _Selenium : http://docs.seleniumhq.org/
326
342
.. _pytest : http://pytest.org/latest/
@@ -337,3 +353,4 @@ via product details are well formed and return valid 200 responses.
337
353
.. _Basket : https://github.com/mozilla/basket
338
354
.. _geckodriver : https://github.com/mozilla/geckodriver/releases/latest
339
355
.. _latest release : https://github.com/mozilla/geckodriver/releases/
356
+ .. _chromedriver : https://chromedriver.chromium.org/downloads
0 commit comments