Browse Source

Maintenance: Added improvements for the developer manual.

Dominik Klein 2 years ago
parent
commit
6a51df664b

+ 34 - 0
doc/developer_manual/cookbook/how-to-test-with-vitest-and-cypress.md

@@ -0,0 +1,34 @@
+# How to Test With Vitest and Cypress
+
+The frontend tests are implemented in Vitest.
+For the Vue.js 3 component tests we use the "Testing Library", which is a offset of the Vue test utils suite.
+
+As an addition to the normal unit tests and component tests, we have a suite for frontend integration tests.
+
+In situations where the testing with pure Node.js is not possible, we are using the cypress component
+testing functionality. For example we are using this for testing the editor.
+
+## Running
+
+### Vitest
+
+The tests will be executed in watch mode by default.
+
+- Run a single test: `yarn test CommonLink.spec.ts`
+- Run a single test case from one test file: `yarn test FieldSelect.spec.ts -t "supports keyboard navigation"`
+- Run all tests: `yarn test`
+
+Check the Vitest [CLI documentation](https://vitest.dev/guide/cli.html#options) for more possibilities.
+
+### Cypress
+
+First, the Cypress dependencies needs to be installed: `yarn cypress:install`.
+
+Then you can run `yarn test:ct`, which opens an UI in the selected browser. Here the different tests
+can be executed.
+
+## Tooling
+
+- [Vitest - Vite-native unit test framework](https://vitest.dev/)
+- [Testing suite utils for Vue.js 3](https://test-utils.vuejs.org/) and [Testing Library family](https://testing-library.com/docs/vue-testing-library/intro/)
+- [Cypress component testing](https://docs.cypress.io/guides/component-testing)

+ 7 - 0
doc/developer_manual/cookbook/how-to-use-debuggers.md

@@ -1,5 +1,12 @@
 # How to Use Debuggers With Zammad
 
+There is not much explanation needed on how to code. But there always comes the time where you get stuck. We made pretty good experience with the following tools in such situations:
+
+- `pry`
+- `pry-remote`
+- `pry-rescue`
+- `byebug`
+
 ## `forego` + debuggers = 🤦
 
 If you’re used to inserting debugging breakpoints into your code (_e.g.,_ with Pry or Byebug), `forego` may throw you for a loop — since it manages the output of multiple processes, [**your debugger prompt will appear briefly on the screen and then fly past it, along with the STDOUT of any other processes `forego` is overseeing**](https://github.com/ddollar/foreman/issues/58).

+ 1 - 0
doc/developer_manual/index.md

@@ -22,6 +22,7 @@ Welcome to the developer docs of Zammad. 👋 This is a work in progress, and yo
 - [How to use debuggers with Zammad](cookbook/how-to-use-debuggers.md)
 - [How to test with RSpec / Capybara](cookbook/how-to-test-with-rspec-and-capybara.md)
 - [How to test with QUnit](cookbook/how-to-test-with-qunit.md)
+- [How to test with Vitest and Cypress](cookbook/how-to-test-with-vitest-and-cypress.md)
 
 # How to Contribute