Pass can-sketch-on-all-planes... with ease

This commit is contained in:
49lf
2024-11-22 14:45:08 -05:00
parent 24011dd100
commit fd39fcdb25
2 changed files with 28 additions and 34 deletions

View File

@ -139,9 +139,9 @@ async function doBasicSketch(page: Page, homePage: HomePageFixture, openPanes: s
} }
test.describe('Basic sketch', () => { test.describe('Basic sketch', () => {
test('code pane open at start', { tag: ['@skipWin'] }, async ({ page, homePage }) => { // Skip on windows it is being weird. test('code pane open at start', async ({ page, homePage }) => { // Skip on windows it is being weird.
test.skip(process.platform === 'win32', 'Skip on windows') await doBasicSketch(page, homePage, ['code'])
await doBasicSketch(page, homePage, ['code']) }) })
test('code pane closed at start', async ({ page, homePage }) => { // Load the app with the code panes test('code pane closed at start', async ({ page, homePage }) => { // Load the app with the code panes
await page.addInitScript(async (persistModelingContext) => { await page.addInitScript(async (persistModelingContext) => {

View File

@ -1,27 +1,21 @@
import { test, expect } from '@playwright/test' import { test, expect, Page } from './zoo-test'
import { getUtils, setup, tearDown } from './test-utils' import { HomePageFixture } from './fixtures/HomePageFixture'
import { getUtils } from './test-utils'
import { EngineCommand } from 'lang/std/artifactGraph' import { EngineCommand } from 'lang/std/artifactGraph'
import { uuidv4 } from 'lib/utils' import { uuidv4 } from 'lib/utils'
test.beforeEach(async ({ context, page }, testInfo) => {
await setup(context, page, testInfo)
})
test.afterEach(async ({ page }, testInfo) => {
await tearDown(page, testInfo)
})
test.describe('Can create sketches on all planes and their back sides', () => { test.describe('Can create sketches on all planes and their back sides', () => {
const sketchOnPlaneAndBackSideTest = async ( const sketchOnPlaneAndBackSideTest = async (
page: any, page: Page,
homePage: HomePageFixture,
plane: string, plane: string,
clickCoords: { x: number; y: number } clickCoords: { x: number; y: number }
) => { ) => {
const u = await getUtils(page) const u = await getUtils(page)
const PUR = 400 / 37.5 //pixeltoUnitRatio const PUR = 400 / 37.5 //pixeltoUnitRatio
await page.setViewportSize({ width: 1200, height: 500 }) await page.setBodyDimensions({ width: 1200, height: 500 })
await u.waitForAuthSkipAppStart() await homePage.goToModelingScene()
await u.openDebugPanel() await u.openDebugPanel()
const coord = const coord =
@ -83,32 +77,32 @@ test.describe('Can create sketches on all planes and their back sides', () => {
await u.clearCommandLogs() await u.clearCommandLogs()
await u.removeCurrentCode() await u.removeCurrentCode()
} }
test('XY', async ({ page }) => { test('XY', async ({ page, homePage }) => {
await sketchOnPlaneAndBackSideTest( await sketchOnPlaneAndBackSideTest(
page, page,
homePage,
'XY', 'XY',
{ x: 600, y: 388 } // red plane { x: 600, y: 388 } // red plane
// { x: 600, y: 400 }, // red plane // clicks grid helper and that causes problems, should fix so that these coords work too. // { x: 600, y: 400 }, // red plane // clicks grid helper and that causes problems, should fix so that these coords work too.
) ) })
test('YZ', async ({ page, homePage }) => {
await sketchOnPlaneAndBackSideTest(page, homePage, 'YZ', { x: 700, y: 250 }) // green plane
}) })
test('YZ', async ({ page }) => { test('XZ', async ({ page, homePage }) => {
await sketchOnPlaneAndBackSideTest(page, 'YZ', { x: 700, y: 250 }) // green plane await sketchOnPlaneAndBackSideTest(page, homePage, '-XZ', { x: 700, y: 80 }) // blue plane
}) })
test('XZ', async ({ page }) => { test('-XY', async ({ page, homePage }) => {
await sketchOnPlaneAndBackSideTest(page, '-XZ', { x: 700, y: 80 }) // blue plane await sketchOnPlaneAndBackSideTest(page, homePage, '-XY', { x: 600, y: 118 }) // back of red plane
}) })
test('-XY', async ({ page }) => { test('-YZ', async ({ page, homePage }) => {
await sketchOnPlaneAndBackSideTest(page, '-XY', { x: 600, y: 118 }) // back of red plane await sketchOnPlaneAndBackSideTest(page, homePage, '-YZ', { x: 700, y: 219 }) // back of green plan
}) })
test('-YZ', async ({ page }) => { test('-XZ', async ({ page, homePage }) => {
await sketchOnPlaneAndBackSideTest(page, '-YZ', { x: 700, y: 219 }) // back of green plane await sketchOnPlaneAndBackSideTest(page, homePage, 'XZ', { x: 700, y: 427 }) // back of blue plane
})
test('-XZ', async ({ page }) => {
await sketchOnPlaneAndBackSideTest(page, 'XZ', { x: 700, y: 427 }) // back of blue plane
}) })
}) })