-
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.
Mochawesome conf- automatic reports->JSON,HTML,PNGS,VIDEOS
- Loading branch information
1 parent
4e88d25
commit 91bc23f
Showing
15 changed files
with
738 additions
and
84 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,11 +1,16 @@ | ||
import { defineConfig } from "cypress"; | ||
|
||
export default defineConfig({ | ||
reporter: "cypress-mochawesome-reporter", | ||
reporterOptions: { | ||
"reportDir": "cypress/results", | ||
"overwrite": false, | ||
"html": true, | ||
"json": true | ||
}, | ||
e2e: { | ||
specPattern: "./cypress/integration/*.spec.js", | ||
baseUrl: 'https://dentelx.vercel.app/login', | ||
setupNodeEvents(on, config) { | ||
// implement node event listeners here | ||
}, | ||
}, | ||
}); |
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,94 @@ | ||
const addContext = require('mochawesome/addContext'); | ||
describe('Login and Sign Up', () => { | ||
it('Allows to create a record', () => { | ||
cy.visit('/login'); // Asegúrate de ajustar la ruta si es necesario | ||
|
||
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.intercept('GET', 'https://dtxbackend.onrender.com/api/patients/649be3a8684dc54c7b7ba6db?searchQuery=', { | ||
statusCode: 200, | ||
body: {} // Respuesta simulada | ||
}); | ||
cy.wait(4000) | ||
cy.contains('Pacientes'); // Verifica que se muestre el mensaje de éxito | ||
cy.intercept('GET', 'https://dtxbackend.onrender.com/api/patients/649be3a8684dc54c7b7ba6db', { | ||
statusCode: 200, | ||
body: {} // Respuesta simulada | ||
}); | ||
|
||
|
||
cy.get('[data-testid="add-button"]').click(); | ||
cy.get('[name="info_general.num_historia_clinica"]').type('999'); | ||
cy.get('[name="info_general.nombres"]').type('Oscar'); | ||
cy.get('[name="info_general.apellidos"]').type('Garcya Cypress'); | ||
cy.get('[name="info_general.cedula"]').type('0982378222'); | ||
cy.get('[name="info_general.celular"]').type('0988234933'); | ||
cy.get('.PrivateSwitchBase-input[value="6"]').click(); | ||
cy.get('[name="motivo_consulta"]').type('Limpieza general'); | ||
cy.get('[name="enfermedad_problema_actual"]').type('Ligero Sarro'); | ||
cy.get('[name="antecedentes_familiares.alergia_antibiotico"]').click(); | ||
cy.get('[name="signos_vitales.presion_arterial"]').type('112'); | ||
cy.get('[name="signos_vitales.frecuencia_cardiaca"]').type('14'); | ||
cy.get('[name="signos_vitales.temperatura_centigrados"]').type('32'); | ||
cy.get('[name="signos_vitales.frec_respiratoria_min"]').type('34'); | ||
cy.get('[name="signos_vitales.anotaciones"]').type('El paciente se niega a tomarse presion arterial actual'); | ||
cy.get('[name="sistema_estomatognatico.maxilar_superior"]').click(); | ||
cy.contains('.MuiButton-root', '16').click(); | ||
cy.contains('.MuiButton-root', '21').click(); | ||
cy.contains('.MuiButton-root', '65').click(); | ||
cy.contains('.MuiButton-root', '36').click(); | ||
cy.contains('.MuiButton-root', '71').click(); | ||
cy.contains('.MuiButton-root', '46').click(); | ||
cy.get('[name="salud_bucal.tabla_higiene.placa.c1r1"]').clear().type('3'); | ||
cy.get('[name="salud_bucal.tabla_higiene.calculo.c2r1"]').clear().type('2'); | ||
cy.get('[name="salud_bucal.tabla_higiene.gingivitis.c3r1"]').clear().type('1'); | ||
cy.get('[name="indices_cpo_cbo.rowD.DC1"]').type("1") | ||
cy.get('[name="indices_cpo_cbo.rowD.DP"]').type("1") | ||
cy.get('[name="indices_cpo_cbo.rowD.DO"]').type("1") | ||
cy.get('[name="indices_cpo_cbo.rowd.dc2"]').type("1") | ||
cy.get('[name="indices_cpo_cbo.rowd.de"]').type("1") | ||
cy.get('[name="indices_cpo_cbo.rowd.do"]').type("1") | ||
cy.contains('.MuiTab-root', 'Posterior').click(); | ||
cy.get('[name="planes_varios.biometria"]').click() | ||
const patientData = { | ||
nombres: "Oscar", | ||
apellidos: "Garcya Cypress", | ||
cedula: "0982378222", | ||
celular: "0988234933", | ||
doctor_id: "649be3a8684dc54c7b7ba6db", | ||
sexo: 'masculino', | ||
edad: 20, | ||
enfermedad_problema_actual: "Ligero Sarro", | ||
antecedentes_personales: "Alergia antibiotico", | ||
motivo_consulta: "Limpieza general", | ||
antecedentes_familiares: "", | ||
indices_cpo_cbo: "", | ||
info_general: "", | ||
planes_varios: "", | ||
salud_bucal: "", | ||
signos_vitales: "", | ||
sistema_estomatognatico: "", | ||
diagnosticos: "", | ||
tratamientos: "", | ||
// Otros campos de información del paciente | ||
}; | ||
cy.intercept('POST', 'https://dtxbackend.onrender.com/api/patients/649be3a8684dc54c7b7ba6db', { | ||
statusCode: 200, | ||
body: { | ||
patientData, | ||
} // Respuesta simulada | ||
}); | ||
cy.contains('.MuiButton-root', 'Enviar').click(); | ||
cy.contains('Pacientes'); // Verifica que se muestre el mensaje de éxito | ||
cy.wait(1000) | ||
addContext(this, 'Report creation'); | ||
|
||
}); | ||
|
||
|
||
|
||
}); |
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,28 +1,59 @@ | ||
describe('Login and API Requests', () => { | ||
it('Allows a user to log in and access protected API routes', () => { | ||
cy.visit('/login'); | ||
describe('Login and Sign Up', () => { | ||
it('Allows a user to log in', () => { | ||
cy.visit('/login'); // Asegúrate de ajustar la ruta si es necesario | ||
|
||
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.intercept('GET', 'https://dtxbackend.onrender.com/api/patients/649be3a8684dc54c7b7ba6db?searchQuery=', { | ||
statusCode: 200, | ||
body: {} // Respuesta simulada | ||
}); | ||
cy.contains('Pacientes'); // Verifica que se muestre el mensaje de éxito | ||
|
||
}); | ||
|
||
// Simular el login exitoso | ||
cy.get('[name="email"]').type('[email protected]'); | ||
cy.get('[name="password"]').type('abc123'); | ||
it('Allows a user to sign up as dentist', () => { | ||
cy.visit('/login'); // Asegúrate de ajustar la ruta si es necesario | ||
cy.get('.MuiLink-root ').click(); | ||
cy.contains('Registro'); | ||
cy.get('[name="nombres"]').type('Sara Gema'); | ||
cy.get('[name="apellidos"]').type('Gonzales Suarez'); | ||
cy.get('[name="email"]').type('[email protected]');//Change email when testing | ||
cy.get('[name="password"]').type('SarahG123'); | ||
cy.get('#mui-component-select-cargo').click(); | ||
cy.get('[data-value="DENTISTA"]').type('{enter}'); | ||
cy.get('[name="telefono"]').type('0989705423'); | ||
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 | ||
// ... | ||
}); | ||
cy.wait(4000) | ||
cy.contains('Pacientes'); | ||
cy.intercept('POST', 'https://dtxbackend.onrender.com/api/users/signup', { | ||
statusCode: 200, | ||
body: {} // Respuesta simulada | ||
}); | ||
|
||
}); | ||
|
||
it('Allows a user to sign up as Ortod.', () => { | ||
cy.visit('/login'); // Asegúrate de ajustar la ruta si es necesario | ||
cy.get('.MuiLink-root ').click(); | ||
cy.contains('Registro'); | ||
cy.get('[name="nombres"]').type('Sara Gema'); | ||
cy.get('[name="apellidos"]').type('Gonzales Suarez'); | ||
cy.get('[name="email"]').type('[email protected]');//Change email when testing | ||
cy.get('[name="password"]').type('SarahG123'); | ||
cy.get('#mui-component-select-cargo').click(); | ||
cy.get('[data-value="DENTISTA"]').type('{downarrow}{enter}'); | ||
cy.get('[name="telefono"]').type('0989705423'); | ||
cy.get('.MuiButton-containedPrimary').click(); | ||
cy.contains('Pacientes'); | ||
cy.intercept('POST', 'https://dtxbackend.onrender.com/api/users/signup', { | ||
statusCode: 200, | ||
body: {} // Respuesta simulada | ||
}); | ||
|
||
}); | ||
}); | ||
|
||
}); |
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,109 @@ | ||
{ | ||
"stats": { | ||
"suites": 1, | ||
"tests": 1, | ||
"passes": 0, | ||
"pending": 0, | ||
"failures": 1, | ||
"start": "2023-08-17T00:52:57.967Z", | ||
"end": "2023-08-17T00:53:06.406Z", | ||
"duration": 8439, | ||
"testsRegistered": 1, | ||
"passPercent": 0, | ||
"pendingPercent": 0, | ||
"other": 0, | ||
"hasOther": false, | ||
"skipped": 0, | ||
"hasSkipped": false | ||
}, | ||
"results": [ | ||
{ | ||
"uuid": "cee0d7a4-197f-47b6-86d4-95f713c5cb1c", | ||
"title": "", | ||
"fullFile": "cypress\\integration\\ficha.spec.js", | ||
"file": "cypress\\integration\\ficha.spec.js", | ||
"beforeHooks": [], | ||
"afterHooks": [], | ||
"tests": [], | ||
"suites": [ | ||
{ | ||
"uuid": "4e661673-ae46-4fcc-88fe-4b68f7361d39", | ||
"title": "Login and Sign Up", | ||
"fullFile": "", | ||
"file": "", | ||
"beforeHooks": [], | ||
"afterHooks": [], | ||
"tests": [ | ||
{ | ||
"title": "Allows to create a record", | ||
"fullTitle": "Login and Sign Up Allows to create a record", | ||
"timedOut": null, | ||
"duration": 8329, | ||
"state": "failed", | ||
"speed": null, | ||
"pass": false, | ||
"fail": true, | ||
"pending": false, | ||
"context": "[\n {\n \"title\": \"cypress-mochawesome-reporter-videos-failed\",\n \"value\": \"cypress\\\\integration\\\\ficha.spec.js\"\n },\n {\n \"title\": \"cypress-mochawesome-reporter-screenshots\",\n \"value\": [\n [\n \"\\\\ficha.spec.js\\\\Login and Sign Up -- Allows to create a record (failed).png\"\n ]\n ]\n }\n]", | ||
"code": "cy.visit('/login'); // Asegúrate de ajustar la ruta si es necesario\ncy.get('[name=\"email\"]').type('[email protected]');\ncy.get('[name=\"password\"]').type('abc123');\ncy.get('.MuiButton-containedPrimary') // Selecciona el botón por la clase 'MuiButton-containedPrimary'\n.should('have.text', 'Login in') // Verifica el texto del botón si es necesario\n.click();\ncy.intercept('GET', 'https://dtxbackend.onrender.com/api/patients/649be3a8684dc54c7b7ba6db?searchQuery=', {\n statusCode: 200,\n body: {} // Respuesta simulada\n});\ncy.contains('Pacientes'); // Verifica que se muestre el mensaje de éxito\ncy.intercept('GET', 'https://dtxbackend.onrender.com/api/patients/649be3a8684dc54c7b7ba6db', {\n statusCode: 200,\n body: {} // Respuesta simulada\n});\ncy.get('[data-testid=\"add-button\"]').click();\ncy.get('[name=\"info_general.num_historia_clinica\"]').type('999');\ncy.get('[name=\"info_general.nombres\"]').type('Oscar');\ncy.get('[name=\"info_general.apellidos\"]').type('Garcya Cypress');\ncy.get('[name=\"info_general.cedula\"]').type('0982378222');\ncy.get('[name=\"info_general.celular\"]').type('0988234933');\ncy.get('.PrivateSwitchBase-input[value=\"6\"]').click();\ncy.get('[name=\"motivo_consulta\"]').type('Limpieza general');\ncy.get('[name=\"enfermedad_problema_actual\"]').type('Ligero Sarro');\ncy.get('[name=\"antecedentes_familiares.alergia_antibiotico\"]').click();\ncy.get('[name=\"signos_vitales.presion_arterial\"]').type('112');\ncy.get('[name=\"signos_vitales.frecuencia_cardiaca\"]').type('14');\ncy.get('[name=\"signos_vitales.temperatura_centigrados\"]').type('32');\ncy.get('[name=\"signos_vitales.frec_respiratoria_min\"]').type('34');\ncy.get('[name=\"signos_vitales.anotaciones\"]').type('El paciente se niega a tomarse presion arterial actual');\ncy.get('[name=\"sistema_estomatognatico.maxilar_superior\"]').click();\ncy.contains('.MuiButton-root', '16').click();\ncy.contains('.MuiButton-root', '21').click();\ncy.contains('.MuiButton-root', '65').click();\ncy.contains('.MuiButton-root', '36').click();\ncy.contains('.MuiButton-root', '71').click();\ncy.contains('.MuiButton-root', '46').click();\ncy.get('[name=\"salud_bucal.tabla_higiene.placa.c1r1\"]').clear().type('3');\ncy.get('[name=\"salud_bucal.tabla_higiene.calculo.c2r1\"]').clear().type('2');\ncy.get('[name=\"salud_bucal.tabla_higiene.gingivitis.c3r1\"]').clear().type('1');\ncy.get('[name=\"indices_cpo_cbo.rowD.DC1\"]').type(\"1\");\ncy.get('[name=\"indices_cpo_cbo.rowD.DP\"]').type(\"1\");\ncy.get('[name=\"indices_cpo_cbo.rowD.DO\"]').type(\"1\");\ncy.get('[name=\"indices_cpo_cbo.rowd.dc2\"]').type(\"1\");\ncy.get('[name=\"indices_cpo_cbo.rowd.de\"]').type(\"1\");\ncy.get('[name=\"indices_cpo_cbo.rowd.do\"]').type(\"1\");\ncy.contains('.MuiTab-root', 'Posterior').click();\ncy.get('[name=\"planes_varios.biometria\"]').click();\nconst patientData = {\n nombres: \"Oscar\",\n apellidos: \"Garcya Cypress\",\n cedula: \"0982378222\",\n celular: \"0988234933\",\n doctor_id: \"649be3a8684dc54c7b7ba6db\",\n sexo: 'masculino',\n edad: 20,\n enfermedad_problema_actual: \"Ligero Sarro\",\n antecedentes_personales: \"Alergia antibiotico\",\n motivo_consulta: \"Limpieza general\",\n antecedentes_familiares: \"\",\n indices_cpo_cbo: \"\",\n info_general: \"\",\n planes_varios: \"\",\n salud_bucal: \"\",\n signos_vitales: \"\",\n sistema_estomatognatico: \"\",\n diagnosticos: \"\",\n tratamientos: \"\"\n // Otros campos de información del paciente\n};\ncy.intercept('POST', 'https://dtxbackend.onrender.com/api/patients/649be3a8684dc54c7b7ba6db', {\n statusCode: 200,\n body: {\n patientData\n } // Respuesta simulada\n});\ncy.contains('.MuiButton-root', 'Enviar').click();\ncy.contains('Pacientes'); // Verifica que se muestre el mensaje de éxito\ncy.wait(1000);\naddContext(void 0, 'Report creation');", | ||
"err": { | ||
"message": "AssertionError: Timed out retrying after 4000ms: Expected to find content: 'Pacientes' but never did.", | ||
"estack": "AssertionError: Timed out retrying after 4000ms: Expected to find content: 'Pacientes' but never did.\n at Context.eval (webpack:///./cypress/integration/ficha.spec.js:15:7)", | ||
"diff": null | ||
}, | ||
"uuid": "019c1d88-d68a-403f-93eb-491bcd1ce728", | ||
"parentUUID": "4e661673-ae46-4fcc-88fe-4b68f7361d39", | ||
"isHook": false, | ||
"skipped": false | ||
} | ||
], | ||
"suites": [], | ||
"passes": [], | ||
"failures": [ | ||
"019c1d88-d68a-403f-93eb-491bcd1ce728" | ||
], | ||
"pending": [], | ||
"skipped": [], | ||
"duration": 8329, | ||
"root": false, | ||
"rootEmpty": false, | ||
"_timeout": 2000 | ||
} | ||
], | ||
"passes": [], | ||
"failures": [], | ||
"pending": [], | ||
"skipped": [], | ||
"duration": 0, | ||
"root": true, | ||
"rootEmpty": true, | ||
"_timeout": 2000 | ||
} | ||
], | ||
"meta": { | ||
"mocha": { | ||
"version": "7.0.1" | ||
}, | ||
"mochawesome": { | ||
"options": { | ||
"quiet": false, | ||
"reportFilename": "mochawesome", | ||
"saveHtml": false, | ||
"saveJson": true, | ||
"consoleReporter": "spec", | ||
"useInlineDiffs": false, | ||
"code": true | ||
}, | ||
"version": "7.1.3" | ||
}, | ||
"marge": { | ||
"options": { | ||
"reportDir": "cypress\\results\\.jsons", | ||
"overwrite": false, | ||
"html": false, | ||
"json": true | ||
}, | ||
"version": "6.2.0" | ||
} | ||
} | ||
} |
Oops, something went wrong.