Skip to content

Commit

Permalink
Merge pull request #22 from Pedro0505/cypress-e2e-tests
Browse files Browse the repository at this point in the history
e2e tests
  • Loading branch information
Pedro0505 authored Aug 22, 2023
2 parents 9fe557e + e9a23b3 commit b54b7ec
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 4 deletions.
38 changes: 35 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Testes:
> Jest
DevOps:
> Docker
> Docker, GitHub Actions
DataBase:
> SqLite
Expand All @@ -37,7 +37,7 @@ DataBase:
3. No diretório principal suba os containers

```bash
docker-compose -f docker-compose.dev.yml up --build -d
$ docker-compose -f docker-compose.dev.yml up --build -d
```

5. Quando o processo dos containers estiver acabado acesse a aplicação usando o seguinte endereço
Expand All @@ -49,11 +49,43 @@ http://localhost:3000
6. Para derrubar os containers

```bash
docker-compose -f docker-compose.dev.yml down --rmi all --volumes --remove-orphans
$ docker-compose -f docker-compose.dev.yml down --rmi all --volumes --remove-orphans
```

</details>

<br />

Para executar as aplicações com node entre nas pasta do projeto (backend e frontend) para mais informações

## Rodando os testes E2E

1. Garanta que já tenha iniciado e configurado o projeto

2. A url do frontend por padrão é http://localhost:3000 para altera-lá basta adicionar um aquivo .env dentro do diretorio `__tests__`

```bash
$ echo "BASE_URL_CYPRESS=<SUA_URL>" > .env
```

5. Inicie o frontend

```bash
$ npm start
```

3. Para um bom funcinamento dos testes para inciar rode o seguinte comando no backend

```bash
$ npm run start:test
```

6. Dentro do diretorio `__tests__` basta rodar o seguinte comando para iniciar os testes

```bash
$ npx cypress run # Para rodar no terminal
# Ou
npx cypress open # Para ver de forma visual os testes rodando
```

Obs: Os testes e2e só funcionam com a aplicação rodando fora do docker
2 changes: 2 additions & 0 deletions __tests__/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default defineConfig({
video: false,
viewportHeight: 1080,
viewportWidth: 1920,
screenshotOnRunFailure: false,

e2e: {
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion __tests__/e2e/.gitignore

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit b54b7ec

Please sign in to comment.