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

chore: add script for showing playwright report #1879

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"lint:ci:all": "pnpm run lint:all --format @microsoft/eslint-formatter-sarif --output-file eslint-results.sarif",
"publint:all": "pnpm -r --parallel --aggregate-output exec publint",
"prepare": "simple-git-hooks",
"gh:show-report": "./scripts/show-last-test-report.sh",
larsrickert marked this conversation as resolved.
Show resolved Hide resolved
"preinstall": "npx only-allow pnpm"
},
"devDependencies": {
Expand Down
25 changes: 25 additions & 0 deletions scripts/show-last-test-report.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env sh

# check if gh cli is installed
if ! command -v gh &>/dev/null; then
echo "gh CLI is not installed. Please install it first: https://github.com/cli/cli#installation"
exit 1
fi

# Create temporary directory
TMP_DIR=$(mktemp -d)

# Create shell trap to clean up temporary directory
function cleanup {
rm -r ${TMP_DIR}
}
trap cleanup EXIT

# query the id of the last failed run for the current branch
GH_LAST_RUN_ID=$(gh run list -s failure -b $(git branch --show-current) --json "createdAt,databaseId" --jq "sort_by(.createdAt) | last.databaseId")

# download report
gh run download $GH_LAST_RUN_ID -D $TMP_DIR -p "html-report--attempt-1"

# show report
(cd $TMP_DIR/html-report--attempt-1/packages/sit-onyx && pnpm dlx playwright show-report)
Loading