Skip to content

Commit

Permalink
[readme] chore: Additional readmes
Browse files Browse the repository at this point in the history
  • Loading branch information
helloitsdave committed May 12, 2024
1 parent 9ca3046 commit d59815a
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 0 deletions.
55 changes: 55 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,57 @@
# notes-app-be

Postgres DB and Express Server Backend for the notes app

## Docker

Running the backend db and express server in a docker container

### Build

```bash
npm run docker:build
```

### Run

```bash
npm run docker:up
```

### Stop

```bash
npm run docker:down
```

## Test Execution

### Unit Tests

Execute the unit tests

```bash
npm run test
```

### Unit Tests with Coverage

Execute the unit tests with coverage

```bash
npm run test:coverage
```

### Service Tests

Execute the service tests against the local docker container

```bash
npm run docker:up
npm run test:service
npm run docker:down
```

## Tag release

Tagging a release will trigger a new docker image build and upload to docker hub
Expand All @@ -8,3 +60,6 @@ Tagging a release will trigger a new docker image build and upload to docker hub
git tag -a be/v1.0.3 -m "Build from action"
git push origin be/v1.0.3
```



82 changes: 82 additions & 0 deletions playwright/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Playwright

This folder contains end-to-end tests for the application using [Playwright](https://playwright.dev/) with typescript.

## Purpose

The goal of the tests in this folder is to validate the e2e functionality of the application by interacting with the UI like a real user.

- **Business Critical**: The tests should only cover business critical flows of the application.
- **Few Tests**: The tests should be few in number as the detailed functionality has already been covered by unit and system tests.
- **Fast Execution**: The tests should be fast to execute and should not take more than a few minutes to run.
- **Atomic**: The tests should be executable in any order and should not depend on each other to allow parallel execution
- **CI/CD**: The tests should be able to run in CI/CD pipelines

## Installation

To use the tests in this folder, you need to have Playwright installed.

```bash
cd ./playwright
npm ci
npx playwright install
```

## Test Execution

### Running tests locally

Start the backend server:
```bash
cd ./backend
npm run docker:up
```

Start the frontend server:
```bash
cd ./frontend
npm run start
```

Executing tests against the local server:

```bash
cd ./playwright
npm run test
```

### Running tests in production

```bash
cd ./playwright
npm run test:production
```

### Headed mode

By default, tests are executed in headless mode. To run tests in headed mode, pass the `--headed` flag:

```bash
cd ./playwright
npm run test -- --headed
```

### Debug mode

To run tests in debug mode, pass the `--debug` flag:

```bash
cd ./playwright
npm run test -- --debug
```

## Page Object Model

The tests in this folder follow the Page Object Model pattern. With only a few flows in this small example application, the page object model may seem like an overkill, but it can be a good practice to follow for larger applications.

The page object file contains the selectors and methods to interact with the page or section of the application.

This makes the tests more readable and maintainable.



1 comment on commit d59815a

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage for this commit

98.11%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
src
   authenticateToken.ts100%100%100%
   hash.ts100%100%100%
   index.ts50%50%83.33%31–33
   prisma.ts100%100%100%
src/__mocks__
   prisma.ts100%100%100%
src/routes
   loginRoutes.ts100%100%100%
   noteRoutes.ts100%100%100%
   userRoutes.ts100%100%100%

Please sign in to comment.