The Front-end code for Openstax Tutor related projects
- install nvm
- run
nvm install
in this directory to install and use the correct version of node - Alternatively: manually install the right version of node in ./.nvmrc
- Git Clone this repository to the directory of your choice
- If you don’t have
git
installed you can install homebrew and thenbrew install git
cd tutor-js
move into the checked out directoryyarn install
yarn run serve <project>
(where <project is one of tutor|exercises)
- Run the Tutor server as shown below
yarn run serve <project>
starts up a local development webserver which rebuilds files when changed.yarn test <project>
runs unit tests for all projectsyarn run coverage
generates a code coverage reportyarn run build <project> archive
builds minified files for productionyarn run test e2e
run the integration tests using playwright test runner.
To debug e2e failures, you can run in debug mode by adding the --debug
flag. For instance to debug a failure with the course roster spec, you could run: yarn run test e2e --debug roster
. --debug
disables timeouts and is useful in conjuction with adding strategic page.pause()
calls in the spec. The brower will then open and pause at that step, allowing you to open the browser console and inspect it's state.
On Github actions you can download the "test-result" artifacts. Each test failure will generate a screenshot and a trace file. The trace file can be viewed by: yarn run playwright show-trace <path to trace file>
The viewer allows you to view the browser screen and dev console for each test step.
There is also a retries configration that can be adjusted if some specs are inherently flaky.
After local updates are made:
- stop
yarn start
yarn install
- restart
yarn start
Tutor uses playwright for acceptance testing. The tests can be ran by:
- start the stubbed backend server:
yarn run tutor:test:server
- run the e2e test suite:
yarn run tutor:test:e2e
Using the sample API data only allows acting as a student and can't save data. For a more realistic development experience you'll also need to run the Tutor server
- Install Tutor Server as shown in its README file
- Start both the tutor-server Rails application and run
yarn run serve tutor
in this project's directory - Load http://localhost:3001 in your browser
- Once you click login, the server will present a dev console that allows you to select a user
- And will then render the FE just as it appears in production
tutor-js
is also the front-end for Exercises and is ran similarly to the Tutor Server.
- Install OpenStax Exercises as shown in its README file
- Run
yarn run serve exercises
intutor-js
directory - Load http://localhost:3000 in your browser