Skip to content

Commit

Permalink
Arregla pruebas de regresión y que corra puppeteer. Closes https://gi…
Browse files Browse the repository at this point in the history
  • Loading branch information
vtamara committed Mar 14, 2024
1 parent 6bb8517 commit 77bd4a2
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 60 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ GEM
mime-types-data (3.2024.0206)
mini_mime (1.1.5)
mini_portile2 (2.8.5)
minitest (5.22.2)
minitest (5.22.3)
minitest-reporters (1.6.1)
ansi
builder
Expand Down Expand Up @@ -272,7 +272,7 @@ GEM
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
rails-i18n (7.0.8)
rails-i18n (7.0.9)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
railties (7.1.3.2)
Expand Down
54 changes: 31 additions & 23 deletions bin/regresion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ if (test -f "test/dummy/config/application.rb") then {
} else {
rutaap="./"
} fi;
echo "bin/regresion rutaap=$rutaap"
if (test -f $rutaap/.env) then {
dirac=`pwd`
cd $rutaap
Expand Down Expand Up @@ -36,45 +37,52 @@ if (test "$RUTA_RELATIVA" = "") then {
exit 1
} fi;

echo "== Prepara base"
if (test "$SALTAPREPARA" != "1") then {
echo "== Prepara base"

(cd $rutaap; ${RAILS} db:environment:set RAILS_ENV=test; RAILS_ENV=test ${RAILS} db:drop db:create db:setup db:seed msip:indices)
if (test "$?" != "0") then {
echo "No se pudo inicializar base de pruebas";
exit 1;
} fi;

echo "== Pruebas de regresión unitarias"
mkdir -p cobertura-unitarias/
rm -rf cobertura-unitarias/{*,.*}
CONFIG_HOSTS=www.example.com RUTA_RELATIVA=/ ${RAILS} test test/models test/controllers test/helpers
if (test "$?" != "0") then {
echo "No pasaron pruebas de regresión unitarias";
exit 1;
(cd $rutaap; ${RAILS} db:environment:set RAILS_ENV=test; RAILS_ENV=test ${RAILS} db:drop db:create db:setup db:seed msip:indices)
if (test "$?" != "0") then {
echo "No se pudo inicializar base de pruebas";
exit 1;
} fi;
} fi;


if (test -d test/integration) then {
CONFIG_HOSTS=www.example.com RUTA_RELATIVA=/ bin/rails test `find test/integration -name "*rb" -type f`
if (test "$SALTAUNITARIAS" != "1") then {
echo "== Pruebas de regresión unitarias"
mkdir -p cobertura-unitarias/
rm -rf cobertura-unitarias/{*,.*}
CONFIG_HOSTS=www.example.com RUTA_RELATIVA=/ ${RAILS} test test/models test/controllers test/helpers
if (test "$?" != "0") then {
echo "No pasaron pruebas de integración";
echo "No pasaron pruebas de regresión unitarias";
exit 1;
} fi;


if (test -d test/integration -a "$SALTAINTEGRACION" != "1") then {
CONFIG_HOSTS=www.example.com RUTA_RELATIVA=/ bin/rails test `find test/integration -name "*rb" -type f`
if (test "$?" != "0") then {
echo "No pasaron pruebas de integración";
exit 1;
} fi;
} fi;

} fi;

echo "== Pruebas de regresión al sistema"
echo "== PRUEBAS DE REGRESIÓN AL SISTEMA"
mkdir -p $rutaap/cobertura-sistema/
rm -rf $rutaap/cobertura-sistema/{*,.*}
if (test "$CI" = "") then { # Por ahora no en gitlab-ci
(cd $rutaap; RUTA_RELATIVA="/" CONFIG_HOSTS=127.0.0.1 ${RAILS} msip:stimulus_motores test:system &)
if (test "$CI" = "" -a "$SALTACAPYBARA" != "1") then { # Por ahora no en gitlab-ci
echo "== Con capybara $SALTACAPYBARA"
(cd $rutaap; RUTA_RELATIVA="/" CONFIG_HOSTS=127.0.0.1 ${RAILS} msip:stimulus_motores test:system)
if (test "$?" != "0") then {
echo "No pasaron pruebas del sistema rails";
exit 1;
} fi;
} fi;

if (test -f $rutaap/bin/pruebasjs -a "x$NOPRUEBAJS" != "x1") then {
(cd $rutaap; CONFIG_HOSTS=127.0.0.1 ${RAILS} msip:stimulus_motores; bin/pruebasjs)
if (test -f $rutaap/bin/pruebasjs.sh -a "x$NOPRUEBAJS" != "x1") then {
echo "== Con puppeteer"
(cd $rutaap; ${RAILS} msip:stimulus_motores; IPDES=127.0.0.1 bin/pruebasjs.sh)
if (test "$?" != "0") then {
echo "No pasaron pruebas del sistema js";
exit 1;
Expand Down
37 changes: 31 additions & 6 deletions test/dummy/bin/pruebasjs → test/dummy/bin/pruebasjs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,48 @@ if (test ! -f .env) then {
} fi;
. ./.env

echo "IPDES=$IPDES"

if (test "$IPDES" = "127.0.0.1") then {
echo "=== Deteniendo"
bin/detiene

echo "=== Precompilando"
echo "rm -rf public/${RUTA_RELATIVA}/assets/*"
rm -rf public/${RUTA_RELATIVA}/assets/*
bin/rails assets:precompile
if (test "$SALTAPRECOMPILA" != "1") then {
echo "=== Precompilando"
echo "rm -rf public/${RUTA_RELATIVA}/assets/*"
rm -rf public/${RUTA_RELATIVA}/assets/*
bin/rails assets:precompile
} fi;

echo "=== Iniciando servidor"
CONFIG_HOSTS=127.0.0.1 R=f bin/corre &
CORRE_PID=$!
sleep 5;
echo "CORRE_PID=$CORRE_PID"
} fi;

sleep 10;
if (test "$CORRE_PID" = "") then {
echo "No pudo determinarse PID del proceso con el lado del servidor"
exit 1;
} fi;
rps=`ps $CORRE_PID`
if (test "$?" != "0") then {
echo "No arrancó proceso con el lado del servidor"
exit 1;
} fi;
clrps=`echo $rps | wc -l | sed -e "s/ //g"`
if (test "$clrps" != "1") then {
# 2 desde una terminal, 1 desde un script
echo "Problema identificado proceso con el lado del servidor"
echo "clrps=$clrps rps=$rps"
exit 1;
} fi;

echo "***"
w3m -dump http://${IPDES}:${PUERTODES}/${RUTA_RELATIVA}
w3m -dump http://${IPDES}:${PUERTODES}/${RUTA_RELATIVA} | tee /tmp/salw3m
if (test "$?" != "0" -o ! -s /tmp/salw3m) then {
exit 1;
} fi;
echo "***"

cd test/puppeteer
Expand Down
8 changes: 4 additions & 4 deletions test/dummy/test/puppeteer/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

"@pasosdeJesus/pruebas_puppeteer@https://gitpkg.now.sh/pasosdeJesus/msip/pruebas_puppeteer?main":
version "0.0.9-a7"
resolved "https://gitpkg.now.sh/pasosdeJesus/msip/pruebas_puppeteer?main#30f4e053daf68f14f7ad116903273dbaaef28d96"
resolved "https://gitpkg.now.sh/pasosdeJesus/msip/pruebas_puppeteer?main#b517f1ef6e698faa68865d22c4bc993934ecb038"

"@puppeteer/browsers@1.4.6":
version "1.4.6"
Expand All @@ -25,9 +25,9 @@
integrity sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==

"@types/node@*":
version "20.11.26"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.26.tgz#3fbda536e51d5c79281e1d9657dcb0131baabd2d"
integrity sha512-YwOMmyhNnAWijOBQweOJnQPl068Oqd4K3OFbTc6AHJwzweUwwWG3GIFY74OKks2PJUDkQPeddOQES9mLn1CTEQ==
version "20.11.27"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.27.tgz#debe5cfc8a507dd60fe2a3b4875b1604f215c2ac"
integrity sha512-qyUZfMnCg1KEz57r7pzFtSGt49f6RPkPBis3Vo4PbS7roQEDn22hiHzl/Lo1q4i4hDEgBJmBF/NTNg2XR0HbFg==
dependencies:
undici-types "~5.26.4"

Expand Down
61 changes: 36 additions & 25 deletions test/dummy/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@
lodash.debounce "^4.0.8"
resolve "^1.14.2"

"@babel/helper-define-polyfill-provider@^0.6.1":
version "0.6.1"
resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.1.tgz#fadc63f0c2ff3c8d02ed905dcea747c5b0fb74fd"
integrity sha512-o7SDgTJuvx5vLKD6SFvkydkSMBvahDKGiNJzG22IZYXhiqoe9efY7zocICBgzHV4IRg5wdgl2nEL/tulKIEIbA==
dependencies:
"@babel/helper-compilation-targets" "^7.22.6"
"@babel/helper-plugin-utils" "^7.22.5"
debug "^4.1.1"
lodash.debounce "^4.0.8"
resolve "^1.14.2"

"@babel/helper-environment-visitor@^7.22.20":
version "7.22.20"
resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz#96159db61d34a29dba454c959f5ae4a649ba9167"
Expand Down Expand Up @@ -1531,9 +1542,9 @@
"@types/istanbul-lib-report" "*"

"@types/node@*":
version "20.11.24"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.24.tgz#cc207511104694e84e9fb17f9a0c4c42d4517792"
integrity sha512-Kza43ewS3xoLgCEpQrsT+xRo/EJej1y0kVYGiLFE1NEODXGzTfwiC6tXTLMQskn1X4/Rjlh0MQUvx9W+L9long==
version "20.11.27"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.27.tgz#debe5cfc8a507dd60fe2a3b4875b1604f215c2ac"
integrity sha512-qyUZfMnCg1KEz57r7pzFtSGt49f6RPkPBis3Vo4PbS7roQEDn22hiHzl/Lo1q4i4hDEgBJmBF/NTNg2XR0HbFg==
dependencies:
undici-types "~5.26.4"

Expand Down Expand Up @@ -1697,12 +1708,12 @@ babel-plugin-macros@^3.1.0:
resolve "^1.19.0"

babel-plugin-polyfill-corejs2@^0.4.8:
version "0.4.8"
resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.8.tgz#dbcc3c8ca758a290d47c3c6a490d59429b0d2269"
integrity sha512-OtIuQfafSzpo/LhnJaykc0R/MMnuLSSVjVYy9mHArIZ9qTCSZ6TpWCuEKZYVoN//t8HqBNScHrOtCrIK5IaGLg==
version "0.4.10"
resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.10.tgz#276f41710b03a64f6467433cab72cbc2653c38b1"
integrity sha512-rpIuu//y5OX6jVU+a5BCn1R5RSZYWAl2Nar76iwaOdycqb6JPxediskWFMMl7stfwNJR4b7eiQvh5fB5TEQJTQ==
dependencies:
"@babel/compat-data" "^7.22.6"
"@babel/helper-define-polyfill-provider" "^0.5.0"
"@babel/helper-define-polyfill-provider" "^0.6.1"
semver "^6.3.1"

babel-plugin-polyfill-corejs3@^0.9.0:
Expand Down Expand Up @@ -1855,9 +1866,9 @@ camelcase@^6.2.0:
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==

caniuse-lite@^1.0.30001587:
version "1.0.30001594"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001594.tgz#bea552414cd52c2d0c985ed9206314a696e685f5"
integrity sha512-VblSX6nYqyJVs8DKFMldE2IVCJjZ225LW00ydtUWwh5hk9IfkTOffO6r8gJNsH0qqqeAF8KrbMYA2VEwTlGW5g==
version "1.0.30001597"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001597.tgz#8be94a8c1d679de23b22fbd944232aa1321639e6"
integrity sha512-7LjJvmQU6Sj7bL0j5b5WY/3n7utXUJvAe1lxhsHDbLmwX9mdL86Yjtr+5SRCyf8qME4M7pU2hswj0FpyBVCv9w==

chalk@^2.4.2:
version "2.4.2"
Expand Down Expand Up @@ -2030,7 +2041,7 @@ deepmerge@^4.2.2:
resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a"
integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==

define-data-property@^1.0.1, define-data-property@^1.1.2:
define-data-property@^1.0.1, define-data-property@^1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e"
integrity sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==
Expand Down Expand Up @@ -2078,9 +2089,9 @@ dom-accessibility-api@^0.5.6:
integrity sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==

electron-to-chromium@^1.4.668:
version "1.4.692"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.692.tgz#82139d20585a4b2318a02066af7593a3e6bec993"
integrity sha512-d5rZRka9n2Y3MkWRN74IoAsxR0HK3yaAt7T50e3iT9VZmCCQDT3geXUO5ZRMhDToa1pkCeQXuNo+0g+NfDOVPA==
version "1.4.705"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.705.tgz#ef4f912620bd7c9555a20554ffc568184c0ddceb"
integrity sha512-LKqhpwJCLhYId2VVwEzFXWrqQI5n5zBppz1W9ehhTlfYU8CUUW6kClbN8LHF/v7flMgRdETS772nqywJ+ckVAw==

emittery@^0.13.1:
version "0.13.1"
Expand Down Expand Up @@ -2310,7 +2321,7 @@ get-caller-file@^2.0.5:
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==

get-intrinsic@^1.1.3, get-intrinsic@^1.2.3, get-intrinsic@^1.2.4:
get-intrinsic@^1.1.3, get-intrinsic@^1.2.4:
version "1.2.4"
resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.4.tgz#e385f5a4b5227d449c3eabbad05494ef0abbeadd"
integrity sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==
Expand Down Expand Up @@ -2394,7 +2405,7 @@ has-flag@^4.0.0:
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==

has-property-descriptors@^1.0.0, has-property-descriptors@^1.0.1:
has-property-descriptors@^1.0.0, has-property-descriptors@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz#963ed7d071dc7bf5f084c5bfbe0d1b6222586854"
integrity sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==
Expand All @@ -2412,9 +2423,9 @@ has-symbols@^1.0.3:
integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==

hasown@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.1.tgz#26f48f039de2c0f8d3356c223fb8d50253519faa"
integrity sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA==
version "2.0.2"
resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003"
integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==
dependencies:
function-bind "^1.1.2"

Expand Down Expand Up @@ -3515,16 +3526,16 @@ semver@^7.5.3, semver@^7.5.4:
lru-cache "^6.0.0"

set-function-length@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.1.tgz#47cc5945f2c771e2cf261c6737cf9684a2a5e425"
integrity sha512-j4t6ccc+VsKwYHso+kElc5neZpjtq9EnRICFZtWyBsLojhmeF/ZBd/elqm22WJh/BziDe/SBiOeAt0m2mfLD0g==
version "1.2.2"
resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.2.tgz#aac72314198eaed975cf77b2c3b6b880695e5449"
integrity sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==
dependencies:
define-data-property "^1.1.2"
define-data-property "^1.1.4"
es-errors "^1.3.0"
function-bind "^1.1.2"
get-intrinsic "^1.2.3"
get-intrinsic "^1.2.4"
gopd "^1.0.1"
has-property-descriptors "^1.0.1"
has-property-descriptors "^1.0.2"

shebang-command@^2.0.0:
version "2.0.0"
Expand Down

0 comments on commit 77bd4a2

Please sign in to comment.