This repository was archived by the owner on Jan 28, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Screenshot feature #23
Closed
Closed
Changes from 45 commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
7d04f7d
Create screenshot-on-pr.yml
amarilda611 905ea34
Create screenshot.js
amarilda611 63889f4
Update screenshot-on-pr.yml
amarilda611 e9eefb3
Update screenshot-on-pr.yml
amarilda611 5d6888d
Update screenshot-on-pr.yml
amarilda611 ec21c34
Update screenshot.js
amarilda611 1a65cb1
Update screenshot-on-pr.yml
amarilda611 3b3c88e
Update screenshot-on-pr.yml
amarilda611 6417bc4
Update screenshot.js
amarilda611 31ae72b
Update screenshot.js
amarilda611 7f16749
Update screenshot-on-pr.yml
amarilda611 39e4fb1
Update screenshot.js
amarilda611 a56a3ab
Update screenshot-on-pr.yml
amarilda611 edefe7b
Update screenshot.js
amarilda611 a202684
Update screenshot-on-pr.yml
amarilda611 96305e6
Update screenshot.js
amarilda611 cf62c61
Update screenshot-on-pr.yml
amarilda611 bc9fddb
Update screenshot.js
amarilda611 ace0b77
Update screenshot-on-pr.yml
amarilda611 9571ef0
Update screenshot.js
amarilda611 20585b1
Update screenshot-on-pr.yml
amarilda611 d621a5d
Update screenshot.js
amarilda611 1c554c8
Update screenshot-on-pr.yml
amarilda611 96339ab
Update screenshot.js
amarilda611 11a009e
Update screenshot-on-pr.yml
amarilda611 4346c3d
Update screenshot.js
amarilda611 fb094a9
Update screenshot-on-pr.yml
amarilda611 3287807
Update screenshot.js
amarilda611 edc849d
Update screenshot-on-pr.yml
amarilda611 79b94cd
Update screenshot.js
amarilda611 1518ae1
Update screenshot-on-pr.yml
amarilda611 4bfe625
Update screenshot.js
amarilda611 892d49f
Update screenshot-on-pr.yml
amarilda611 bd4d4ff
Update screenshot.js
amarilda611 e6570eb
Update screenshot.js
amarilda611 cf992cf
Update screenshot-on-pr.yml
amarilda611 f2d64e7
Update screenshot.js
amarilda611 5930382
Update screenshot-on-pr.yml
amarilda611 1b97bb6
Update screenshot.js
amarilda611 a62b880
Update screenshot-on-pr.yml
amarilda611 17102b8
Update screenshot.js
amarilda611 c0a14df
Update screenshot-on-pr.yml
amarilda611 9a94ddf
Update screenshot.js
amarilda611 3b66f9b
Update screenshot-on-pr.yml
amarilda611 8fa3703
Update screenshot.js
amarilda611 a4f3527
Update screenshot-on-pr.yml
amarilda611 0e32018
Update screenshot.js
amarilda611 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,55 @@ | ||
| name: GUI Screenshots in PR | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, reopened, synchronize] | ||
|
|
||
| permissions: | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| capture-screenshots: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 3 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
|
|
||
| - name: Install Playwright | ||
| run: npm install playwright | ||
|
|
||
| - name: Capture and embed screenshots | ||
| id: screenshots | ||
| run: | | ||
| # Create output directory | ||
| mkdir -p screenshots | ||
|
|
||
| # Run screenshot script | ||
| node scripts/screenshot.js | ||
|
|
||
| # Get base64 images and set output | ||
| IMAGES_MARKDOWN="" | ||
| for file in screenshots/*.jpg; do | ||
| [ -e "$file" ] || continue | ||
| base64_data=$(base64 -w0 "$file") | ||
| IMAGES_MARKDOWN+="\n\n" | ||
| done | ||
|
|
||
| # Escape newlines for output | ||
| IMAGES_MARKDOWN="${IMAGES_MARKDOWN//$'\n'/'%0A'}" | ||
| echo "images=$IMAGES_MARKDOWN" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Post images to PR | ||
| uses: marocchino/sticky-pull-request-comment@v2 | ||
| with: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| header: gui-screenshots | ||
| message: | | ||
| ## 🖼️ Automated UI Preview | ||
| ${{ steps.screenshots.outputs.images }} |
This file contains hidden or 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,36 @@ | ||||||
| const { chromium } = require('playwright'); | ||||||
|
|
||||||
| (async () => { | ||||||
| const browser = await chromium.launch(); | ||||||
| const page = await browser.newPage(); | ||||||
|
|
||||||
| try { | ||||||
| // Reduce image size | ||||||
| await page.setViewportSize({ width: 800, height: 600 }); | ||||||
|
|
||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [prettier] reported by reviewdog 🐶
Suggested change
|
||||||
| // Example 1: Homepage | ||||||
| await page.goto('https://example.com', { waitUntil: 'networkidle' }); | ||||||
| await page.screenshot({ | ||||||
| path: 'screenshots/home.jpg', | ||||||
| type: 'jpeg', | ||||||
| quality: 70, | ||||||
| fullPage: false | ||||||
| }); | ||||||
|
|
||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [prettier] reported by reviewdog 🐶
Suggested change
|
||||||
| // Example 2: About page | ||||||
| await page.goto('https://example.com/about', { waitUntil: 'networkidle' }); | ||||||
| await page.screenshot({ | ||||||
| path: 'screenshots/about.jpg', | ||||||
| type: 'jpeg', | ||||||
| quality: 70, | ||||||
| fullPage: false | ||||||
| }); | ||||||
|
|
||||||
| console.log('Screenshots captured successfully!'); | ||||||
| } catch (error) { | ||||||
| console.error('❌ Screenshot failed:', error); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [prettier] reported by reviewdog 🐶
Suggested change
|
||||||
| process.exit(1); | ||||||
| } finally { | ||||||
| await browser.close(); | ||||||
| } | ||||||
| })(); | ||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[prettier] reported by reviewdog 🐶