Skip to content

Document and enhance Cypress tests

Loic Huder requested to merge cypress-ci into main

Follow-up of !76 (merged)

That was quite the trip but I managed to fix all the issues I faced with Cypress lately.

Cypress testing was not documented

I therefore adapted the documentation written by Axel in h5web.

Visual regression tests could fail when launched locally

This is because the screenshots depends on the GPU, which can be different between the CI and the local machine.

To prevent this, the check against the existing screenshot is only done when the env variable CYPRESS_TAKE_SNAPSHOTS is set. Again, this follows the h5web workflow.

The test that needs to click on the Rings button sometimes failed

The button could indeed be detached from the DOM when the toolbar hasn't finished measuring its children (which is how the toolbar knows what controls to put in the More Controls menu).

To fix it, I now wait for the DOM to be stable before clicking on the button using the plugin cypress-wait-for-stable-dom.

@bocciare Note that we could use the plugin directly as the export issue was fixed in 0.0.3. Perhaps we should do the same in h5web.

Cypress binary was not cached

My tentative fix in 28756df0 was in fact not working as folders outside the project directory cannot be cached. So following Cypress doc on Gitlab CI, I set the cache of the Cypress binary in .cypress-cache and it seems to work.

Note that I need to add .cypress-cache to .prettierignore to avoid to check the folder with prettier in the lint stage. It is not necessary to add it to .eslintignore as eslint ignores dot-files and dot-folders.

Edited by Loic Huder

Merge request reports