|
1 | 1 | import { expect, test } from '@/playwright/suite'; |
2 | 2 | import { applyStandardMocks } from '@/playwright/mock-factory'; |
| 3 | +import { mockAmrPersonalWorkspace } from '@/playwright/amr'; |
3 | 4 | import { ensureRailOpen } from '@/playwright/rail'; |
4 | 5 | import { T } from '@/timeouts'; |
5 | 6 |
|
@@ -77,6 +78,45 @@ test.beforeEach(async ({ page }) => { |
77 | 78 | }); |
78 | 79 | }); |
79 | 80 |
|
| 81 | +test('[P1] signed-in update prompt opens below the standalone rocket within the viewport', async ({ |
| 82 | + page, |
| 83 | +}) => { |
| 84 | + await mockAmrPersonalWorkspace(page); |
| 85 | + await page.setViewportSize({ width: 700, height: 600 }); |
| 86 | + await page.goto('/', { waitUntil: 'domcontentloaded' }); |
| 87 | + await page.getByText('Loading OpenDesign…').waitFor({ state: 'hidden', timeout: T.long }); |
| 88 | + await expect(page.getByTestId('entry-nav-account')).toBeVisible(); |
| 89 | + |
| 90 | + const updaterButton = page.getByTestId('entry-nav-updater'); |
| 91 | + await updaterButton.click(); |
| 92 | + const popup = page.getByTestId('updater-popup'); |
| 93 | + await expect(popup).toBeVisible(); |
| 94 | + |
| 95 | + const geometry = await page.evaluate(() => { |
| 96 | + const rocket = document.querySelector('[data-testid="entry-nav-updater"]'); |
| 97 | + const prompt = document.querySelector('[data-testid="updater-popup"]'); |
| 98 | + if (rocket == null || prompt == null) return null; |
| 99 | + const rocketRect = rocket.getBoundingClientRect(); |
| 100 | + const promptRect = prompt.getBoundingClientRect(); |
| 101 | + return { |
| 102 | + rocketBottom: rocketRect.bottom, |
| 103 | + promptTop: promptRect.top, |
| 104 | + promptLeft: promptRect.left, |
| 105 | + promptRight: promptRect.right, |
| 106 | + viewportWidth: window.innerWidth, |
| 107 | + }; |
| 108 | + }); |
| 109 | + |
| 110 | + expect(geometry, 'standalone updater rocket and prompt must both be measurable').not.toBeNull(); |
| 111 | + expect(geometry!.promptTop, 'prompt must open below the standalone rocket').toBeGreaterThan( |
| 112 | + geometry!.rocketBottom, |
| 113 | + ); |
| 114 | + expect(geometry!.promptLeft, 'prompt must stay inside the viewport left edge').toBeGreaterThanOrEqual(0); |
| 115 | + expect(geometry!.promptRight, 'prompt must stay inside the viewport right edge').toBeLessThanOrEqual( |
| 116 | + geometry!.viewportWidth, |
| 117 | + ); |
| 118 | +}); |
| 119 | + |
80 | 120 | test('[P1] update ready prompt paints above the composer and its agent picker', async ({ page }) => { |
81 | 121 | test.fail( |
82 | 122 | true, |
|
0 commit comments