diff options
| author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-07 21:08:31 +0000 |
|---|---|---|
| committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-07 21:08:31 +0000 |
| commit | d66cbbc11b474dd517564399ae02b26b8f0aac1a (patch) | |
| tree | 2142232cb759d01eb0249f87dda8220a2ec56098 /doc/development/testing_guide | |
| parent | 6d36b38d4d2901c244a0f8bdc4e36549ad821138 (diff) | |
| download | gitlab-ce-d66cbbc11b474dd517564399ae02b26b8f0aac1a.tar.gz | |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development/testing_guide')
| -rw-r--r-- | doc/development/testing_guide/frontend_testing.md | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/doc/development/testing_guide/frontend_testing.md b/doc/development/testing_guide/frontend_testing.md index 6134e0f9959..fc45868d981 100644 --- a/doc/development/testing_guide/frontend_testing.md +++ b/doc/development/testing_guide/frontend_testing.md @@ -819,10 +819,10 @@ often using fixtures to validate correct integration with the backend code. ### Use fixtures -To import a JSON fixture, `import` it using the `test_fixtures` alias. +To import a JSON or HTML fixture, `import` it using the `test_fixtures` alias. ```javascript -import responseBody from 'test_fixtures/some/fixture.json' // loads spec/frontend/fixtures/some/fixture.json +import responseBody from 'test_fixtures/some/fixture.json' // loads tmp/tests/frontend/fixtures-ee/some/fixture.json it('makes a request', () => { axiosMock.onGet(endpoint).reply(200, responseBody); @@ -833,23 +833,6 @@ it('makes a request', () => { }); ``` -For other fixtures, Jest uses `spec/frontend/__helpers__/fixtures.js` to import them in tests. - -The following are examples of tests that work for Jest: - -```javascript -it('uses some HTML element', () => { - loadHTMLFixture('some/page.html'); // loads spec/frontend/fixtures/some/page.html and adds it to the DOM - - const element = document.getElementById('#my-id'); - - // ... - - // Jest does not clean up the DOM automatically - resetHTMLFixture(); -}); -``` - ### Generate fixtures You can find code to generate test fixtures in: |
