-
Notifications
You must be signed in to change notification settings - Fork 29
Render docs for iPhone 16 and fix CSS issues for multiple form factors #3452
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
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
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,99 @@ | ||
| import { chromium } from 'playwright'; | ||
|
|
||
| (async () => { | ||
| const browser = await chromium.launch({ | ||
| executablePath: '/usr/bin/chromium-browser', | ||
| headless: true, | ||
| }); | ||
|
|
||
| // Define form factors to test | ||
| const formFactors = [ | ||
| { | ||
| name: 'iPhone 16 (Mobile)', | ||
| viewport: { width: 393, height: 852 }, | ||
| deviceScaleFactor: 3, | ||
| isMobile: true, | ||
| hasTouch: true, | ||
| userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Mobile/15E148 Safari/604.1' | ||
| }, | ||
| { | ||
| name: 'Desktop Portrait', | ||
| viewport: { width: 1080, height: 1920 }, // 9:16 aspect ratio | ||
| deviceScaleFactor: 1, | ||
| isMobile: false, | ||
| hasTouch: false, | ||
| }, | ||
| { | ||
| name: 'Desktop Landscape', | ||
| viewport: { width: 1920, height: 1080 }, // 16:9 aspect ratio | ||
| deviceScaleFactor: 1, | ||
| isMobile: false, | ||
| hasTouch: false, | ||
| }, | ||
| { | ||
| name: 'Tablet 4:3', | ||
| viewport: { width: 1024, height: 768 }, // 4:3 aspect ratio (iPad) | ||
| deviceScaleFactor: 2, | ||
| isMobile: true, | ||
| hasTouch: true, | ||
| userAgent: 'Mozilla/5.0 (iPad; CPU OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1' | ||
| }, | ||
| ]; | ||
|
|
||
| const pages = [ | ||
| { url: 'http://localhost:4321/gh-aw/', name: 'homepage' }, | ||
| { url: 'http://localhost:4321/gh-aw/get-started/about/', name: 'content' }, | ||
| ]; | ||
|
|
||
| for (const formFactor of formFactors) { | ||
| console.log(`\n=== Testing: ${formFactor.name} ===`); | ||
|
|
||
| const context = await browser.newContext({ | ||
| viewport: formFactor.viewport, | ||
| deviceScaleFactor: formFactor.deviceScaleFactor, | ||
| isMobile: formFactor.isMobile, | ||
| hasTouch: formFactor.hasTouch, | ||
| userAgent: formFactor.userAgent, | ||
| }); | ||
|
|
||
| const page = await context.newPage(); | ||
|
|
||
| for (const testPage of pages) { | ||
| console.log(`Loading ${testPage.name}...`); | ||
| await page.goto(testPage.url, { waitUntil: 'networkidle' }); | ||
|
|
||
| // Calculate crop height to maintain 9:16 aspect ratio max | ||
| const { width, height } = formFactor.viewport; | ||
| const maxAspectRatio = 9 / 16; // Height/Width | ||
| const currentAspectRatio = height / width; | ||
|
|
||
| let cropHeight = height; | ||
| if (currentAspectRatio > maxAspectRatio) { | ||
| // Crop to 9:16 | ||
| cropHeight = Math.floor(width * maxAspectRatio); | ||
| } | ||
|
|
||
| const filename = `/tmp/${formFactor.name.toLowerCase().replace(/\s+/g, '-')}-${testPage.name}.png`; | ||
|
|
||
| // Take screenshot with crop if needed | ||
| if (cropHeight < height) { | ||
| await page.screenshot({ | ||
| path: filename, | ||
| clip: { x: 0, y: 0, width: width, height: cropHeight } | ||
| }); | ||
| console.log(` Cropped screenshot (${width}x${cropHeight}) saved to ${filename}`); | ||
| } else { | ||
| await page.screenshot({ | ||
| path: filename, | ||
| fullPage: false | ||
| }); | ||
| console.log(` Screenshot (${width}x${height}) saved to ${filename}`); | ||
| } | ||
| } | ||
|
|
||
| await context.close(); | ||
| } | ||
|
|
||
| await browser.close(); | ||
| console.log('\n✓ All form factors tested!'); | ||
| })(); |
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,40 @@ | ||||||
| import { chromium, devices } from 'playwright'; | ||||||
|
||||||
| import { chromium, devices } from 'playwright'; | |
| import { chromium } from 'playwright'; |
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,64 @@ | ||
| import { test, expect } from '@playwright/test'; | ||
|
|
||
| test.describe('Mobile and Responsive Layout', () => { | ||
| const formFactors = [ | ||
| { name: 'iPhone 16 (Mobile)', width: 393, height: 852 }, | ||
| { name: 'Tablet 4:3 (iPad)', width: 1024, height: 768 }, | ||
| { name: 'Desktop Portrait', width: 1080, height: 1920 }, | ||
| { name: 'Desktop Landscape', width: 1920, height: 1080 }, | ||
| ]; | ||
|
|
||
| const pages = [ | ||
| { url: '/gh-aw/', name: 'homepage' }, | ||
| { url: '/gh-aw/get-started/about/', name: 'content page' }, | ||
| ]; | ||
|
|
||
| for (const formFactor of formFactors) { | ||
| test.describe(`${formFactor.name}`, () => { | ||
| test.beforeEach(async ({ page }) => { | ||
| await page.setViewportSize({ | ||
| width: formFactor.width, | ||
| height: formFactor.height | ||
| }); | ||
| }); | ||
|
|
||
| for (const testPage of pages) { | ||
| test(`should render ${testPage.name} correctly`, async ({ page }) => { | ||
| await page.goto(testPage.url); | ||
| await page.waitForLoadState('networkidle'); | ||
|
|
||
| // Verify page loads | ||
| await expect(page).toHaveTitle(/GitHub Agentic Workflows/); | ||
|
|
||
| // Verify header is visible | ||
| const header = page.locator('header'); | ||
| await expect(header).toBeVisible(); | ||
|
|
||
| // Verify main content is visible | ||
| const main = page.locator('main'); | ||
| await expect(main).toBeVisible(); | ||
|
|
||
| // Check for horizontal scrollbar (should not exist) | ||
| const bodyScrollWidth = await page.evaluate(() => document.body.scrollWidth); | ||
| const bodyClientWidth = await page.evaluate(() => document.body.clientWidth); | ||
| expect(bodyScrollWidth).toBeLessThanOrEqual(bodyClientWidth + 1); // Allow 1px tolerance | ||
| }); | ||
| } | ||
|
|
||
| test('should have proper content spacing on mobile', async ({ page }) => { | ||
| if (formFactor.width <= 768) { | ||
| await page.goto('/gh-aw/get-started/about/'); | ||
| await page.waitForLoadState('networkidle'); | ||
|
|
||
| // Content should have proper padding | ||
| const contentPanel = page.locator('.content-panel'); | ||
| await expect(contentPanel).toBeVisible(); | ||
|
|
||
| // Sidebar should be hidden on mobile | ||
| const sidebar = page.locator('.sidebar'); | ||
| await expect(sidebar).not.toBeVisible(); | ||
| } | ||
| }); | ||
| }); | ||
| } | ||
| }); |
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.
The comment mentions 'tablets and phones' but the breakpoint at 768px may not cover all tablets. The test suite includes a 'Tablet 4:3 (iPad)' with width 1024px which would not match this media query. Consider updating the comment to clarify this only targets smaller phones and small tablets, or adjust the breakpoint if iPad-sized tablets should be included.