* Move all tests over to electron * Pass the correct param to playwright-electron.sh * Add shebang to script and add macos-14-large as a target * Get sketch-tests.spec.ts passing in electron * Try out 4 workers * Got testing-segment-overlays passing * Pass testing-selections.spec.ts * Go back to fix up sketch-tests test * Pass various.spec.ts, by far the hardest one * Pass can-sketch-on-all-planes... with ease * Pass command bar tests * fmt * Completely fix code mirror text navigating for tests * Pass debug pane tests * Pass desktop export tests * Pass editor tests * Pass file tree tests * Pass onboarding tests * Corrected a fixme in file-tree.spec! * Painfully fix hardcoded coordinates in point-click.spec * Pass machine.spec tests * Pass projects, fought hard with filechooser * Pass regresion-tests.spec tests * Pass network and connection tests * Pass camera-movement.spec tests * Extreme time eaten by gizmo test fixes. All passing now. * Merge main (tests changed x_x) and pass all constraints.spec tests (pain) * Pass another painful spec suite: testing-settings * Pass perspective-toggle, interesting note * Pass samples loading tests * Pass app header tests * Pass text-to-cad tests * Pass segment-overlays (minor ache) and ability to switch to web if needed :) * Fix a ton of syntax changes and deflake 2 more tests (pain) * Correct all tsc errors * Remove to-electron script * Add an f-ton of shit because playwright doesnt want S P R E A D * Try CI again * Stop snapshots of exports (already test in e2e) * Fix flake in double click editor * Hopefully help CI flake * Fixmes, fixmes everywhere * One more fixme to settings * Skip another code pane flake * Port jess's projects.spec tests * fixup * Reuse electron window; difficult task * Rebased and refixed * Remove duplicate cases * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * Reduce the workers to something CI can handle * Lower it further, we need to think about the others * Update package.json Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com> * Update package.json Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com> * Fix the last tests and tsc errors * Timeout to 120 and windows-2022-16core * Fix windows runner detection, enable concurrency temporarily * Hopefully this time fix windows runner detection * Comment out Vector, add back removed camera test code * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large) * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large) * Fix camera tests again * Massively deflake a whole class of tests * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large) * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large) * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * Try new CI and fix small onboarding test * Derp * No github tuning * Try mac * Add back all the OS * Lord, hallow be thy name * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * One last try with window-16-cores * Trigger CI * Try AWS Windows runner * Passing on windows locally with a few skips * Skip more win tests, add back all three oses * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-16-cores) * Add two more fixmes * 2 more fixmes * skip segment overlays on win32 * Another fixme * Trigger CI * Trigger CI * Quick clean up * Move all tests over to electron * Pass the correct param to playwright-electron.sh * Add shebang to script and add macos-14-large as a target * Get sketch-tests.spec.ts passing in electron * Try out 4 workers * Got testing-segment-overlays passing * Pass testing-selections.spec.ts * Go back to fix up sketch-tests test * Pass various.spec.ts, by far the hardest one * Pass can-sketch-on-all-planes... with ease * Pass command bar tests * fmt * Completely fix code mirror text navigating for tests * Pass debug pane tests * Pass desktop export tests * Pass editor tests * Pass file tree tests * Pass onboarding tests * Corrected a fixme in file-tree.spec! * Painfully fix hardcoded coordinates in point-click.spec * Pass machine.spec tests * Pass projects, fought hard with filechooser * Pass regresion-tests.spec tests * Pass network and connection tests * Pass camera-movement.spec tests * Extreme time eaten by gizmo test fixes. All passing now. * Merge main (tests changed x_x) and pass all constraints.spec tests (pain) * Pass another painful spec suite: testing-settings * Pass perspective-toggle, interesting note * Pass samples loading tests * Pass app header tests * Pass text-to-cad tests * Pass segment-overlays (minor ache) and ability to switch to web if needed :) * Fix a ton of syntax changes and deflake 2 more tests (pain) * Correct all tsc errors * Remove to-electron script * Add an f-ton of shit because playwright doesnt want S P R E A D * Try CI again * Stop snapshots of exports (already test in e2e) * Fix flake in double click editor * Hopefully help CI flake * Fixmes, fixmes everywhere * One more fixme to settings * Skip another code pane flake * Port jess's projects.spec tests * fixup * Reuse electron window; difficult task * Rebased and refixed * Remove duplicate cases * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * Reduce the workers to something CI can handle * Lower it further, we need to think about the others * Update package.json Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com> * Update package.json Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com> * Fix the last tests and tsc errors * Timeout to 120 and windows-2022-16core * Fix windows runner detection, enable concurrency temporarily * Hopefully this time fix windows runner detection * Comment out Vector, add back removed camera test code * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large) * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large) * Fix camera tests again * Massively deflake a whole class of tests * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large) * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large) * Try new CI and fix small onboarding test * Derp * No github tuning * Try mac * Add back all the OS * Lord, hallow be thy name * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Try AWS Windows runner * Passing on windows locally with a few skips * Trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * fmt, tsc, lint * Enable two fixmes again * Fix lint, codespell, fmt * Fix lint * Don't run e2e on draft, add back concurrency, clean up * One last windows skip --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com> Co-authored-by: Pierre Jacquier <pierre@zoo.dev>
91 lines
3.4 KiB
TypeScript
91 lines
3.4 KiB
TypeScript
import { test, expect } from './zoo-test'
|
|
import { getUtils } from './test-utils'
|
|
|
|
test.describe('Test toggling perspective', () => {
|
|
test.fixme('via command palette and toggle', async ({ page, homePage }) => {
|
|
const u = await getUtils(page)
|
|
|
|
// Locators and constants
|
|
const screenWidth = 1200
|
|
const screenHeight = 500
|
|
const checkedScreenLocation = {
|
|
x: screenWidth * 0.71,
|
|
y: screenHeight * 0.2,
|
|
}
|
|
const backgroundColor: [number, number, number] = [29, 29, 29]
|
|
const xzPlaneColor: [number, number, number] = [82, 55, 96]
|
|
const locationToHaveColor = async (color: [number, number, number]) => {
|
|
return u.getGreatestPixDiff(checkedScreenLocation, color)
|
|
}
|
|
const commandPaletteButton = page.getByRole('button', { name: 'Commands' })
|
|
const commandOption = page.getByRole('option', {
|
|
name: 'camera projection',
|
|
})
|
|
const orthoOption = page.getByRole('option', { name: 'orthographic' })
|
|
const commandToast = page.getByText(
|
|
`Set camera projection to "orthographic"`
|
|
)
|
|
const projectionToggle = page.getByRole('switch', {
|
|
name: 'Camera projection: ',
|
|
})
|
|
|
|
await test.step('Setup', async () => {
|
|
await page.setBodyDimensions({ width: screenWidth, height: screenHeight })
|
|
await homePage.goToModelingScene()
|
|
await u.closeKclCodePanel()
|
|
await expect
|
|
.poll(async () => locationToHaveColor(backgroundColor), {
|
|
timeout: 5000,
|
|
message: 'This spot should have the background color',
|
|
})
|
|
.toBeLessThan(15)
|
|
await expect(projectionToggle).toHaveAttribute('aria-checked', 'true')
|
|
})
|
|
|
|
// Extremely wild note: flicking between ortho and persp actually changes
|
|
// the orientation of the axis/camera. How can you see this? Well toggle it,
|
|
// then refresh. You'll see it doesn't match what we left.
|
|
await test.step('Switch to ortho via command palette', async () => {
|
|
await commandPaletteButton.click()
|
|
await page.waitForTimeout(1000)
|
|
await commandOption.click()
|
|
await page.waitForTimeout(1000)
|
|
await orthoOption.click()
|
|
await expect(commandToast).toBeVisible()
|
|
await expect(commandToast).not.toBeVisible()
|
|
await expect
|
|
.poll(async () => locationToHaveColor(xzPlaneColor), {
|
|
timeout: 5000,
|
|
message: 'This spot should have the XZ plane color',
|
|
})
|
|
.toBeLessThan(15)
|
|
await expect(projectionToggle).toHaveAttribute('aria-checked', 'false')
|
|
})
|
|
|
|
await test.step(`Refresh the page and ensure the stream is loaded in ortho`, async () => {
|
|
await page.reload()
|
|
await page.waitForTimeout(1000)
|
|
await u.closeKclCodePanel()
|
|
await expect
|
|
.poll(async () => locationToHaveColor(xzPlaneColor), {
|
|
timeout: 5000,
|
|
message: 'This spot should have the XZ plane color',
|
|
})
|
|
.toBeLessThan(15)
|
|
await expect(commandToast).not.toBeVisible()
|
|
await expect(projectionToggle).toHaveAttribute('aria-checked', 'false')
|
|
})
|
|
|
|
await test.step(`Switch to perspective via toggle`, async () => {
|
|
await projectionToggle.click()
|
|
await expect(projectionToggle).toHaveAttribute('aria-checked', 'true')
|
|
await expect
|
|
.poll(async () => locationToHaveColor(backgroundColor), {
|
|
timeout: 5000,
|
|
message: 'This spot should have the background color',
|
|
})
|
|
.toBeLessThan(15)
|
|
})
|
|
})
|
|
})
|