|
1 | 1 | import {expect, test} from '@playwright/test' |
| 2 | +import {assertDefined} from 'src/utils/assert' |
2 | 3 | import { |
3 | 4 | homepageSetup, |
4 | 5 | returningUserVisitsHomepageWaitForModel, |
@@ -62,27 +63,25 @@ describe('AppsSideDrawer', () => { |
62 | 63 | const appsDrawer = page.getByTestId('AppsDrawer') |
63 | 64 |
|
64 | 65 | const handle = notesDrawer.getByTestId('resize-handle-x') |
65 | | - const handleBox = await handle.boundingBox() |
66 | | - expect(handleBox).toBeTruthy() |
| 66 | + const handleBox = assertDefined(await handle.boundingBox()) |
67 | 67 |
|
68 | 68 | // Drag left to widen Notes (this used to push Apps out of view). |
69 | 69 | await page.mouse.move( |
70 | | - handleBox!.x + handleBox!.width / 2, |
71 | | - handleBox!.y + handleBox!.height / 2, |
| 70 | + handleBox.x + (handleBox.width / 2), |
| 71 | + handleBox.y + (handleBox.height / 2), |
72 | 72 | ) |
73 | 73 | await page.mouse.down() |
74 | | - await page.mouse.move(handleBox!.x - 250, handleBox!.y + handleBox!.height / 2) |
| 74 | + const dragDistance = 250 |
| 75 | + await page.mouse.move(handleBox.x - dragDistance, handleBox.y + (handleBox.height / 2)) |
75 | 76 | await page.mouse.up() |
76 | 77 |
|
77 | 78 | // Apps should remain visible and inside the viewport. |
78 | 79 | await expect(page.getByTestId(`PanelTitle-${TITLE_APPS}`)).toBeVisible() |
79 | 80 |
|
80 | | - const appsBox = await appsDrawer.boundingBox() |
81 | | - expect(appsBox).toBeTruthy() |
82 | | - |
| 81 | + const appsBox = assertDefined(await appsDrawer.boundingBox()) |
83 | 82 | const vw = await page.evaluate(() => window.innerWidth) |
84 | | - expect(appsBox!.x).toBeGreaterThanOrEqual(0) |
85 | | - expect(appsBox!.x + appsBox!.width).toBeLessThanOrEqual(vw + 1) |
| 83 | + expect(appsBox.x).toBeGreaterThanOrEqual(0) |
| 84 | + expect(appsBox.x + (appsBox.width)).toBeLessThanOrEqual(vw + 1) |
86 | 85 | }) |
87 | 86 | }) |
88 | 87 | }) |
0 commit comments