Larvitar Documentation
Home
Guide
API
GitHub
Home
Guide
API
GitHub
  • API

    • Initializing
    • Parsing
    • Loading
    • Rendering
    • Interacting
    • Testing
    • Modules

      • Logger
      • Store
      • Managers

        • Image Manager
        • GSPS Manager
        • File Manager
      • Parsers

        • PDF Parser
        • NRRD Parser
        • ECG Parser
      • Loaders
        • DICOM Loader
        • MultiFrame Loader
        • SingleFrame Loader
        • DSA Image Loader
        • File Loader
        • Nrrd Loader
      • Interaction Tools

        • Initialize and manage Tools
        • Default and Custom Tools
        • Segmentation Tools
        • DvTools
      • Utilities

        • DICOM Anonymization
        • DICOM Customization
        • Tags
        • Utils
        • Memory
      • Post Processing

        • DSA
      • Visualizations

        • Layers
        • ECG
        • Color Maps
        • Greyscale Presentation States
      • Testing
Larvitar

Automatic Tests in Larvitar

Cypress is a modern, fast, and reliable JavaScript-based end-to-end testing framework designed for web applications. It allows developers to write tests that interact with the UI, simulate user actions, and verify application behavior. Unlike Selenium, Cypress runs directly in the browser, providing better debugging capabilities and a more intuitive API.

How Cypress Works in These Tests

Cypress operates by executing commands sequentially, ensuring that each step completes before moving to the next. In these tests, Cypress:

  • Visits the example html page to initialize the application and ensure the dicom is correctly rendered as beforeEach action.
  • Uses cy.get() to locate elements within the DOM and assert their properties.
  • Utilizes cy.window() to interact with the JavaScript context of the page.
  • Triggers events like clicks, keyboard presses, and scrolls to simulate user actions.
  • Ensures proper test execution with assertions such as should() and expect().

How to run existing Tests

You can run Cypress tests in Larvitar using the following yarn commands:

// Open Cypress Test Runner in interactive mode
yarn cypress

//Run all tests headlessly (for CI environments)
yarn cypress:run

Continuous Integration

Larvitar's tests run automatically when a PR is opened through GitHub Actions. The workflow:

  • Triggers on pull request events
  • Sets up the environment with Node.js
  • Installs dependencies
  • Builds the project
  • Runs Cypress tests headlessly
  • Generates test reports that can be reviewed in the PR

This ensures that all code changes are validated against the test suite before merging, maintaining code quality and preventing regressions.

D/Vision Lab
Last Updated:
Contributors: Laura Borghesi, Simone "Lateralus" Manini
Prev
Interacting