libreoffice-online/cypress_test
Ashod Nakashian 3bafa7d4ab leaflet: maintain the keyboard state after toolbar actions
Previously we supressed the keyboard after toolbar
actions, but that is problematic because then the
user is unable to delete/replace selected text,
because the keyboard is hidden and there is no way
of showing keyboard without changing the selection.

Now we maintain the keyboard state, which is likely
visible, since a selection shows the keyboard.

This might not be ideal, because the user might
hide the keyboard on the device and we will restore
it after invoking a toolbar action, but at least
it's more usable now. Unfortunately, there is no
API to track the keyboard visibility.

New Cypress tests added to validate the above.

The tests depend on checking the last keyboard
visibility state in Map, because there is no
reliable (or any?) way to know whether the keyboard
is visible or not. There are many cases where we
actually hide the keyboard, while having the input
focus on the textarea element, so that is no indication
that the keyboard is visible. We do this for usability
purposes. For example, during zooming, when selecting
cells and graphics/shapes, etc.

The purpose of the cell is to validate that we restored
the keyboard visibility or we changed it, depending
on which is expected after each operation.

Change-Id: If0f2e96909ff20753043734789397d190cedb502
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90663
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-03-18 07:30:08 +01:00
..
data cypress: calc-mobile: add tests for spellchecking menu. 2020-03-17 18:23:10 +01:00
integration_tests leaflet: maintain the keyboard state after toolbar actions 2020-03-18 07:30:08 +01:00
plugins cypress: integrate cypress-failed-log package. 2020-03-13 15:00:54 +01:00
support cypress: integrate cypress-failed-log package. 2020-03-13 15:00:54 +01:00
.eslintignore
.gitignore cypress: integrate cypress-failed-log package. 2020-03-13 15:00:54 +01:00
cypress.json cypress: integrate cypress-failed-log package. 2020-03-13 15:00:54 +01:00
Makefile.am cypress: calc-mobile: add tests for spellchecking menu. 2020-03-17 18:23:10 +01:00
package.json cypress: integrate cypress-failed-log package. 2020-03-13 15:00:54 +01:00
README cypress: mobile: Organize tests based on component. 2020-02-12 19:14:42 +01:00

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



Installation
------------------
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

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 suit of desktop tests,
use spec argument with a relative path to
cypress_test/data/desktop/:

    make check-desktop spec=example_desktop_test_spec.js

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

    make check-mobile spec=writer/toolbar_spec.js


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

To run one test case of a test suit 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 suit 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 suit with:

    make check-mobile spec=writer/apply_font_spec.js

Or open the file in the interactive test runner.

    make run-mobile


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

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.