draft line snapshots (#1445)
* draft line snapshots Make sure they don't get broken at some point, visual regression is only way to test these really * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
		@ -419,3 +419,61 @@ test('extrude on each default plane should be stable', async ({
 | 
			
		||||
  await runSnapshotsForOtherPlanes('YZ')
 | 
			
		||||
  await runSnapshotsForOtherPlanes('-YZ')
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
test('Draft segments should look right', async ({ page }) => {
 | 
			
		||||
  const u = getUtils(page)
 | 
			
		||||
  await page.setViewportSize({ width: 1200, height: 500 })
 | 
			
		||||
  const PUR = 400 / 37.5 //pixeltoUnitRatio
 | 
			
		||||
  await page.goto('/')
 | 
			
		||||
  await u.waitForAuthSkipAppStart()
 | 
			
		||||
  await u.openDebugPanel()
 | 
			
		||||
 | 
			
		||||
  await expect(page.getByRole('button', { name: 'Start Sketch' })).toBeVisible()
 | 
			
		||||
 | 
			
		||||
  // click on "Start Sketch" button
 | 
			
		||||
  await u.clearCommandLogs()
 | 
			
		||||
  await u.doAndWaitForImageDiff(
 | 
			
		||||
    () => page.getByRole('button', { name: 'Start Sketch' }).click(),
 | 
			
		||||
    200
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
  // select a plane
 | 
			
		||||
  await page.mouse.click(700, 200)
 | 
			
		||||
 | 
			
		||||
  await expect(page.locator('.cm-content')).toHaveText(
 | 
			
		||||
    `const part001 = startSketchOn('-XZ')`
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
  await page.waitForTimeout(300) // TODO detect animation ending, or disable animation
 | 
			
		||||
 | 
			
		||||
  const startXPx = 600
 | 
			
		||||
  await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10)
 | 
			
		||||
  const startAt = '[23.89, -32.23]'
 | 
			
		||||
  await expect(page.locator('.cm-content'))
 | 
			
		||||
    .toHaveText(`const part001 = startSketchOn('-XZ')
 | 
			
		||||
  |> startProfileAt(${startAt}, %)`)
 | 
			
		||||
  await page.waitForTimeout(100)
 | 
			
		||||
 | 
			
		||||
  await u.closeDebugPanel()
 | 
			
		||||
  await page.mouse.move(startXPx + PUR * 20, 500 - PUR * 10)
 | 
			
		||||
  await expect(page).toHaveScreenshot({
 | 
			
		||||
    maxDiffPixels: 100,
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 10)
 | 
			
		||||
  await page.waitForTimeout(100)
 | 
			
		||||
 | 
			
		||||
  const num = 24.11
 | 
			
		||||
  await expect(page.locator('.cm-content'))
 | 
			
		||||
    .toHaveText(`const part001 = startSketchOn('-XZ')
 | 
			
		||||
  |> startProfileAt(${startAt}, %)
 | 
			
		||||
  |> line([${num}, 0], %)`)
 | 
			
		||||
 | 
			
		||||
  await page.getByRole('button', { name: 'Tangential Arc' }).click()
 | 
			
		||||
 | 
			
		||||
  await page.mouse.move(startXPx + PUR * 30, 500 - PUR * 20, { steps: 10 })
 | 
			
		||||
 | 
			
		||||
  await expect(page).toHaveScreenshot({
 | 
			
		||||
    maxDiffPixels: 100,
 | 
			
		||||
  })
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 40 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 43 KiB  | 
		Reference in New Issue
	
	Block a user