Skip to content

Commit

Permalink
Correct test results path for GitHub Actions reporters (#665)
Browse files Browse the repository at this point in the history
  • Loading branch information
justafish committed Aug 29, 2024
1 parent 6ea2952 commit b89fbd5
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion drainpipe-dev/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"composer/composer": "^2.7.8"
},
"bin": [
"bin/drainpipe-twig-linter",
"bin/drainpipe-convert-to-junit-xml"
],
"extra": {
Expand All @@ -49,6 +48,7 @@
"[web-root]/sites/sites.php": "scaffold/nightwatch/sites.php",
"[project-root]/.ddev/docker-compose.selenium.yaml": "scaffold/nightwatch/docker-compose.selenium.yaml",
"[project-root]/test/nightwatch/example.nightwatch.js": "scaffold/nightwatch/example.nightwatch.js",
"[project-root]/test/nightwatch/vrt/.gitignore": "scaffold/nightwatch/vrt.gitignore",
"[project-root]/phpcs.xml.dist": "scaffold/phpcs.xml.dist",
"[project-root]/phpstan.neon.dist": "scaffold/phpstan.neon.dist",
"[project-root]/.twig-cs-fixer.dist.php": "scaffold/.twig-cs-fixer.dist.php"
Expand Down
4 changes: 2 additions & 2 deletions drainpipe-dev/config/nightwatch.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ module.exports = {
filter: '**/*.nightwatch.js',
disable_error_log: false,
screenshots: {
enabled: false,
enabled: true,
on_failure: true,
on_error: false,
on_error: true,
path: 'test_result',
},
},
Expand Down
2 changes: 2 additions & 0 deletions drainpipe-dev/scaffold/nightwatch/vrt.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/diff
/latest
1 change: 0 additions & 1 deletion scaffold/github/workflows/TestFunctional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,3 @@ jobs:
comment_mode: off
files: |
test_result/**/*.xml
test-results/**/*.json
1 change: 0 additions & 1 deletion scaffold/github/workflows/TestStatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,3 @@ jobs:
comment_mode: off
files: |
test_result/**/*.xml
test-results/**/*.json
3 changes: 0 additions & 3 deletions scaffold/gitignore/common.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,3 @@ node_modules
test_result
.prettiercache
.twig-cs-fixer.cache
vrt-report
test/nightwatch/vrt/latest
test/nightwatch/vrt/diff
22 changes: 19 additions & 3 deletions tasks/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ tasks:
DIRS_ARR=({{.TWIG_DIRS}})
for DIR in "${DIRS_ARR[@]}"; do
if [ "{{.format}}" == "junit" ]; then
./vendor/bin/twig-cs-fixer lint $DIR --format junit
./vendor/bin/twig-cs-fixer lint $DIR --report junit > test_result/twig-cs-fixer.xml
else
./vendor/bin/twig-cs-fixer lint $DIR
fi
Expand Down Expand Up @@ -186,8 +186,9 @@ tasks:
desc: Checks for any untracked files in git
cmds:
- |
if [ "$(git status -s --ignore-submodules=dirty)" != "" ]; then
git status -s --ignore-submodules=dirty
# Ignore the .ddev folder as changes are made to this in order to run tests e.g. adding environment variables.
if [ "$(git status -s --ignore-submodules=dirty -- ':!.ddev')" != "" ]; then
git status -s --ignore-submodules=dirty -- ':!.ddev'
echo "Untracked changes detected - please rectify or add the files to your .gitignore"
exit 1
fi
Expand Down Expand Up @@ -333,6 +334,8 @@ tasks:
env:
NIGHTWATCH_ENV: 'firefox,chrome'
cmds:
- defer: { task: _nightwatch:vrt-report }
- rm -rf test_result/nightwatch*
- |
if [ -f "package-lock.json" ]; then
npx nightwatch --env $NIGHTWATCH_ENV {{.CLI_ARGS}}
Expand All @@ -342,3 +345,16 @@ tasks:
echo "Unable to figure out which package manager is in use"
exit 1;
fi
_nightwatch:vrt-report:
desc: "Moves the VRT report into the test_results folder"
cmds:
- |
if [ -d "vrt-report" ]; then
mkdir -p test_result
mv vrt-report test_result/nightwatch-vrt-report
cp -R test/nightwatch/vrt test_result/nightwatch-vrt-report
mkdir -p test_result/nightwatch-vrt-report/test/nightwatch
mv test_result/nightwatch-vrt-report/vrt test_result/nightwatch-vrt-report/test/nightwatch
sed -i 's/\/test\/nightwatch\/vrt\//test\/nightwatch\/vrt\//g' test_result/nightwatch-vrt-report/index.html
echo "Nightwatch VTR report moved to test_result/nightwatch-vrt-report"
fi

0 comments on commit b89fbd5

Please sign in to comment.