Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
17 changes: 17 additions & 0 deletions .github/workflows/0TestBaseUrlConnectivity.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Test BaseUrl connectivity

on:
pull_request:
workflow_dispatch:

jobs:
check-baseurl:
runs-on: ubuntu-latest

steps:
- name: Check BaseUrl availability
env:
CYPRESS_baseUrl: ${{ secrets.BASE_URL }}
run: |
echo "Checking BaseUrl connectivity..."
curl -s -o /dev/null -w "HTTP status: %{http_code}\n" "$CYPRESS_baseUrl"
47 changes: 47 additions & 0 deletions .github/workflows/creacionProtocolos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Cypress Tests

on:
pull_request:
types: [opened, synchronize, reopened]
pull_request_review:
types: [submitted]
push:
branches:
- main

jobs:
cypress-run:
runs-on: ubuntu-latest

# Solo corre en:
# - PR normal
# - Review APPROVED
# - Push a main (merge)
if: >
github.event_name == 'pull_request' ||
github.event_name == 'push' ||
(github.event_name == 'pull_request_review' &&
github.event.review.state == 'approved')

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install dependencies
run: npm ci
working-directory: Tests-Cypress

- name: Run Cypress tests
uses: cypress-io/github-action@v6
with:
browser: chrome
working-directory: Tests-Cypress
env:
CYPRESS_baseUrl: ${{ secrets.BASE_URL }}
CYPRESS_USER_NAME: ${{ secrets.USER_NAME }}
CYPRESS_USER_PASSWORD: ${{ secrets.USER_PASSWORD }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,5 @@ web.config
*.xlsm
*.xls
*.xlsx

local.env.json
2 changes: 1 addition & 1 deletion Business/Business.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="QRCoder">
<HintPath>C:\Users\Carolina\Downloads\002.GenerarQRCrystalReportsWeb\55.GenerarQRCrystalReportsWeb\GenerarQRWebForms\GenerarQRWebForms\bin\QRCoder.dll</HintPath>
<HintPath>..\WebLab\bin\QRCoder.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
Expand Down
38 changes: 38 additions & 0 deletions Tests-Cypress/cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const { defineConfig } = require("cypress");
const fs = require('fs');
const path = require('path');

function loadLocalEnv() {
const envPath = path.resolve(
__dirname,
'cypress/fixtures/local.env.json'
);

if (fs.existsSync(envPath)) {
const localEnv = JSON.parse(fs.readFileSync(envPath, 'utf8'));
return localEnv;
}

return {};
}

module.exports =
defineConfig({
e2e: {
baseUrl: process.env.CYPRESS_baseUrl || "http://localhost:8700",
supportFile: "cypress/support/commands.js",
viewportWidth: 1280,
viewportHeight: 800,
video: false,
defaultCommandTimeout: 10000,
setupNodeEvents(on, config) {
// Solo carga el JSON local si NO viene desde la integracion con GitHub
if (!process.env.CYPRESS_USER_NAME) {
config.env = {
...config.env,
...loadLocalEnv()
};
}
return config;
}
} });
191 changes: 191 additions & 0 deletions Tests-Cypress/cypress/e2e/Protocol.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
describe("Altas de Protocolos", () => {

it("Alta de protocolo [Laboratorio]", () => {

cy.login();
cy.seleccionarEfector();

//Creo un protocolo sin turno
cy.get("[id$='mnuPrincipal']")
.contains("Recepcion")
.trigger("mouseover");

cy.get("[id$='mnuPrincipal']")
.contains("Pacientes sin turno")
.click();
//Pongo el DNI del paciente para buscarlo y crear el protocolo
cy.fixture("datos").then(u => {
cy.get("input[id$='txtDni']").type(u.pacienteDNI);
});
//Elijo el sexo del paciente
cy.get("select[id$='ddlSexo']").select("Femenino");

cy.get("input[id$='btnBuscar']").click();

//De la busqueda elijo el primero
cy.get("[id$='gvLista']")
.find("input[type='submit'][value='Protocolo']")
.first()
.click();

//Pantalla de protocolo NUEVO
//Ingreso determinaciones manualmente
cy.fixture("determinaciones").then(d => {

d.codigos.forEach((valor, index) => {

cy.get("[id$='tabla']")
.find(`input[id$='Codigo_${index}']`)
.should("be.visible")
.clear()
.type(valor)
.type('{enter}');
});

});

cy.encabezadoProtocolo();
cy.cargarDiagnostico();

//"LABORATORIO CENTRAL"
cy.fixture("datos").then(x => {
if (x.efector == "LABORATORIO CENTRAL") {
//Caracter SISA:
cy.get("select[id$='ddlCaracter']").select(x.caracterSisa);
}
});

cy.get('body').click(0, 0);
cy.wait(1000);
// Interceptar el guardado para obligar a Cypress a esperar la respuesta
cy.intercept('POST', '**/ProtocoloEdit2.aspx*').as('guardadoFinal');

cy.get("input[id$='btnGuardar']").click({ force: true });
// Esperar a que el servidor responda positivamente
cy.wait('@guardadoFinal');
});

it("Alta de protocolo [Microbiologia]", () => {

cy.login();
cy.seleccionarEfector();

//Creo un protocolo sin turno
cy.get("[id$='mnuPrincipal']")
.contains("Microbiología")
.trigger("mouseover");

cy.get("[id$='mnuPrincipal']")
.contains("Recepción de Muestras")
.click();



//Pongo el DNI del paciente para buscarlo y crear el protocolo
cy.fixture("datos").then(u => {
cy.get("input[id$='txtDni']").type(u.pacienteDNI);
});
//Elijo el sexo del paciente
cy.get("select[id$='ddlSexo']").select("Femenino");

cy.get("input[id$='btnBuscar']").click();

//De la busqueda elijo el primero
cy.get("[id$='gvLista']")
.find("input[type='submit'][value='Protocolo']")
.first()
.click();

//Pantalla de protocolo NUEVO
//Ingreso determinaciones manualmente
cy.fixture("determinaciones").then(d => {

d.micro.forEach((valor, index) => {

cy.get("[id$='tabla']")
.find(`input[id$='Codigo_${index}']`)
.should("be.visible")
.clear()
.type(valor)
.type('{enter}');
});

});

cy.encabezadoProtocolo();
cy.cargarDiagnostico();

//Tipo de Muestra
cy.get("input[id$='txtCodigoMuestra']").type("cm").type('{enter}');

//"LABORATORIO CENTRAL"
cy.fixture("datos").then(x => {
if (x.efector == "LABORATORIO CENTRAL") {
//Caracter SISA:
cy.get("select[id$='ddlCaracter']").select(x.caracterSisa);
//Nro. Hisopado
cy.get("input[id$='txtNumeroOrigen2']").type(x.numeroHisopado);

}
});

//Tiempo de espera para el anthem
cy.get('body').click(0, 0);
cy.wait(1000);
// 2. Interceptar el guardado para obligar a Cypress a esperar la respuesta
cy.intercept('POST', '**/ProtocoloEdit2.aspx*').as('guardadoFinal');

cy.get("input[id$='btnGuardar']").click({ force: true });
// Esperar a que el servidor responda positivamente
cy.wait('@guardadoFinal');
});

it("Alta de protocolo [No Paciente]", () => {

cy.login();
cy.seleccionarEfector();


//Creo un protocolo sin turno
cy.get("[id$='mnuPrincipal']")
.contains("Muestras de No Pacientes")
.trigger("mouseover");

cy.get("[id$='mnuPrincipal']").contains("Recepcion de Muestras").click();


//Pantalla de protocolo NUEVO

cy.get("[id$='txtCodigoMuestra']").type("agua");//.type('{enter}'); //Tipo de Muestra

cy.get("[id$='txtDescripcionProducto']").type("Test"); //Descripcion

cy.get("select[id$='ddlConservacion']").select("Agua");//Conservacion

cy.get("select[id$='ddlSectorServicio']").select("1 - MEDICINA GENERAL"); //Origen


//Ingreso determinaciones manualmente
cy.fixture("determinaciones").then(d => {

d.codigos.forEach((valor, index) => {

cy.get("[id$='tabla']")
.find(`input[id$='Codigo_${index}']`)
.should("be.visible")
.clear()
.type(valor)
.type('{enter}');
});

});


//Guardo
cy.get("input[id$='btnGuardar']").click();

cy.location('pathname').should('include', '/Protocolos/ProtocoloMensaje.aspx');

});
});

7 changes: 7 additions & 0 deletions Tests-Cypress/cypress/fixtures/datos.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{

"efector": "LABORATORIO CENTRAL",
"pacienteDNI": "36256589",
"caracterSisa": "SOSPECHOSO",
"numeroHisopado": "373487"
}
13 changes: 13 additions & 0 deletions Tests-Cypress/cypress/fixtures/determinaciones.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"codigos": [
"352",
"711",
"7546",
"1000",
"865",
"867"
],

"micro": ["911", "9071"]

}
43 changes: 43 additions & 0 deletions Tests-Cypress/cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Cypress.Commands.add("login", () => {
cy.visit("Logout.aspx");
cy.title().should("not.be.empty");


cy.get("input[id$='UserName']").type(Cypress.env("USER_NAME"));
cy.get("input[id$='Password']").type(Cypress.env("USER_PASSWORD"));


cy.get("input[id$='LoginButton']").click();
});

Cypress.Commands.add("seleccionarEfector", () => {
cy.fixture("datos").then(u => {
cy.get("select[id$='ddlEfector']").select(u.efector);
});

cy.get("input[id$='btnAceptar']").click();
});

Cypress.Commands.add("encabezadoProtocolo", () => {
//Selecciono Origen
cy.get("select[id$='ddlOrigen']").select("AMBULATORIO");
//Selecciono Servicio ddlSectorServicio
cy.get("select[id$='ddlSectorServicio']").select("1 - MEDICINA GENERAL");

//Numero de Matricula de Especialista
cy.get("input[id$='txtEspecialista']").type("0").type('{enter}');
});

Cypress.Commands.add("cargarDiagnostico", () => {
//Selecciono el tab
cy.get("#tabContainer")
.contains("a", "Diagnósticos")
.click();
//Le cargo el diagnostico "Z00.0 - Examen médico general"
cy.get("input[id$='txtCodigoDiagnostico']").type("Z00.0");
cy.get("input[id$='btnBusquedaDiagnostico']").click();
//Lo selecciono de la lista
cy.get("select[id$='lstDiagnosticos']").select("11829");
cy.get("input[id$='btnAgregarDiagnostico']").click();

});
Loading
Loading