libreoffice-online/cypress_test
Tamás Zolnai 9dba400fb1 cypress: tests for applying text properties on text shape (impress, mobile)
Change-Id: I8715b853456b04565db2b524ffec3b6429c657fe
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95032
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2020-05-28 18:56:53 +02:00
..
data cypress: tests for applying text properties on text shape (impress, mobile) 2020-05-28 18:56:53 +02:00
eslint_plugin cypress: add a custom ESLint rule against cy.get().contains() usage. 2020-04-28 18:42:56 +02:00
integration_tests cypress: tests for applying text properties on text shape (impress, mobile) 2020-05-28 18:56:53 +02:00
plugins cypress: enable logging browser side 2020-05-21 19:53:43 +02:00
support cypress: try to fix TypeError: cy.waitUntil is not a function. 2020-04-08 11:11:31 +02:00
.eslintignore cypress: Add node_modules to eslintignore 2020-01-24 09:30:48 +01:00
.eslintrc cypress: add a custom ESLint rule against cy.get().contains() usage. 2020-04-28 18:42:56 +02:00
.gitignore cypress: try to fix TypeError: cy.waitUntil is not a function. 2020-04-08 11:11:31 +02:00
cypress.json cypress: fix running single unit test 2020-05-22 21:08:59 +02:00
Makefile.am cypress: deduplicate config related code in make file. 2020-05-22 23:41:26 +02:00
package.json cypress: update version 4.3.0 -> 4.5.0 2020-05-22 14:58:29 +02:00
README cypress: document the new spec option of make run-* commands. 2020-05-22 23:41:20 +02:00
run_iteratively.sh cypress: add run_iteratively.sh for catching inconsistent test failures. 2020-04-10 13:37:48 +02:00

Cypress based test framework for LibreOffice Online
====================================================


Installation
------------------

You need to have run configure with the --enable-cypress option.

In a normal desktop environment you only need to install npm
packages for running cypress tests. This is done by the build
system, so running 'make check' will do the basic installation.
https://docs.cypress.io/guides/getting-started/installing-cypress.html#npm-install

For CI you might need to install some additional dependencies:
https://docs.cypress.io/guides/guides/continuous-integration.html#Dependencies


Running tests
------------------

All tests are part of the make check build. So you can
just execute it from the root folder or under the
cypress_test folder to run cypress tests only.

    make check

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.

To run cypress test cases selectively, you need to
go in to the cypress_test folder first and run one of
the following commands.

To run all desktop tests:

    make check-desktop

To run all mobile tests:

    make check-mobile

To run one specific test suite of desktop tests,
use spec argument with a relative path to
cypress_test/integration_tests/desktop/:

    make check-desktop spec=writer/form_field_spec.js

To run one specific test suite of mobile tests,
use spec argument with a relative path to
cypress_test/integration_tests/mobile/:

    make check-mobile spec=writer/toolbar_spec.js


Running one specific test
------------------

To run one test case of a test suite you can use Mocha's
'only' feature. Just replace the it(...) function with
it.only(...) in the spec file for the selected test case
and run the test suite using the spec parameter.

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() {

Then run the test suite with:

    make check-mobile spec=writer/apply_font_spec.js

Or open the test suite in the interactive test runner:

    make run-mobile spec=writer/apply_font_spec.js

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

To open desktop tests in the test runner:

    make run-desktop

To open mobile tests in the test runner:

    make run-mobile

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

During the build we run the tests with Chrome browser, so make sure
you select Chrome browser on the GUI while checking tests.
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.