Skip to content

Commit

Permalink
n
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoRedondoo committed Apr 8, 2024
1 parent 8a8a060 commit f19e1a0
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 52 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,7 @@ front/node_modules
/playwright-report/
/blob-report/
/playwright/.cache/
<<<<<<< HEAD
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
=======
>>>>>>> devNico
42 changes: 0 additions & 42 deletions front/src/routes/ufc-events-data/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
<script>
import { onMount } from "svelte";
import { dev } from "$app/environment";
<<<<<<< HEAD
import { Button, Container, Row, Col, ListGroup, ListGroupItem, NavLink, Alert } from '@sveltestrap/sveltestrap';
=======
import { page } from '$app/stores';
import { Button, Container, Row, Col, ListGroup, ListGroupItem, NavLink, Alert, Pagination, PaginationItem, PaginationLink } from '@sveltestrap/sveltestrap';
>>>>>>> devNico
let API = "/api/v2/ufc-events-data";
Expand All @@ -18,9 +13,6 @@
let errorMsg = "";
let successMsg="";
<<<<<<< HEAD
=======
let offset = 0;
let limit = 10;
Expand All @@ -32,7 +24,6 @@
let filterParams = {};
onMount(getEvents);
>>>>>>> devNico
function clearSuccessMsg() {
successMsg = "";
Expand Down Expand Up @@ -75,23 +66,6 @@
}
async function getEvents() {
<<<<<<< HEAD
successMsg, errorMsg = "", "";
try {
let response = await fetch(API, { method: "GET" });
if (response.ok) {
events = await response.json(); // Update events with fetched data
console.log(events);
checkError(response.status);
}
else if (response.status != 200) {
errorMsg = "No se ha encontrado la colección."
}
} catch (error) {
checkError(error);
}
=======
successMsg, errorMsg = "", "";
listaPeleas = []
Expand Down Expand Up @@ -132,7 +106,6 @@
} catch (error) {
checkError(error);
}
>>>>>>> devNico
}
async function deleteEvent(fighter1, fighter2, date) {
Expand Down Expand Up @@ -291,11 +264,7 @@
<div class="event-box">
<ListGroup>
{#each events as event }
<<<<<<< HEAD
<ListGroupItem>
=======
<ListGroupItem class=fightItem>
>>>>>>> devNico
<Row class="event-box">
<Col xs="10">
<NavLink href="ufc-events-data/{encodeURIComponent(event.fighter1)}/{encodeURIComponent(event.fighter2)}/{encodeURIComponent(event.date)}">
Expand Down Expand Up @@ -335,16 +304,6 @@
</div>
</Row>
{#if events.length !== 0}
<<<<<<< HEAD
<Row class="justify-content-center">
<Col xs="auto">Eliminar todos los eventos -> <Button outline size="sm" color="danger" on:click={deleteAllEvents}>Borrar Todo</Button></Col>
<Col xs="auto">Crear un nuevo evento -> <Button href="/ufc-events-data/postEvent" outline size="sm" color="success">Crear Evento</Button></Col>
</Row>
{/if}
{#if events.length === 0}
<Row class="justify-content-center">
<Col xs="auto">Insertar datos -> <Button size="sm" outline color="primary" on:click={loadInitialData}>Insertar</Button></Col>
=======


<Row class="justify-content-center">
Expand Down Expand Up @@ -399,7 +358,6 @@
{#if events.length === 0}
<Row class="justify-content-center">
<Col xs="auto">Insertar datos -> <Button size="sm" outline color="primary" href="/ufc-events-data?offset=0&limit=10" on:click={loadInitialData}>Insertar</Button></Col>
>>>>>>> devNico
<Col xs="auto">Crear un nuevo evento -> <Button href="/ufc-events-data/postEvent" outline size="sm" color="success">Crear Evento</Button></Col>
</Row>
{/if}
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"scripts": {
"start": "node index.js",
"pretest":"npm start &",
"pretest": "npm start &",
"test-integration": "npm run test-movies-dataset && npm run test-ufc-events-data && npm run test-youtube-trends",
"test-movies-dataset": "npx newman run ./backEGO/tests/CollectionAPIEGO.json -e ./backEGO/tests/enviroments/GCloudEnv.json",
"test-ufc-events-data": "npx newman run ./tests/integration/apiNRM-gcloud-v2.json",
Expand All @@ -24,6 +24,7 @@
"type": "module",
"devDependencies": {
"@playwright/test": "^1.42.1",
"@types/node": "^20.12.4"
"@types/node": "^20.12.5"

}
}
16 changes: 16 additions & 0 deletions tests/e2e/events.spec.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,19 @@ test('list events', async ({ page }) => {
// Expects page to have a heading with the name of Installation.
expect(eventItemNumber).toBeGreaterThanOrEqual(0);
});

// test('cargar datos iniciales', async ({ page }) => {
// await page.goto('http://localhost:10002/ufc-events-data?offset=0&limit=10');

// await page.waitForSelector('button[color="primary"]:text("Insertar")');

// // Hacer clic en el botón "Insertar datos"
// await page.click('button[color="primary"]:text("Insertar")');

// // Espera a que aparezca el mensaje de éxito después de cargar los datos iniciales
// await page.waitForSelector('.alert', { timeout: 5000 });

// // Obtener el texto del mensaje de éxito
// const successMsg = await page.textContent('.alert');
// });

10 changes: 5 additions & 5 deletions tests/e2e/youtube-trends.spec.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ const { test, expect } = require('@playwright/test');

//---------------Verifica si la página tiene un título esperado---------------
test('tiene título', async ({ page }) => {
await page.goto('http:/sos2324-14.appspot.com');
await page.goto('http://localhost:10002');

// Espera que el título "contenga" una subcadena.
await expect(page).toHaveTitle(/APIs Grupo 14/);
});

//---------------Verifica la funcionalidad de carga de datos iniciales---------------
test('cargar datos iniciales', async ({ page }) => {
await page.goto('http:/sos2324-14.appspot.com/youtube-trends');
await page.goto('http://localhost:10002/youtube-trends');

// Haz clic en el botón "Cargar Datos Iniciales"
await page.click('button:text("Cargar Datos Iniciales")');
Expand All @@ -26,7 +26,7 @@ test('cargar datos iniciales', async ({ page }) => {

//---------------Verifica la funcionalidad de búsqueda---------------
test('funcionalidad de búsqueda', async ({ page }) => {
await page.goto('http:/sos2324-14.appspot.com/youtube-trends');
await page.goto('http://localhost:10002/youtube-trends');

// Ingresa un término de búsqueda y espera que la lista se actualice
await page.fill('input[type="text"]', 'Prueba');
Expand All @@ -40,7 +40,7 @@ test('funcionalidad de búsqueda', async ({ page }) => {

//---------------Verifica la funcionalidad de paginación---------------
test('funcionalidad de paginación', async ({ page }) => {
await page.goto('http:/sos2324-14.appspot.com/youtube-trends');
await page.goto('http://localhost:10002/youtube-trends');

// Espera que los botones de paginación estén presentes
await page.waitForSelector('button');
Expand All @@ -60,7 +60,7 @@ test('funcionalidad de paginación', async ({ page }) => {

//---------------Verifica la funcionalidad del botón "Borrar todo"---------------
test('funcionalidad "Borrar todo"', async ({ page }) => {
await page.goto('http:/sos2324-14.appspot.com/youtube-trends');
await page.goto('http://localhost:10002/youtube-trends');

// Haz clic en el botón "Borrar todo"
await page.click('button:text("Borrar todo")');
Expand Down

0 comments on commit f19e1a0

Please sign in to comment.