UI dev environment
Overview
if you’re in Windows you need to install WSL or use Github code spaces
Using OntoPortal UI utility script
Install docker
To see how to install docker and docker compose, see https://docs.docker.com/compose/install/
Clone the code
Choose a version of code to clone https://github.com/ontoportal-lirmm/bioportal_web_ui/ , https://github.com/ncbo/bioportal_web_ui/, or https://github.com/ontoportal/ontoportal_web_ui (or your own version)
Read the help
bin/ontoportal help
You should see something like this:
Usage: bin/ontoportal {dev|test|run|help} [--reset-cache] [--api-url API_URL] [--api-key API_KEY]
dev : Start the Ontoportal API development server.
Example: bin/ontoportal dev --api-url http://localhost:9393
Use --reset-cache to remove volumes: bin/ontoportal dev --reset-cache
test : Run tests.
run : Run a command in the Ontoportal API Docker container.
help : Show this help message.
Description:
This script provides convenient commands for managing an Ontoportal API
application using Docker Compose. It includes options for starting the development server,
running tests, and executing commands within the Ontoportal API Docker container.
Goals:
- Simplify common tasks related to Ontoportal API development using Docker.
- Provide a consistent and easy-to-use interface for common actions.Run a development server
bin/ontoportal dev --api-url <api url> --api-key <apikey>
Example for stageportal.lirmm.fr
bin/ontoportal dev --api-key 1de0a270-29c5-4dda-b043-7c3580628cd5 --api-url https://data.stageportal.lirmm.fr/
Open the browser at http://localhost:3000 to see the running server
By default, the script creates and uses these configuration files .env and config/bioportal_config_development.rb , config/database.yml created respectively from the samples .env.sample , config/bioportal_config_env.rb.sample and config/database.yml.sample
Run tests using a local OntoPortal API
bin/ontoportal test
This will run a local API and run integration and controller tests
Integration Tests: Integration tests in Rails focus on testing interactions between different components or subsystems of your application. They ensure that various parts of your application work together as expected.
Example: Suppose you want to test the interaction between the UsersController and SessionsController in your application. You can write an integration test to simulate signing up a new user and then logging in with the newly created user.
Functional Tests (also known as Controller Tests): Controller tests in Rails focus on testing the behavior of controllers in response to HTTP requests. They ensure that the controllers handle requests correctly and produce the expected responses.
Example: Let's say you have a UsersController responsible for handling user-related actions like creating a new user. You can write a controller test to verify that the create action behaves as expected.
Run system tests using a local OntoPortal API
bin/ontoportal test test/system/*
This will run a local API and virtual machine with Chrome and run system tests
System Tests (or End-to-End Tests): System tests in Rails simulate user interactions with your application through a web browser. They test the application's functionality from end to end, including the interaction between various components like controllers, views, and JavaScript.
Example: Suppose you want to test the functionality of signing up a new user on your Rails application. You can write a system test to simulate a user visiting the sign-up page, filling out the form, submitting it, and then verifying that the user is redirected to the correct page after signing up.
Run a specific test file on a local OntoPortal API
bin/ontoportal test test/system/login_flows_test.rb:22
this will the test in the line 22 of the file test/system/login_flows_test.rb