Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vbs #167

Closed
wants to merge 19 commits into from
Closed

Vbs #167

Changes from 1 commit
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
Prev Previous commit
Next Next commit
updated
Signed-off-by: SONIABHISHEK121 <[email protected]>
ABHISHEKSONI121 committed Aug 3, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit e5d84212f78c5568e95eb988c924b12cf7430a99
27 changes: 23 additions & 4 deletions .github/workflows/windows-installer.yml
Original file line number Diff line number Diff line change
@@ -154,18 +154,37 @@ jobs:
run: |
$env:Path += ";$pwd"
. .\tests\test_rece1.ps1
- name: Copy pyi25.vbs to dist folder
- name: List ejemplos directory
run: |
Copy-Item ${{ github.workspace }}\ejemplos\pyi25\pyi25.vbs .\dist\
Get-ChildItem -Recurse .\ejemplos
- name: Create dist folder if not exists
run: |
New-Item -ItemType Directory -Force -Path .\dist
- name: Copy VBS files to dist folder
run: |
Copy-Item .\ejemplos\pyi25\pyi25.vbs .\dist\ -ErrorAction Stop
Copy-Item .\ejemplos\pyqr\pyqr.vbs .\dist\ -ErrorAction Stop
Copy-Item .\ejemplos\factura_electronica.vbs .\dist\ -ErrorAction Stop
Copy-Item .\ejemplos\remito_electronico_carnico.vbs .\dist\ -ErrorAction Stop
- name: Test pyi25.vbs
run: |
.\tests\test_pyi25.ps1
- name: Test pyqr.vbs
run: |
.\tests\test_pyqr.ps1
- name: Test factura_electronica.vbs
run: |
run: |
.\tests\test_factura_electronica.ps1
- name: Test remito_electronico_carnico.vbs
run: |
.\tests\test_remito_electronico_carnico.ps1
.\tests\test_remito_electronico_carnico.ps1

pre-release:
name: "Pre Release"
41 changes: 27 additions & 14 deletions tests/powershell/test_factura_electronica.ps1
Original file line number Diff line number Diff line change
@@ -2,29 +2,42 @@

$ErrorActionPreference = "Stop"

# Set the working directory to the root of the repository
Set-Location $PSScriptRoot\..

# Verify dependencies
if (-not (Test-Path ".\dist\factura_electronica.vbs")) {
Write-Error "factura_electronica.vbs not found in dist folder. Ensure all dependencies are installed."
exit 1
}

# Set execution policy for this script
try {
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force
} catch {
Write-Warning "Failed to set execution policy. Script may fail if not run with appropriate permissions."
}

# Run the VBS script and capture its output
$output = cscript //nologo ejemplos\factura_electronica.vbs
try {
$output = cscript //nologo .\dist\factura_electronica.vbs
$output | Out-File -FilePath "factura_electronica_output.log"
} catch {
Write-Error "Failed to execute factura_electronica.vbs: $_"
exit 1
}

# Check if the script executed successfully
if ($LASTEXITCODE -ne 0) {
Write-Error "factura_electronica.vbs failed to execute"
Write-Error "factura_electronica.vbs failed to execute with exit code $LASTEXITCODE"
exit 1
}

# Test for expected output
$expectedOutputs = @(
"InstallDir",
"Token",
"Sign",
"Ultimo comprobante:",
"Resultado",
"CAE",
"Numero de comprobante:",
"ErrMsg",
"Obs",
"Reprocesar:",
"Reproceso:",
"EmisionTipo:"
"InstallDir", "Token", "Sign", "Ultimo comprobante:", "Resultado",
"CAE", "Numero de comprobante:", "ErrMsg", "Obs", "Reprocesar:",
"Reproceso:", "EmisionTipo:"
)

foreach ($expected in $expectedOutputs) {
23 changes: 7 additions & 16 deletions tests/powershell/test_pyi25.ps1
Original file line number Diff line number Diff line change
@@ -6,8 +6,8 @@ $ErrorActionPreference = "Stop"
Set-Location $PSScriptRoot\..

# Verify dependencies
if (-not (Test-Path "${{ github.workspace }}\dist\pyi25.vbs")) {
Write-Error "pyi25.vbs not found. Ensure all dependencies are installed."
if (-not (Test-Path ".\dist\pyi25.vbs")) {
Write-Error "pyi25.vbs not found in dist folder. Ensure all dependencies are installed."
exit 1
}

@@ -20,7 +20,8 @@ try {

# Run the VBS script and capture its output
try {
$output = cscript //nologo .\ejemplos\pyi25\pyi25.vbs
$output = cscript //nologo .\dist\pyi25.vbs
$output | Out-File -FilePath "pyi25_output.log"
} catch {
Write-Error "Failed to execute pyi25.vbs: $_"
exit 1
@@ -33,23 +34,13 @@ if ($LASTEXITCODE -ne 0) {
}

# Test for expected output
if ($output -notmatch "Version") {
Write-Error "Version information not found in output"
exit 1
}

if ($output -notmatch "Barras") {
Write-Error "Barcode information not found in output"
exit 1
}

if ($output -notmatch "Listo!") {
Write-Error "Script did not complete successfully"
if ($output -notmatch "Version" -or $output -notmatch "Barras" -or $output -notmatch "Listo!") {
Write-Error "Expected output not found in pyi25.vbs execution"
exit 1
}

# Check if the output file was created
if (-not (Test-Path ".\ejemplos\pyi25\barras.png")) {
if (-not (Test-Path ".\dist\barras.png")) {
Write-Error "Barcode image file was not created"
exit 1
}
44 changes: 28 additions & 16 deletions tests/powershell/test_pyqr.ps1
Original file line number Diff line number Diff line change
@@ -2,23 +2,40 @@

$ErrorActionPreference = "Stop"

# Set the working directory to the root of the repository
Set-Location $PSScriptRoot\..

# Verify dependencies
if (-not (Test-Path ".\dist\pyqr.vbs")) {
Write-Error "pyqr.vbs not found in dist folder. Ensure all dependencies are installed."
exit 1
}

# Set execution policy for this script
try {
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force
} catch {
Write-Warning "Failed to set execution policy. Script may fail if not run with appropriate permissions."
}

# Run the VBS script and capture its output
$output = cscript //nologo ejemplos\pyqr\pyqr.vbs
try {
$output = cscript //nologo .\dist\pyqr.vbs
$output | Out-File -FilePath "pyqr_output.log"
} catch {
Write-Error "Failed to execute pyqr.vbs: $_"
exit 1
}

# Check if the script executed successfully
if ($LASTEXITCODE -ne 0) {
Write-Error "pyqr.vbs failed to execute"
Write-Error "pyqr.vbs failed to execute with exit code $LASTEXITCODE"
exit 1
}

# Test for expected output
if ($output -notmatch "CrearArchivo") {
Write-Error "CrearArchivo output not found"
exit 1
}

if ($output -notmatch "GenerarImagen") {
Write-Error "GenerarImagen output not found"
if ($output -notmatch "CrearArchivo" -or $output -notmatch "GenerarImagen") {
Write-Error "Expected output not found in pyqr.vbs execution"
exit 1
}

@@ -27,13 +44,8 @@ $createdFile = ($output -split "`n" | Select-String "CrearArchivo").ToString().T
$generatedImage = ($output -split "`n" | Select-String "GenerarImagen").ToString().Trim()

# Check if the files were created
if (-not (Test-Path $createdFile)) {
Write-Error "Created file does not exist: $createdFile"
exit 1
}

if (-not (Test-Path $generatedImage)) {
Write-Error "Generated image does not exist: $generatedImage"
if (-not (Test-Path $createdFile) -or -not (Test-Path $generatedImage)) {
Write-Error "Expected files not created by pyqr.vbs"
exit 1
}

42 changes: 27 additions & 15 deletions tests/powershell/test_remito_electronico_carnico.ps1
Original file line number Diff line number Diff line change
@@ -2,30 +2,42 @@

$ErrorActionPreference = "Stop"

# Set the working directory to the root of the repository
Set-Location $PSScriptRoot\..

# Verify dependencies
if (-not (Test-Path ".\dist\remito_electronico_carnico.vbs")) {
Write-Error "remito_electronico_carnico.vbs not found in dist folder. Ensure all dependencies are installed."
exit 1
}

# Set execution policy for this script
try {
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force
} catch {
Write-Warning "Failed to set execution policy. Script may fail if not run with appropriate permissions."
}

# Run the VBS script and capture its output
$output = cscript //nologo ejemplos\remito_electronico_carnico.vbs
try {
$output = cscript //nologo .\dist\remito_electronico_carnico.vbs
$output | Out-File -FilePath "remito_electronico_carnico_output.log"
} catch {
Write-Error "Failed to execute remito_electronico_carnico.vbs: $_"
exit 1
}

# Check if the script executed successfully
if ($LASTEXITCODE -ne 0) {
Write-Error "remito_electronico_carnico.vbs failed to execute"
Write-Error "remito_electronico_carnico.vbs failed to execute with exit code $LASTEXITCODE"
exit 1
}

# Test for expected output
$expectedOutputs = @(
"InstallDir",
"Token",
"Sign",
"Ultimo comprobante:",
"Resultado:",
"Cod Remito:",
"Numero Remito:",
"Cod Autorizacion:",
"Fecha Emision",
"Fecha Vencimiento",
"Observaciones:",
"Errores:",
"Evento:"
"InstallDir", "Token", "Sign", "Ultimo comprobante:", "Resultado:",
"Cod Remito:", "Numero Remito:", "Cod Autorizacion:", "Fecha Emision",
"Fecha Vencimiento", "Observaciones:", "Errores:", "Evento:"
)

foreach ($expected in $expectedOutputs) {