Skip to content

Commit a88fc0d

Browse files
committed
corrigiendo Jenkiensfile sencillo
1 parent 957613a commit a88fc0d

1 file changed

Lines changed: 52 additions & 10 deletions

File tree

Jenkinsfile

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,29 @@ pipeline {
22
agent any
33

44
parameters {
5-
choice(name: 'BROWSER', choices: ['chromium-ui', 'firefox-ui', 'webkit-ui', 'all'], description: 'Navegador')
6-
choice(name: 'TEST_SUITE', choices: ['all', 'ui', 'api', 'e2e'], description: 'Suite de tests')
5+
choice(
6+
name: 'BROWSER',
7+
choices: [
8+
'ui-tests',
9+
'api-tests',
10+
'e2e-tests',
11+
'integration-tests',
12+
'contract-tests',
13+
'performance-tests',
14+
'security-tests',
15+
'accessibility-tests',
16+
'visual-tests',
17+
'all'
18+
],
19+
description: 'Selecciona el proyecto de Playwright'
20+
)
21+
choice(
22+
name: 'TEST_SUITE',
23+
choices: ['all', 'ui', 'api', 'e2e', 'integration', 'contract', 'performance', 'security', 'accessibility', 'visual'],
24+
description: 'Selecciona la suite de tests'
25+
)
26+
booleanParam(name: 'HEADED', defaultValue: false, description: 'Ejecutar con interfaz gráfica')
27+
booleanParam(name: 'UPDATE_SNAPSHOTS', defaultValue: false, description: 'Actualizar screenshots base')
728
}
829

930
stages {
@@ -28,15 +49,14 @@ pipeline {
2849
steps {
2950
echo '=== Ejecutando tests ==='
3051
script {
31-
def testCommand = 'npx playwright test'
52+
def testCommand = buildTestCommand(
53+
params.TEST_SUITE,
54+
params.BROWSER,
55+
params.HEADED,
56+
params.UPDATE_SNAPSHOTS
57+
)
3258

33-
if (params.TEST_SUITE != 'all') {
34-
testCommand += " tests/${params.TEST_SUITE}/"
35-
}
36-
37-
if (params.BROWSER != 'all') {
38-
testCommand += " --project=${params.BROWSER}"
39-
}
59+
echo "Comando: ${testCommand}"
4060

4161
bat(script: testCommand, returnStatus: true)
4262
}
@@ -69,4 +89,26 @@ pipeline {
6989
echo '❌ Pipeline falló'
7090
}
7191
}
92+
}
93+
94+
def buildTestCommand(testSuite, browser, headed, updateSnapshots) {
95+
def command = 'npx playwright test'
96+
97+
if (testSuite != 'all') {
98+
command += " tests/${testSuite}/"
99+
}
100+
101+
if (browser != 'all') {
102+
command += " --project=${browser}"
103+
}
104+
105+
if (headed) {
106+
command += ' --headed'
107+
}
108+
109+
if (updateSnapshots) {
110+
command += ' --update-snapshots'
111+
}
112+
113+
return command
72114
}

0 commit comments

Comments
 (0)