Laura-TM / ldn7-slackdashbord

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Slacktastic App

Deploy to Heroku

Setup

Pick one member of the team to own the repository and pipeline. That person should do the following:

  1. Click the "Use this template" button above (see GitHub's docs) to create your team repository, select "Include all branches" and name it something appropriate for your project.
  2. In your new repo, go to "Settings", then "Branches", then switch the default branch to postgres (optional: you can now delete the old master branch and rename postgres to master, main or whatever else you'd like) - see GitHub's docs again
  3. In your repo, click the "Deploy to Heroku" button at the top of the README and create a Heroku account when prompted.
  4. Fill in the name of the application, select Europe and then click "Deploy App".
  5. Once it has deployed successfully, click the "Manage app" button to view the application details.
  6. Go to the "Deploy" tab, select "Connect to GitHub" and choose your repo.
  7. Click "Enable automatic deploys".

Whenever you commit to master (or e.g. merge a pull request) it will get automatically deployed!

You should now make sure all of the project team are collaborators on the repository.

Scripts

Various scripts are provided in the package file, but many are helpers for other scripts; here are the ones you'll commonly use:

  • dev: starts the frontend and backend in dev mode, with file watching (note that the backend runs on port 3100, and the frontend is proxied to it).
  • lint: runs ESLint and Prettier against all the code in the project.
  • serve: builds and starts the app in production mode locally.

Debugging

While running the dev mode using npm run dev, you can attach the Node debugger to the server process via port 9229. If you're using VS Code, a debugging configuration is provided for this.

There is also a VS Code debugging configuration for the Chrome debugger, which requires the recommended Chrome extension, for debugging the client application.

Troubleshooting

See the guidance in the wiki.

Setting up .env file

Create a .env file in the root directory of your project. Add environment-specific variables on new lines in the form of NAME=VALUE. In this case:

SLACK_API_KEY=<key>
DATABASE_URL=postgresql://<username>:<password>@localhost/cyf

Setting up local db

Commands:

createdb -U <username> cyf
psql -d cyf -U <username> -f scripts/01-init.sql

Accessibility and design (colours)

The design has checked for accessibility regarding colorblinded people, as well as general contrast (we need to change the red/green numbers on the tables, as they do not contrast enough).

Testing - Jest

So far we are using some simple snapshot tests and some unit tests running with Jest. To run all tests located under the **tests** folder, run:

npm run test

The snapshot tests will warn developers if they make unintentional changes to the components or pages. If you have made intentional changes to a component, run the following to update the snapshots:

jest --updateSnapshots

Testing - Cypress

We are using Cypress to test the GUI and our server side API. To learn more about Cypress tests, visit the [cypress-docs] (https://docs.cypress.io/guides/overview/why-cypress)

Before you get carried away testing, please create a cypress.env.json file in the root directory with the necessary details, e.g:

{ "username": "", "password": "" }

The Cypress spec tests reside in the cypress/integration folder, which is split into two folders: /api (back-end) and /gui (front-end). To run these tests, if you already have the server running, use the following command:

npm run cy:run

But if you wish to start the server and the tests in a single command, please use:

npm run cy:start-and-run

If you would like to run one test file, please use --spec and provide a path, e.g.:

npx cypress run --spec cypress/integration/api/loginAPI.spec.js

Should you wish to run all tests within one of the two folders (gui or api), you can add an asterisc at the end of the path, e.g.:

npx cypress run --spec cypress/integration/api/*

About

License:ISC License


Languages

Language:JavaScript 91.7%Language:CSS 7.4%Language:Dockerfile 0.6%Language:HTML 0.3%