import { chromium } from '@playwright/test'; const browser = await chromium.launch(); const page = await browser.newPage({ viewport: { width: 390, height: 844 } }); await page.goto('http://219.157.255.213:32006/a/nzmk2kr4trzemiwmv65uwxva'); await page.locator('.share-btn').waitFor({ timeout: 15000 }); // ① 相册页分享按钮 → 弹层 await page.locator('.share-btn').click(); const sheet = page.locator('.share-sheet'); await sheet.waitFor({ timeout: 5000 }); const urlText = await page.locator('[data-test="share-sheet-url"]').textContent(); const qr = await page.locator('.share-sheet-qr canvas').evaluate((el) => el.width); const copyBtn = page.locator('[data-test="share-sheet-copy"]'); await copyBtn.click(); await page.waitForTimeout(400); const feedback = await copyBtn.textContent(); console.log('[album] url =', urlText?.slice(0, 60)); console.log('[album] qr canvas width =', qr, '; copy feedback =', feedback?.trim()); await page.screenshot({ path: '../../docs/designs/ui04-implementation/actual/server/share-sheet-album.png' }); // 关闭弹层(Esc),打开大图再验证照片分享 await page.keyboard.press('Escape'); await page.locator('img').first().click(); await page.waitForTimeout(1200); await page.locator('button[aria-label="分享照片"]').click(); await sheet.waitFor({ timeout: 5000 }); const photoUrl = await page.locator('[data-test="share-sheet-url"]').textContent(); console.log('[photo] url =', photoUrl?.slice(0, 70)); await page.screenshot({ path: '../../docs/designs/ui04-implementation/actual/server/share-sheet-photo.png' }); await browser.close();