Pass camera-movement.spec tests
This commit is contained in:
@ -1,23 +1,14 @@
|
||||
import { test, expect } from '@playwright/test'
|
||||
import { test, expect } from './zoo-test'
|
||||
import { EngineCommand } from 'lang/std/artifactGraph'
|
||||
import { uuidv4 } from 'lib/utils'
|
||||
import { getUtils, setup, tearDown } from './test-utils'
|
||||
|
||||
test.beforeEach(async ({ context, page }, testInfo) => {
|
||||
await setup(context, page, testInfo)
|
||||
})
|
||||
|
||||
test.afterEach(async ({ page }, testInfo) => {
|
||||
await tearDown(page, testInfo)
|
||||
})
|
||||
import { getUtils, } from './test-utils'
|
||||
|
||||
test.describe('Testing Camera Movement', () => {
|
||||
test('Can move camera reliably', async ({ page, context }) => {
|
||||
test.skip(process.platform === 'darwin', 'Can move camera reliably')
|
||||
test('Can move camera reliably', async ({ page, context, homePage }) => {
|
||||
const u = await getUtils(page)
|
||||
await page.setViewportSize({ width: 1200, height: 500 })
|
||||
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||
|
||||
await u.waitForAuthSkipAppStart()
|
||||
await homePage.goToModelingScene()
|
||||
await u.openAndClearDebugPanel()
|
||||
await u.closeKclCodePanel()
|
||||
|
||||
@ -178,21 +169,17 @@ test.describe('Testing Camera Movement', () => {
|
||||
await bakeInRetries(async () => {
|
||||
await page.mouse.move(700, 400)
|
||||
await page.mouse.wheel(0, -100)
|
||||
}, [0, -85, -85])
|
||||
})
|
||||
}, [0, -85, -85]) })
|
||||
|
||||
test('Zoom should be consistent when exiting or entering sketches', async ({
|
||||
page,
|
||||
}) => {
|
||||
// start new sketch pan and zoom before exiting, when exiting the sketch should stay in the same place
|
||||
test('Zoom should be consistent when exiting or entering sketches', async ({ page, homePage }) => { // start new sketch pan and zoom before exiting, when exiting the sketch should stay in the same place
|
||||
// than zoom and pan outside of sketch mode and enter again and it should not change from where it is
|
||||
// than again for sketching
|
||||
|
||||
test.skip(process.platform !== 'darwin', 'Zoom should be consistent')
|
||||
const u = await getUtils(page)
|
||||
await page.setViewportSize({ width: 1200, height: 500 })
|
||||
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||
|
||||
await u.waitForAuthSkipAppStart()
|
||||
await homePage.goToModelingScene()
|
||||
await u.openDebugPanel()
|
||||
|
||||
await expect(
|
||||
@ -341,11 +328,9 @@ test.describe('Testing Camera Movement', () => {
|
||||
await page.mouse.move(855, y)
|
||||
await expect(page.getByTestId('hover-highlight').first()).toBeVisible({
|
||||
timeout: 10_000,
|
||||
})
|
||||
})
|
||||
}) })
|
||||
|
||||
test(`Zoom by scroll should not fire while orbiting`, async ({ page }) => {
|
||||
/**
|
||||
test(`Zoom by scroll should not fire while orbiting`, async ({ page, homePage }) => { /**
|
||||
* Currently we only allow zooming by scroll when no other camera movement is happening,
|
||||
* set within cameraMouseDragGuards in cameraControls.ts,
|
||||
* until the engine supports unifying multiple camera movements.
|
||||
@ -383,7 +368,7 @@ test.describe('Testing Camera Movement', () => {
|
||||
const expectedOrbitCamZPosition = 64.0
|
||||
|
||||
await test.step(`Test setup`, async () => {
|
||||
await u.waitForAuthSkipAppStart()
|
||||
await homePage.goToModelingScene()
|
||||
await u.closeKclCodePanel()
|
||||
// This test requires the mouse controls to be set to Solidworks
|
||||
await u.openDebugPanel()
|
||||
@ -469,6 +454,17 @@ test.describe('Testing Camera Movement', () => {
|
||||
})
|
||||
})
|
||||
|
||||
await test.step(`Verify orbit`, async () => {
|
||||
await expect
|
||||
.poll(getCameraZValue, {
|
||||
message: 'Camera should be at expected position after orbiting',
|
||||
})
|
||||
await callback()
|
||||
await page.mouse.move(orbitMouseEnd.x, orbitMouseEnd.y, {
|
||||
steps: 3,
|
||||
})
|
||||
})
|
||||
|
||||
await test.step(`Verify orbit`, async () => {
|
||||
await expect
|
||||
.poll(getCameraZValue, {
|
||||
@ -480,9 +476,10 @@ test.describe('Testing Camera Movement', () => {
|
||||
}
|
||||
})
|
||||
|
||||
test('Right-click opens context menu when not dragged', async ({ page }) => {
|
||||
test('Right-click opens context menu when not dragged', async ({ homePage, page }) => {
|
||||
const u = await getUtils(page)
|
||||
await u.waitForAuthSkipAppStart()
|
||||
await homePage.goToModelingScene()
|
||||
await u.waitForPageLoad()
|
||||
|
||||
await test.step(`The menu should not show if we drag the mouse`, async () => {
|
||||
await page.mouse.move(900, 200)
|
||||
|
Reference in New Issue
Block a user