Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add frontend tests to docs #580

Merged
merged 5 commits into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<!--
Note: All PRs with code changes should be targeted to the `dev` branch, pure documentation changes can target `main`
-->

## Proposed change

<!--
Expand Down
2 changes: 1 addition & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ The endpoints correctly serve the response header fields ``Content-Disposition``
and ``Content-Type`` to indicate the filename for download and the type of content of
the document.

In order to download or preview the original document when an archied document is available,
In order to download or preview the original document when an archived document is available,
supply the query parameter ``original=true``.

.. hint::
Expand Down
28 changes: 28 additions & 0 deletions docs/extending.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ it fixed for everyone!
Before contributing please review our `code of conduct`_ and other important
information in the `contributing guidelines`_.

.. _code-formatting-with-pre-commit-hooks:

Code formatting with pre-commit Hooks
=====================================

Expand Down Expand Up @@ -85,6 +87,7 @@ To do the setup you need to perform the steps from the following chapters in a c
docker run -d -p 6379:6379 --restart unless-stopped redis:latest

7. Install the python dependencies by performing in the src/ directory.

.. code:: shell-session

pipenv install --dev
Expand Down Expand Up @@ -183,6 +186,31 @@ X-Frame-Options are in place so that the front end behaves exactly as in product
relies on you being logged into the back end. Without a valid session, The front end will simply
not work.

Testing and code style:

* The frontend code (.ts, .html, .scss) use ``prettier`` for code formatting via the Git
``pre-commit`` hooks which run automatically on commit. See
:ref:`above <code-formatting-with-pre-commit-hooks>` for installation. You can also run this
via cli with a command such as

.. code:: shell-session

$ git ls-files -- '*.ts' | xargs pre-commit run prettier --files

* Frontend testing uses jest and cypress. There is currently a need for significantly more
frontend tests. Unit tests and e2e tests, respectively, can be run non-interactively with:

.. code:: shell-session

$ ng test
$ npm run e2e:ci

Cypress also includes a UI which can be run from within the ``src-ui`` directory with

.. code:: shell-session

$ ./node_modules/.bin/cypress open

In order to build the front end and serve it as part of django, execute

.. code:: shell-session
Expand Down
13 changes: 13 additions & 0 deletions docs/troubleshooting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ Check for the following issues:
* Go to the admin interface, and check if there are failed tasks. If so, the
tasks will contain an error message.

Consumer warns ``OCR for XX failed``
####################################

If you find the OCR accuracy to be too low, and/or the document consumer warns
that ``OCR for XX failed, but we're going to stick with what we've got since
FORGIVING_OCR is enabled``, then you might need to install the
`Tesseract language files <http://packages.ubuntu.com/search?keywords=tesseract-ocr>`_
marching your document's languages.

As an example, if you are running Paperless-ngx from any Ubuntu or Debian
box, and your documents are written in Spanish you may need to run::

apt-get install -y tesseract-ocr-spa

Consumer fails to pickup any new files
######################################
Expand Down