Fix more tests

This commit is contained in:
lee-at-zoo-corp
2025-03-31 16:31:53 -04:00
parent ed1e2aedfd
commit 4c564bf332
6 changed files with 25 additions and 32 deletions

View File

@ -46,8 +46,6 @@ test.describe('Point and click for boolean workflows', () => {
localStorage.setItem('persistCode', file) localStorage.setItem('persistCode', file)
}, file) }, file)
await homePage.goToModelingScene() await homePage.goToModelingScene()
await scene.waitForExecutionDone()
await scene.settled(cmdBar) await scene.settled(cmdBar)
// Test coordinates for selection - these might need adjustment based on actual scene layout // Test coordinates for selection - these might need adjustment based on actual scene layout

View File

@ -78,12 +78,12 @@ sketch001 = startSketchOn(XY)
// Ensure we execute the first time. // Ensure we execute the first time.
await u.openDebugPanel() await u.openDebugPanel()
await expect( await expect.poll(() =>
page.locator('[data-receive-command-type="scene_clear_all"]') page.locator('[data-receive-command-type="scene_clear_all"]').count()
).toHaveCount(1) ).toBe(2)
await expect( await expect.poll(() =>
page.locator('[data-message-type="execution-done"]') page.locator('[data-message-type="execution-done"]').count()
).toHaveCount(1) ).toBe(2)
// Add whitespace to the end of the code. // Add whitespace to the end of the code.
await u.codeLocator.click() await u.codeLocator.click()
@ -131,7 +131,7 @@ sketch001 = startSketchOn(XY)
await u.openDebugPanel() await u.openDebugPanel()
await expect( await expect(
page.locator('[data-receive-command-type="scene_clear_all"]') page.locator('[data-receive-command-type="scene_clear_all"]')
).toHaveCount(1) ).toHaveCount(2)
await expect( await expect(
page.locator('[data-message-type="execution-done"]') page.locator('[data-message-type="execution-done"]')
).toHaveCount(2) ).toHaveCount(2)
@ -159,7 +159,7 @@ sketch001 = startSketchOn(XY)
).toHaveCount(3) ).toHaveCount(3)
await expect( await expect(
page.locator('[data-receive-command-type="scene_clear_all"]') page.locator('[data-receive-command-type="scene_clear_all"]')
).toHaveCount(1) ).toHaveCount(2)
}) })
test('if you click the format button it formats your code', async ({ test('if you click the format button it formats your code', async ({

View File

@ -90,7 +90,7 @@ test.describe('Feature Tree pane', () => {
await scene.settled(cmdBar) await scene.settled(cmdBar)
await toolbar.openFeatureTreePane() await toolbar.openFeatureTreePane()
await expect(page.getByText('Feature tree')).toBeVisible() await expect.poll(() => page.getByText('Feature tree').count()).toBeGreaterThan(1)
}) })
async function testViewSource({ async function testViewSource({

View File

@ -1525,7 +1525,7 @@ extrude001 = extrude(sketch001, length = 200)`)
test( test(
'Opening a project should successfully load the stream, (regression test that this also works when switching between projects)', 'Opening a project should successfully load the stream, (regression test that this also works when switching between projects)',
{ tag: '@electron' }, { tag: '@electron' },
async ({ context, page, cmdBar, homePage }, testInfo) => { async ({ context, page, cmdBar, homePage, scene }, testInfo) => {
await context.folderSetupFn(async (dir) => { await context.folderSetupFn(async (dir) => {
await fsp.mkdir(path.join(dir, 'router-template-slate'), { await fsp.mkdir(path.join(dir, 'router-template-slate'), {
recursive: true, recursive: true,
@ -1594,15 +1594,7 @@ test(
stage: 'commandBarClosed', stage: 'commandBarClosed',
}) })
await u.waitForPageLoad() await scene.settled(cmdBar)
// gray at this pixel means the stream has loaded in the most
// user way we can verify it (pixel color)
await expect
.poll(() => u.getGreatestPixDiff(pointOnModel, [85, 85, 85]), {
timeout: 10_000,
})
.toBeLessThan(15)
}) })
await test.step('Clicking the logo takes us back to the projects page / home', async () => { await test.step('Clicking the logo takes us back to the projects page / home', async () => {
@ -1619,15 +1611,7 @@ test(
await page.getByText('router-template-slate').click() await page.getByText('router-template-slate').click()
await u.waitForPageLoad() await scene.settled(cmdBar)
// gray at this pixel means the stream has loaded in the most
// user way we can verify it (pixel color)
await expect
.poll(() => u.getGreatestPixDiff(pointOnModel, [143, 143, 143]), {
timeout: 10_000,
})
.toBeLessThan(15)
}) })
await test.step('The projects on the home page should still be normal', async () => { await test.step('The projects on the home page should still be normal', async () => {

View File

@ -1617,7 +1617,7 @@ profile002 = startProfileAt([117.2, 56.08], sketch001)
test( test(
`snapToProfile start only works for current profile`, `snapToProfile start only works for current profile`,
{ tag: ['@skipWin'] }, { tag: ['@skipWin'] },
async ({ context, page, scene, toolbar, editor, homePage }) => { async ({ context, page, scene, toolbar, editor, homePage, cmdBar }) => {
// We seed the scene with a single offset plane // We seed the scene with a single offset plane
await context.addInitScript(() => { await context.addInitScript(() => {
localStorage.setItem( localStorage.setItem(
@ -1633,6 +1633,8 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
}) })
await homePage.goToModelingScene() await homePage.goToModelingScene()
await scene.settled(cmdBar)
await expect( await expect(
page.getByRole('button', { name: 'Start Sketch' }) page.getByRole('button', { name: 'Start Sketch' })
).not.toBeDisabled() ).not.toBeDisabled()
@ -1654,9 +1656,13 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
const codeFromTangentialArc = ` |> tangentialArcTo([39.49, 88.22], %)` const codeFromTangentialArc = ` |> tangentialArcTo([39.49, 88.22], %)`
await test.step('check that tangential tool does not snap to other profile starts', async () => { await test.step('check that tangential tool does not snap to other profile starts', async () => {
await toolbar.tangentialArcBtn.click() await toolbar.tangentialArcBtn.click()
await page.waitForTimeout(1000)
await endOfLowerSegMove() await endOfLowerSegMove()
await page.waitForTimeout(1000)
await endOfLowerSegClick() await endOfLowerSegClick()
await page.waitForTimeout(1000)
await profileStartOfHigherSegClick() await profileStartOfHigherSegClick()
await page.waitForTimeout(1000)
await editor.expectEditor.toContain(codeFromTangentialArc) await editor.expectEditor.toContain(codeFromTangentialArc)
await editor.expectEditor.not.toContain( await editor.expectEditor.not.toContain(
`[profileStartX(%), profileStartY(%)]` `[profileStartX(%), profileStartY(%)]`
@ -2245,8 +2251,9 @@ profile004 = circleThreePoint(sketch001, p1 = [13.44, -6.8], p2 = [13.39, -2.07]
await test.step('enter sketch and setup', async () => { await test.step('enter sketch and setup', async () => {
await moveToClearToolBarPopover() await moveToClearToolBarPopover()
await page.waitForTimeout(1000)
await pointOnSegment({ shouldDbClick: true }) await pointOnSegment({ shouldDbClick: true })
await page.waitForTimeout(600) await page.waitForTimeout(2000)
await toolbar.lineBtn.click() await toolbar.lineBtn.click()
await page.waitForTimeout(100) await page.waitForTimeout(100)

View File

@ -866,6 +866,8 @@ test.describe('Testing settings', () => {
page, page,
homePage, homePage,
tronApp, tronApp,
scene,
cmdBar
}) => { }) => {
if (!tronApp) { if (!tronApp) {
fail() fail()
@ -887,6 +889,8 @@ test.describe('Testing settings', () => {
}) })
await page.setBodyDimensions({ width: 1200, height: 500 }) await page.setBodyDimensions({ width: 1200, height: 500 })
await homePage.goToModelingScene() await homePage.goToModelingScene()
await scene.connectionEstablished()
await scene.settled(cmdBar)
// Constants and locators // Constants and locators
const resizeHandle = page.locator('.sidebar-resize-handles > div.block') const resizeHandle = page.locator('.sidebar-resize-handles > div.block')