2020-01-12 05:27:59 -06:00
|
|
|
Cypress based test framework for LibreOffice Online
|
|
|
|
====================================================
|
|
|
|
|
2020-01-31 09:03:18 -06:00
|
|
|
|
2020-01-21 11:00:23 -06:00
|
|
|
Installation
|
|
|
|
------------------
|
2020-03-20 03:20:23 -05:00
|
|
|
|
|
|
|
You need to have run configure with the --enable-cypress option.
|
|
|
|
|
2020-01-23 07:48:21 -06:00
|
|
|
In a normal desktop environment you only need to install npm
|
|
|
|
packages for running cypress tests. This is done by the build
|
2020-01-21 11:00:23 -06:00
|
|
|
system, so running 'make check' will do the basic installation.
|
|
|
|
https://docs.cypress.io/guides/getting-started/installing-cypress.html#npm-install
|
|
|
|
|
2020-01-23 07:48:21 -06:00
|
|
|
For CI you might need to install some additional dependencies:
|
2020-01-21 11:00:23 -06:00
|
|
|
https://docs.cypress.io/guides/guides/continuous-integration.html#Dependencies
|
|
|
|
|
2020-01-31 09:03:18 -06:00
|
|
|
|
2020-01-12 05:27:59 -06:00
|
|
|
Running tests
|
|
|
|
------------------
|
|
|
|
|
|
|
|
All tests are part of the make check build. So you can
|
2020-01-14 07:19:06 -06:00
|
|
|
just execute it from the root folder or under the
|
|
|
|
cypress_test folder to run cypress tests only.
|
2020-01-12 05:27:59 -06:00
|
|
|
|
|
|
|
make check
|
|
|
|
|
2020-03-20 05:51:26 -05:00
|
|
|
IMPORTANT: Before stepping under cypress_test folder
|
|
|
|
and running any command listed here, make sure you've
|
|
|
|
done a top-level make, so everything is up-to-date.
|
|
|
|
Running commands from under cypress_test folder won't
|
|
|
|
trigger a rebuild.
|
|
|
|
|
2020-01-15 07:55:03 -06:00
|
|
|
To run cypress test cases selectively, you need to
|
|
|
|
go in to the cypress_test folder first and run one of
|
|
|
|
the following commands.
|
2020-01-13 13:20:30 -06:00
|
|
|
|
2020-01-12 05:27:59 -06:00
|
|
|
To run all desktop tests:
|
|
|
|
|
2020-01-14 12:37:17 -06:00
|
|
|
make check-desktop
|
2020-01-12 05:27:59 -06:00
|
|
|
|
|
|
|
To run all mobile tests:
|
|
|
|
|
2020-01-14 12:37:17 -06:00
|
|
|
make check-mobile
|
2020-01-12 05:27:59 -06:00
|
|
|
|
2020-05-22 15:47:10 -05:00
|
|
|
To run one specific test suite of desktop tests,
|
2020-02-12 11:01:47 -06:00
|
|
|
use spec argument with a relative path to
|
2020-03-20 05:51:26 -05:00
|
|
|
cypress_test/integration_tests/desktop/:
|
2020-01-13 13:20:30 -06:00
|
|
|
|
2020-05-22 15:47:10 -05:00
|
|
|
make check-desktop spec=writer/form_field_spec.js
|
2020-01-13 13:20:30 -06:00
|
|
|
|
2020-05-22 15:47:10 -05:00
|
|
|
To run one specific test suite of mobile tests,
|
2020-02-12 11:01:47 -06:00
|
|
|
use spec argument with a relative path to
|
2020-03-20 05:51:26 -05:00
|
|
|
cypress_test/integration_tests/mobile/:
|
2020-01-13 13:20:30 -06:00
|
|
|
|
2020-02-12 11:01:47 -06:00
|
|
|
make check-mobile spec=writer/toolbar_spec.js
|
2020-01-13 13:20:30 -06:00
|
|
|
|
2020-01-31 09:03:18 -06:00
|
|
|
|
|
|
|
Running one specific test
|
|
|
|
------------------
|
|
|
|
|
2020-05-22 15:47:10 -05:00
|
|
|
To run one test case of a test suite you can use Mocha's
|
2020-01-20 09:25:58 -06:00
|
|
|
'only' feature. Just replace the it(...) function with
|
|
|
|
it.only(...) in the spec file for the selected test case
|
2020-05-22 15:47:10 -05:00
|
|
|
and run the test suite using the spec parameter.
|
2020-01-31 09:03:18 -06:00
|
|
|
|
|
|
|
For example, to run the test with title 'Apply font name.'
|
|
|
|
inside apply_font_spec.js file, you need to add it.only():
|
|
|
|
|
|
|
|
- it('Apply font name.', function() {
|
|
|
|
+ it.only('Apply font name.', function() {
|
|
|
|
|
2020-05-22 15:47:10 -05:00
|
|
|
Then run the test suite with:
|
2020-01-31 09:03:18 -06:00
|
|
|
|
2020-02-12 11:01:47 -06:00
|
|
|
make check-mobile spec=writer/apply_font_spec.js
|
2020-01-31 09:03:18 -06:00
|
|
|
|
2020-05-22 15:47:10 -05:00
|
|
|
Or open the test suite in the interactive test runner:
|
2020-05-18 09:04:00 -05:00
|
|
|
|
|
|
|
make run-mobile spec=writer/apply_font_spec.js
|
2020-01-20 09:25:58 -06:00
|
|
|
|
2020-01-21 11:00:23 -06:00
|
|
|
Openning interactive test runner
|
|
|
|
----------------------------------
|
|
|
|
|
|
|
|
Cypress has an interactive test runner application which
|
|
|
|
runs the test in the browser. So you can see the result of
|
|
|
|
the different steps your test makes in the browser. It's useful
|
|
|
|
during writing new tests or checking why an existing
|
|
|
|
test fails.
|
|
|
|
https://docs.cypress.io/guides/core-concepts/test-runner.html
|
2020-01-12 05:27:59 -06:00
|
|
|
|
2020-01-21 11:00:23 -06:00
|
|
|
To open desktop tests in the test runner:
|
2020-01-12 05:27:59 -06:00
|
|
|
|
2020-01-15 07:55:03 -06:00
|
|
|
make run-desktop
|
2020-01-12 05:27:59 -06:00
|
|
|
|
2020-01-21 11:00:23 -06:00
|
|
|
To open mobile tests in the test runner:
|
2020-01-12 05:27:59 -06:00
|
|
|
|
2020-01-15 07:55:03 -06:00
|
|
|
make run-mobile
|
2020-01-13 13:20:30 -06:00
|
|
|
|
2020-05-22 15:47:10 -05:00
|
|
|
To open one specific test suite of desktop tests,
|
|
|
|
use spec argument with a relative path to
|
|
|
|
cypress_test/integration_tests/desktop/:
|
|
|
|
|
|
|
|
make run-desktop spec=writer/form_field_spec.js
|
|
|
|
|
|
|
|
To open one specific test suite of mobile tests,
|
|
|
|
use spec argument with a relative path to
|
|
|
|
cypress_test/integration_tests/mobile/:
|
|
|
|
|
|
|
|
make run-mobile spec=writer/toolbar_spec.js
|
|
|
|
|
2020-01-13 13:20:30 -06:00
|
|
|
During the build we run the tests with Chrome browser, so make sure
|
|
|
|
you select Chrome browser on the GUI while checking tests.
|
2020-01-21 11:00:23 -06:00
|
|
|
We are using different configuration and environment variables for
|
|
|
|
mobile and desktop tests, that's why there are two separate commands
|
|
|
|
for them and there is no option to open all the tests in the
|
|
|
|
test runner.
|