diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2019-05-27 12:32:20 +0000 |
---|---|---|
committer | Winnie Hellmann <winnie@gitlab.com> | 2019-05-27 12:32:20 +0000 |
commit | 0d36a1de300e56d374759db07c3dfdf72780352a (patch) | |
tree | 64078313f3e32d41de1e5c859f2004d86333d058 | |
parent | 14917eb307b9506f98e4ede3441d37b62b1145a3 (diff) | |
download | gitlab-ce-winh-frontend-fixtures-docs.tar.gz |
Reword fixtures documentationwinh-frontend-fixtures-docs
-rw-r--r-- | doc/development/testing_guide/frontend_testing.md | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/doc/development/testing_guide/frontend_testing.md b/doc/development/testing_guide/frontend_testing.md index 1991dfac613..7a7639f5047 100644 --- a/doc/development/testing_guide/frontend_testing.md +++ b/doc/development/testing_guide/frontend_testing.md @@ -409,7 +409,7 @@ See this [section][vue-test]. For running the frontend tests, you need the following commands: -- `rake karma:fixtures` (re-)generates fixtures. +- `rake karma:fixtures` (re-)generates [fixtures](#frontend-test-fixtures). - `yarn test` executes the tests. As long as the fixtures don't change, `yarn test` is sufficient (and saves you some time). @@ -459,12 +459,13 @@ Information on setting up and running RSpec integration tests with ## Frontend test fixtures -Code that is added to HAML templates (in `app/views/`) or makes Ajax requests to the backend has tests that require HTML or JSON from the backend. Fixtures for these tests is located at: +Code that is added to HAML templates (in `app/views/`) or makes Ajax requests to the backend has tests that require HTML or JSON from the backend. +Fixtures for these tests are located at: -- `spec/javascripts/fixtures/`. -- `ee/spec/javascripts/fixtures/`, for EE-specific code tests. +- `spec/javascripts/fixtures/`, for running tests in CE. +- `ee/spec/javascripts/fixtures/`, for running tests in EE. -Tests in: +Fixture files in: - The Karma test suite are served by [jasmine-jquery](https://github.com/velesin/jasmine-jquery). - Jest use `spec/frontend/helpers/fixtures.js`. @@ -490,14 +491,13 @@ it('uses some HTML element', () => { }); ``` -HTML and JSON fixtures from backend views and controllers are generated -using RSpec (see `spec/javascripts/fixtures/*.rb`). +HTML and JSON fixtures are generated from backend views and controllers using RSpec (see `spec/javascripts/fixtures/*.rb`). For each fixture, the content of the `response` variable is stored in the output file. This variable gets automagically set if the test is marked as `type: :request` or `type: :controller`. Fixtures are regenerated using the `bin/rake karma:fixtures` command but you can also generate them individually, for example `bin/rspec spec/javascripts/fixtures/merge_requests.rb`. -When creating a new fixture, it often makes sense to take a look at the corresponding tests for the endpoint in `spec/controllers/` or `spec/requests/`. +When creating a new fixture, it often makes sense to take a look at the corresponding tests for the endpoint in `(ee/)spec/controllers/` or `(ee/)spec/requests/`. ## Gotchas |