Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Añadir YAML #70

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 31 additions & 36 deletions .github/workflows/lomap_es4c.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
name: CI for LOMAP_ES4C

on:
push:
branches: [develop]
pull_request:
branches: [develop]
branches: [ develop ]
push:
branches: [ develop ]
jobs:
unit-tests:
unit-e2e-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm --prefix webapp ci
- run: npm --prefix webapp ci --legacy-peer-deps
- run: npm --prefix restapi ci
- run: npm --prefix webapp test --coverage --watchAll
- run: npm --prefix restapi test --coverage --watchAll
- run: CI=false && npm --prefix webapp run build
- run: npm --prefix webapp run test:e2e --coverage --watchAll
- name: Analyze with SonarCloud
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
e2e-tests:
needs: [unit-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm --prefix webapp install
- run: npm --prefix restapi install
- run: npm --prefix webapp run build
- run: npm --prefix webapp run test:e2e
docker-push-webapp:
name: Push webapp Docker Image to GitHub Packages
runs-on: ubuntu-latest
needs: [e2e-tests]
#needs: [e2e-tests]
needs: [unit-e2e-tests]
steps:
- uses: actions/checkout@v3
- name: Publish to Registry
Expand All @@ -53,7 +47,8 @@ jobs:
docker-push-restapi:
name: Push restapi Docker Image to GitHub Packages
runs-on: ubuntu-latest
needs: [e2e-tests]
#needs: [e2e-tests]
needs: [unit-e2e-tests]
steps:
- uses: actions/checkout@v3
- name: Publish to Registry
Expand All @@ -64,20 +59,20 @@ jobs:
password: ${{ secrets.DOCKER_PUSH_TOKEN }}
registry: ghcr.io
workdir: restapi
deploy:
name: Deploy over SSH
runs-on: ubuntu-latest
needs: [docker-push-restapi,docker-push-webapp]
steps:
- name: Deploy over SSH
uses: fifsky/ssh-action@master
with:
host: ${{ secrets.DEPLOY_HOST }}
user: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
command: |
wget https://raw.githubusercontent.com/arquisoft/lomap_es4c/master/docker-compose-deploy.yml -O docker-compose.yml
docker-compose stop
docker-compose rm -f
docker-compose pull
docker-compose up -d
deploy:
name: Deploy over SSH
runs-on: ubuntu-latest
needs: [docker-push-restapi,docker-push-webapp]
steps:
- name: Deploy over SSH
uses: fifsky/ssh-action@master
with:
host: ${{ secrets.DEPLOY_HOST }}
user: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
command: |
wget https://raw.githubusercontent.com/arquisoft/lomap_es4c/master/docker-compose-deploy.yml -O docker-compose.yml
docker-compose stop
docker-compose rm -f
docker-compose pull
docker-compose up -d
20 changes: 20 additions & 0 deletions restapi/tests/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,24 @@ describe('user ', () => {
const response:Response = await request(app).post('/api/users/add').send({name: username,email: email}).set('Accept', 'application/json')
expect(response.statusCode).toBe(200);
});

});

describe('marker', () =>{

/**
* Test a marker can be added
*/
it('can add a marker', async () => {
const response:Response = await request(app).post('/api/marker/add').send({titulo: 'Prueba1',
descripcion: '',
latitud: 43.36198435787454,
longitud: -5.850000000984415,
categoria: "Otro",
comentario: "",
puntuacion: 5,
imagen: ""})
.set('Accept', 'application/json')
expect(response.statusCode).toBe(200);
});
});
18 changes: 17 additions & 1 deletion webapp/src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
import React from 'react';
import { BrowserRouter as Router } from "react-router-dom";
import { render, screen } from '@testing-library/react';

import App from './App';

test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/Source code/i);
expect(linkElement).toBeInTheDocument();
});

test("Home page is rendered", async () => {
const { getByText, container } = render(
<Router>
<App></App>
</Router>
);

//Check that the info about stock is rendered correctly
expect(getByText("LoMap")).toBeInTheDocument();
expect(getByText("Seleccione el mapa que desee abrir")).toBeInTheDocument();

// Expect there are 2 elements inside the first (stack)
expect(container.childNodes[0].childNodes.length).toBe(2);
});
7 changes: 7 additions & 0 deletions webapp/src/tests/LoadLogin.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { render, screen } from "@testing-library/react";
import LogIn from "../components/views/logIn";
test('launches login page', () => {
render(<LogIn />);
const linkElement = screen.getByText(/Login/i);
});