Skip to content

Commit

Permalink
more updates
Browse files Browse the repository at this point in the history
  • Loading branch information
doug-s-nava committed Dec 12, 2024
1 parent 11f52e8 commit e3f2566
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
│   │ └── api # API routes (optional)
│ └── styles # Sass & design system settings
├── stories # Storybook pages
└── tests
└── tests # Unit and E2E tests
```

# 💻 Development
Expand All @@ -34,11 +34,11 @@ The application can be run natively or in a Docker container.

Before running the server, duplicate the `/frontend/env.development` file and name the copy `/frontend/.env.local`, in order to avoid checking in any sensitive data to Github.

From the `frontend/` directory:
From the `/frontend` directory:

1. Install dependencies
```bash
npm install
npm ci
```
1. Optionally, disable [telemetry data collection](https://nextjs.org/telemetry)
```bash
Expand All @@ -55,7 +55,12 @@ From the `frontend/` directory:
Some functionality will not work locally without supplying the application environment variables containing secrets.

- New Relic
- NEW_RELIC_APP_NAME
- NEW_RELIC_LICENSE_KEY
- Email subscription form (Sendy)
- SENDY_API_KEY
- SENDY_API_URL
- SENDY_LIST_ID

If you need to access this functionality locally, contact an engineer on the team to get access to the necessary secrets.

Expand Down Expand Up @@ -117,7 +122,9 @@ From the `frontend/` directory:
1. `make storybook`
2. Navigate to [localhost:6006](http://localhost:6006) to view

# 🐛 Testing
# Testing

## 🐛 Unit Testing

[Jest](https://jestjs.io/docs/getting-started) is used as the test runner and [React Testing Library](https://testing-library.com/docs/react-testing-library/intro) provides React testing utilities.

Expand All @@ -135,7 +142,7 @@ A subset of tests can be ran by passing a pattern to the script. For example, to
npm run test-watch -- pages
```

# 🚦 End-to-end (E2E) testing
## 🚦 End-to-end (E2E) testing

[Playwright](https://playwright.dev/) is a framework for web testing and its test runner is called [Playwright Test](https://playwright.dev/docs/api/class-test), which can be used to run E2E or integration tests across chromium, firefox, and webkit browsers.

Expand All @@ -157,16 +164,13 @@ Playwright E2E tests run "local-to-local", requiring both the frontend and the A

In CI, the "Front-end Checks" workflow (`.github/workflows/ci-frontend-e2e.yml`) summary will include an "Artifacts" section where there is an attached "playwright-report". [Playwright docs](https://playwright.dev/docs/ci-intro#html-report) describe how to view HTML Report in more detail.

# 🤖 Type checking, linting, and formatting
## 🤖 Type checking, linting, and formatting

### Tools

- [TypeScript](https://www.typescriptlang.org/) is used for type checking.
- `npm run ts:check` - Type checks all files
- [ESLint](https://eslint.org/) is used for linting. This helps catch common mistakes and encourage best practices.
- `npm run lint` - Lints all files and reports any errors
- `npm run lint-fix` - Lints all files and fixes any auto-fixable errors
- [Prettier](https://prettier.io/) is used for code formatting. This reduces the need for manual formatting or nitpicking and enforces a consistent style.
- `npm run format`: Formats all files
- `npm run format-check`: Check files for formatting violations without fixing them.
- [Prettier](https://prettier.io/) is used for code formatting. This reduces the need for manual formatting or nitpicking and enforces a consistent style.PRs in Github Actions, other than e2e tests

It's recommended that developers configure their code editor to auto run these tools on file save. Most code editors have plugins for these tools or provide native support.

Expand Down Expand Up @@ -194,6 +198,15 @@ It's recommended that developers configure their code editor to auto run these t

</details>

### NPM Scripts for type checking, linting, and formatting

- `npm run ts:check` - Type checks all files
- `npm run lint` - Lints all files and reports any errors
- `npm run lint-fix` - Lints all files and fixes any auto-fixable errors
- `npm run format`: Formats all files based on prettier rules
- `npm run format-check`: Check files for prettier formatting violations without fixing them
- `npm run all-checks`: Runs linting, typescript check, unit testing, and creates a build - simulating locally tests that are run on PRs in Github Actions, other than e2e tests

# Debugging the Next App in VSCode

- See the debug config: `./.vscode/launch.json`
Expand All @@ -204,18 +217,6 @@ It's recommended that developers configure their code editor to auto run these t

\*\* Note that debugging the server-side or full-stack here doesn't debug the API. See the API

# Testing the newsletter subscription form

The project uses [Sendy](https://sendy.co/api) to manage the newsletter. To the `/subscribe` form locally, Sendy test environment variables need to be added to the `.env.local` file or exported as environment variables:

```
SENDY_API_KEY=
SENDY_API_URL=
SENDY_LIST_ID=
```

These are stored as parameters in AWS System Manager and can be obtained there or from another developer on the team. They are not available for outside contributors.

# Other topics

- [Internationalization](../documentation/frontend/internationalization.md)
Expand Down

0 comments on commit e3f2566

Please sign in to comment.