Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
test
autotest-playwright-web-spd
Commits
fe65124c
Commit
fe65124c
authored
Sep 15, 2026
by
liguangyu06
Browse files
Launch Playwright via local CLI on Windows instead of spawning npx.cmd.
parent
87ddd5b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Jenkinsfile
View file @
fe65124c
...
@@ -17,17 +17,17 @@ def sendReportEmail() {
...
@@ -17,17 +17,17 @@ def sendReportEmail() {
def
body
=
fileExists
(
'reports/latest/email-summary.html'
)
def
body
=
fileExists
(
'reports/latest/email-summary.html'
)
?
readFile
(
encoding:
'UTF-8'
,
file:
'reports/latest/email-summary.html'
)
?
readFile
(
encoding:
'UTF-8'
,
file:
'reports/latest/email-summary.html'
)
:
"<p>构建 ${currentBuild.currentResult},未生成摘要。请打开 <a href='${env.BUILD_URL}'>Jenkins</a></p>"
:
"<p>构建 ${currentBuild.currentResult},未生成摘要。请打开 <a href='${env.BUILD_URL}'>Jenkins</a></p>"
if
(
cc
)
{
to
=
[
to
,
cc
].
findAll
{
it
}.
join
(
','
)
}
try
{
try
{
emailext
(
emailext
(
to:
to
,
to:
to
,
cc:
cc
,
subject:
subject
,
subject:
subject
,
body:
body
,
body:
body
,
mimeType:
'text/html'
,
mimeType:
'text/html'
,
charset:
'UTF-8'
,
attachLog:
false
,
attachLog:
false
,
attachmentsPattern:
'reports/latest/email-summary.html,reports/latest/email-summary.txt'
,
attachmentsPattern:
'reports/latest/email-summary.html,reports/latest/email-summary.txt'
recipientProviders:
[]
)
)
echo
"已发送报告邮件至 ${to}(正文为摘要+报告链接,附件为 email-summary.html)"
echo
"已发送报告邮件至 ${to}(正文为摘要+报告链接,附件为 email-summary.html)"
}
catch
(
err
)
{
}
catch
(
err
)
{
...
@@ -40,7 +40,10 @@ def runCi() {
...
@@ -40,7 +40,10 @@ def runCi() {
if
(
isUnix
())
{
if
(
isUnix
())
{
sh
'node scripts/run-ci.mjs --suite="$SUITE" --shards="$SHARDS"'
sh
'node scripts/run-ci.mjs --suite="$SUITE" --shards="$SHARDS"'
}
else
{
}
else
{
bat
'node scripts\\run-ci.mjs --suite=%SUITE% --shards=%SHARDS%'
bat
'''
set PATH=C:\\Program Files\\nodejs;%PATH%
node scripts\\run-ci.mjs --suite=%SUITE% --shards=%SHARDS%
'''
}
}
}
}
...
...
scripts/run-ci.mjs
View file @
fe65124c
...
@@ -28,6 +28,7 @@ import { fileURLToPath } from 'node:url';
...
@@ -28,6 +28,7 @@ import { fileURLToPath } from 'node:url';
import
{
formatSuiteList
,
getSuite
}
from
'
../config/suites.config.mjs
'
;
import
{
formatSuiteList
,
getSuite
}
from
'
../config/suites.config.mjs
'
;
const
ROOT
=
path
.
resolve
(
path
.
dirname
(
fileURLToPath
(
import
.
meta
.
url
)),
'
..
'
);
const
ROOT
=
path
.
resolve
(
path
.
dirname
(
fileURLToPath
(
import
.
meta
.
url
)),
'
..
'
);
const
PLAYWRIGHT_CLI
=
path
.
join
(
ROOT
,
'
node_modules/playwright/cli.js
'
);
function
parseArgs
(
argv
)
{
function
parseArgs
(
argv
)
{
const
out
=
{
const
out
=
{
...
@@ -140,12 +141,13 @@ async function preflight(baseURL) {
...
@@ -140,12 +141,13 @@ async function preflight(baseURL) {
}
}
function
runPlaywright
(
args
,
env
)
{
function
runPlaywright
(
args
,
env
)
{
return
new
Promise
((
resolve
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
child
=
spawn
(
'
npx
'
,
[
'
playwright
'
,
'
test
'
,
...
args
],
{
const
child
=
spawn
(
process
.
execPath
,
[
PLAYWRIGHT_CLI
,
'
test
'
,
...
args
],
{
cwd
:
ROOT
,
cwd
:
ROOT
,
env
,
env
,
stdio
:
'
inherit
'
,
stdio
:
'
inherit
'
,
});
});
child
.
on
(
'
error
'
,
reject
);
child
.
on
(
'
exit
'
,
(
code
)
=>
resolve
(
code
??
1
));
child
.
on
(
'
exit
'
,
(
code
)
=>
resolve
(
code
??
1
));
});
});
}
}
...
@@ -229,7 +231,7 @@ function mergeAllureResults(sourceDirs, dest) {
...
@@ -229,7 +231,7 @@ function mergeAllureResults(sourceDirs, dest) {
function
mergeBlobHtml
(
blobDir
,
htmlDir
)
{
function
mergeBlobHtml
(
blobDir
,
htmlDir
)
{
if
(
!
existsSync
(
blobDir
)
||
readdirSync
(
blobDir
).
length
===
0
)
return
false
;
if
(
!
existsSync
(
blobDir
)
||
readdirSync
(
blobDir
).
length
===
0
)
return
false
;
const
result
=
spawnSync
(
'
npx
'
,
[
'
playwright
'
,
'
merge-reports
'
,
blobDir
,
'
--reporter
'
,
'
html
'
],
{
const
result
=
spawnSync
(
process
.
execPath
,
[
PLAYWRIGHT_CLI
,
'
merge-reports
'
,
blobDir
,
'
--reporter
'
,
'
html
'
],
{
})
cwd
:
ROOT
,
cwd
:
ROOT
,
stdio
:
'
inherit
'
,
stdio
:
'
inherit
'
,
env
:
{
env
:
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment