joplin-ui-tests

March 10, 2022 · View on GitHub

ui-tests

System tests for the joplin desktop application in python.

Motivation

Main motivation is to learn how an electron app can be tested with selenium.

Requirements

Example for ubuntu 20.04:

sudo apt install ffmpeg xvfb
pip install -r requirements.txt

Test Overview

What is tested?

All tests of the following table are successfully executed, except of the tests marked with ☒.

SectionFunction / FeatureByComment
GeneralFocus note listHotkey
Top menu
Focus note titleHotkey
Top menu
Focus note bodyHotkey
Top menu
Focus sidebarHotkey
Top menu
Go backTop menu
Go forwardTop menu
Goto anythingHotkey☑ Notebooks ☒ Tags and notes
Top menu
Show app title-
Change app layoutTop menuSmoke test
Toggle sidebarHotkey
Top menu
Toggle note listHotkey
Top menu
Zoom (in, out, reset)Hotkey
Top menu☒ Slow
EditorShow note propertiesButton
Toggle layoutButton
Hotkey
Top menu
NotelistAdd noteButton
Hotkey
Top menu
Add todoButton
Hotkey
Top menu
Delete noteHotkey☒ Cause not clear
Right click☒ Cause not clear
Duplicate noteRight click
Switch type (note - todo)Right click
Complete todoClick
Get linkRight click
SidebarSynchronise buttonClickSmoke test
Add notebookButton
Right click
Top menu
Add sub notebookRight click
Top menu
Delete notebookHotkey☒ Cause not clear
Right click☒ Cause not clear
Rename notebookRight click
Note count label-☒ Not displayed for long notebook names
Notebook collapsingClick
Show all notes buttonClick
Drag notebookClick☒ Webdriver bug
Export notebookClick☒ Download dialog doesn't work
Add tagBottom bar
Hotkey
Right click
Top menu
Delete tagRight click☒ Cause not clear
Rename tagRight click
Tag collapsingClick

What is not tested?

Except of the marked tests in the table above, there are some other untested features:

Usage

Don't run with your normal joplin profile, since the tests are modifying and deleting the content!

python run_tests.py

Test structure

The tests are usually structured in the following way:

  1. set the preconditions via API
  2. do the UI action
  3. check the results via API

Single tests are not independent. Only test classes are mostly independent, since that saves much time. The webdriver and xvfb session are shared through all tests.

Lessons learned

  • Don't use language dependent locators. There were several problems, because my system language is german, but at the reference, I used english.
  • Recording the full testsuite can be very valuable. For example at the frame by frame playback, it was visible that the top menu did lose focus, because the label count was updated one frame after focussing.
  • find_elements* is time consuming, since it has to search the full tree. In contrast find_element* returns the first found item.