-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
44df498
commit 4e88d25
Showing
4 changed files
with
692 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,28 @@ | ||
describe('Login and Sign Up', () => { | ||
it('Allows a user to log in', () => { | ||
cy.visit('/login'); // Asegúrate de ajustar la ruta si es necesario | ||
describe('Login and API Requests', () => { | ||
it('Allows a user to log in and access protected API routes', () => { | ||
cy.visit('/login'); | ||
|
||
// Simular el login exitoso | ||
cy.get('[name="email"]').type('[email protected]'); | ||
cy.get('[name="password"]').type('abc123'); | ||
cy.get('.MuiButton-containedPrimary') // Selecciona el botón por la clase 'MuiButton-containedPrimary' | ||
.should('have.text', 'Login in') // Verifica el texto del botón si es necesario | ||
.click(); | ||
cy.contains('Login Exitoso'); // Verifica que se muestre el mensaje de éxito | ||
cy.intercept('GET', '**/*', (req) => { | ||
req.continue(); // Continuar con la solicitud sin mostrarla en la consola | ||
cy.get('.MuiButton-containedPrimary').click(); | ||
//cy.contains('Login Exitoso'); | ||
cy.wait(3000) | ||
// Obtener el token de la respuesta del login | ||
cy.getCookie('tokenDentelX').then((tokenCookie) => { | ||
const token = tokenCookie.value; | ||
|
||
// Realizar solicitudes a la API con el token | ||
cy.request({ | ||
method: 'GET', | ||
url: 'https://dtxbackend.onrender.com/api/patients/649be3a8684dc54c7b7ba6db?searchQuery=', | ||
headers: { | ||
Authorization: `Bearer ${token}` // Incluir el token en las cabeceras | ||
} | ||
}).then((response) => { | ||
// Aquí puedes realizar verificaciones en la respuesta de la API | ||
// ... | ||
}); | ||
}); | ||
}); | ||
|
||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const { initPlugin } = require('cypress-plugin-snapshots/plugin'); | ||
|
||
module.exports = (on, config) => { | ||
initPlugin(on, config); | ||
|
||
// Agrega Mochawesome a la configuración | ||
on('after:run', (results) => { | ||
require('mochawesome/generate')(results); | ||
}); | ||
}; |
Oops, something went wrong.