-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add script for showing playwright report
- Loading branch information
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |