6442 "Zoom to fit" when kcl file is shared on web (#6619)
* submit zoom_to_fit when kcl file is created on web * add test for zoom to fit on shared model on web - only works with a hack so far * resolve circular deps * fix Zoom to fit to shared model on web, test still not passing without timeout * Clean up zoom_to_fit for web sharing, stabilize test * fmt * small import refactor * fmt * Make Zoom to fit test web-only
This commit is contained in:
		@ -4,6 +4,7 @@ import * as fsp from 'fs/promises'
 | 
			
		||||
 | 
			
		||||
import { executorInputPath, getUtils } from '@e2e/playwright/test-utils'
 | 
			
		||||
import { expect, test } from '@e2e/playwright/zoo-test'
 | 
			
		||||
import { expectPixelColor } from '@e2e/playwright/fixtures/sceneFixture'
 | 
			
		||||
 | 
			
		||||
test.describe('Command bar tests', () => {
 | 
			
		||||
  test('Extrude from command bar selects extrude line after', async ({
 | 
			
		||||
@ -495,6 +496,42 @@ test.describe('Command bar tests', () => {
 | 
			
		||||
    })
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  test(`Zoom to fit to shared model on web`, async ({ page, scene }) => {
 | 
			
		||||
    if (process.env.PLATFORM !== 'web') {
 | 
			
		||||
      // This test is web-only
 | 
			
		||||
      return
 | 
			
		||||
    }
 | 
			
		||||
    await test.step(`Prepare and navigate to home page with query params`, async () => {
 | 
			
		||||
      // a quad in the top left corner of the XZ plane (which is out of the current view)
 | 
			
		||||
      const code = `sketch001 = startSketchOn(XZ)
 | 
			
		||||
profile001 = startProfile(sketch001, at = [-484.34, 484.95])
 | 
			
		||||
  |> yLine(length = -69.1)
 | 
			
		||||
  |> xLine(length = 66.84)
 | 
			
		||||
  |> yLine(length = 71.37)
 | 
			
		||||
  |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
 | 
			
		||||
  |> close()
 | 
			
		||||
`
 | 
			
		||||
      const targetURL = `?create-file&name=test&units=mm&code=${encodeURIComponent(btoa(code))}&ask-open-desktop`
 | 
			
		||||
      await page.goto(page.url() + targetURL)
 | 
			
		||||
      expect(page.url()).toContain(targetURL)
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    await test.step(`Submit the command`, async () => {
 | 
			
		||||
      await page.getByTestId('continue-to-web-app-button').click()
 | 
			
		||||
 | 
			
		||||
      await scene.connectionEstablished()
 | 
			
		||||
 | 
			
		||||
      // This makes SystemIOMachineActors.createKCLFile run after EngineStream/firstPlay
 | 
			
		||||
      await page.waitForTimeout(3000)
 | 
			
		||||
 | 
			
		||||
      await page.getByTestId('command-bar-submit').click()
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    await test.step(`Ensure we created the project and are in the modeling scene`, async () => {
 | 
			
		||||
      await expectPixelColor(page, [252, 252, 252], { x: 600, y: 260 }, 8)
 | 
			
		||||
    })
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  test(`Can add and edit a named parameter or constant`, async ({
 | 
			
		||||
    page,
 | 
			
		||||
    homePage,
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user