This guide walks you through setting up the Flextensions app on your local machine and on your Heroku server and preparing it for development and deployment.
git clone git@github.com:berkeley-cdss/flextensions.git
cd flextensions
Install mise, such as brew install mise or any other ruby language manager.
Make sure you are using Ruby 3.3.0:
mise use ruby@3.3
bundle install --without production
brew install postgresql
# Optionally, if it does not start by default
brew services start postgresql@16
/opt/homebrew/opt/postgresql@16/bin/postgres -D /opt/homebrew/var/postgresql@16
sudo apt install postgresql
# Create a postgres user.
sudo su-postgres #(to get into postgres shell)
createuser --interactive --pwprompt #(in postgres shell)0
Save DB_USER and DB_PASSWORD fields in the .env file.
#Start postgres if necessary.
pg ctlcluster 12 main start
#Note: if you are using WSL2 on windows, the command to start postares is
sudo seryice posteresal start
In order to stand up the server you must first install Overmind. Development has been tested with overmind 2.4.0
With Overmind, you can run $make dev or $make
.env.sample to .env.admin on the sidebar on the left, then Click UC Berkeley SandboxDeveloper Keys section on the left sidebar, add an API key.Redirect_URI should be the same as your APP_HOST in .env (See the code block below)CANVAS_CLIENT_ID should be something like 2653xxxxxxxxx; the APP_KEY should be the secret corresponding to it.DB_PORT (default: 5432)
DB_USER (default: postgres)
DB_PASSWORD (default: password)
DB_NAME (default: postgres)
CANVAS_URL (No default, but if you are using instructure sandbox then it should be set as "https://www.instructure.com/canvas?domain=canvas")
CANVAS_CLIENT_ID (Ask the instructor for this. Used for authentication token request)
APP_HOST (URL to the app itself. If you are standing up the app locally then it should be "http://localhost:3000")
In the root directory of Flextensions app, run
make env
run rails db:setup
To start the server locally, run rails server . You should be able to land to the login page.
Hypershield is a tool which allows admins to query data, without relevaing sensitive tokens.
You may need to run:
rake hypershield:refresh:dry_run
APP_HOST
CANVAS_CLIENT_ID
CANVAS_URL
# Active Record Encryption Values
# SMTP Email Settings
heroku login
git remote add golden https://git.heroku.com/flextensions.git
git push golden main
| Test Type | Command |
|---|---|
| RSpec Tests (no a11y) | bundle exec rspec --tag '~a11y' |
| Cucumber Tests (no a11y) | bundle exec cucumber --tags 'not @a11y and not @skip' |
| All Regular Tests | bundle exec rspec --tag '~a11y' && bundle exec cucumber --tags 'not @a11y and not @skip' |
| Accessibility Tests (RSpec) | bundle exec rspec --tag a11y |
| Accessibility Tests (Cucumber) | bundle exec cucumber --tags @a11y |
| All Tests (including a11y) | bundle exec rspec && bundle exec cucumber --tags 'not @skip' |
| Lint Code (RuboCop) | bundle exec rubocop |
| Auto-fix Lint Issues | bundle exec rubocop -A |
| Validate Swagger API | npx @redocly/cli lint app/assets/swagger/swagger.json --extends=minimal |
| Tag | Description |
|---|---|
@javascript |
Tests requiring JS execution in browser (uses Selenium/headless browser), without the tag, it will run in rack, which is exponentially faster to test |
@a11y |
Accessibility tests using axe-core to verify WCAG compliance |
@skip |
Temporarily skipped tests (known failures) |
@wip |
Work In Progress tests still under development |
~ (RSpec) or not (Cucumber) to exclude tagsand/or: --tags '@javascript and not @skip'<a class="nav-link testid-username" href="#"> Tashrique </a>Notice the testid-usernameWe will be using this style in class to grab elements from DOM to test.
Please don’t remove any class that starts with testid-
There are now two separate instances of Canvas, each with it’s own triad of prod/test/beta environments:
We recommend developing in this order: