Double click label on sketch to dimension (#4816)
* feat: double click segment label to dimension length, POC, need to clean up code! * fix: cleaning up the PR for review * fix: cleaning for the PR. Adding more comments and moving some logic * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * fix: mergining main, auto linter and tsc fixes. Need to make some more * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * fix: tsc errors are resolved * chore: added test for constraint * fix: fixing overlay bug since length labels can now be clicked. --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@ -1,6 +1,17 @@
|
||||
import { test, expect } from '@playwright/test'
|
||||
|
||||
import { getUtils, setup, tearDown, TEST_COLORS } from './test-utils'
|
||||
import {
|
||||
test as testFixture,
|
||||
expect as expectFixture,
|
||||
} from './fixtures/fixtureSetup'
|
||||
import { join } from 'path'
|
||||
import {
|
||||
getUtils,
|
||||
setup,
|
||||
tearDown,
|
||||
TEST_COLORS,
|
||||
executorInputPath,
|
||||
} from './test-utils'
|
||||
import * as fsp from 'fs/promises'
|
||||
import { XOR } from 'lib/utils'
|
||||
|
||||
test.beforeEach(async ({ context, page }, testInfo) => {
|
||||
@ -1028,3 +1039,58 @@ part002 = startSketchOn('XZ')
|
||||
await expect(page.getByTestId('segment-overlay')).toHaveCount(2)
|
||||
})
|
||||
})
|
||||
testFixture.describe('Electron constraint tests', () => {
|
||||
testFixture(
|
||||
'Able to double click label to set constraint',
|
||||
{ tag: '@electron' },
|
||||
async ({ tronApp, homePage, scene, editor, toolbar }) => {
|
||||
await tronApp.initialise({
|
||||
fixtures: { homePage, scene, editor, toolbar },
|
||||
folderSetupFn: async (dir) => {
|
||||
const bracketDir = join(dir, 'test-sample')
|
||||
await fsp.mkdir(bracketDir, { recursive: true })
|
||||
await fsp.copyFile(
|
||||
executorInputPath('angled_line.kcl'),
|
||||
join(bracketDir, 'main.kcl')
|
||||
)
|
||||
},
|
||||
})
|
||||
const [clickHandler] = scene.makeMouseHelpers(600, 300)
|
||||
|
||||
await test.step('setup test', async () => {
|
||||
await homePage.expectState({
|
||||
projectCards: [
|
||||
{
|
||||
title: 'test-sample',
|
||||
fileCount: 1,
|
||||
},
|
||||
],
|
||||
sortBy: 'last-modified-desc',
|
||||
})
|
||||
await homePage.openProject('test-sample')
|
||||
await scene.waitForExecutionDone()
|
||||
})
|
||||
|
||||
await test.step('Double click to constrain', async () => {
|
||||
await clickHandler()
|
||||
await tronApp.page.getByRole('button', { name: 'Edit Sketch' }).click()
|
||||
const child = tronApp.page
|
||||
.locator('.segment-length-label-text')
|
||||
.first()
|
||||
.locator('xpath=..')
|
||||
await child.dblclick()
|
||||
const cmdBarSubmitButton = tronApp.page.getByRole('button', {
|
||||
name: 'arrow right Continue',
|
||||
})
|
||||
await cmdBarSubmitButton.click()
|
||||
await expectFixture(tronApp.page.locator('.cm-content')).toContainText(
|
||||
'length001 = 15.3'
|
||||
)
|
||||
await expectFixture(tronApp.page.locator('.cm-content')).toContainText(
|
||||
'|> angledLine([9, length001], %)'
|
||||
)
|
||||
await tronApp.page.getByRole('button', { name: 'Exit Sketch' }).click()
|
||||
})
|
||||
}
|
||||
)
|
||||
})
|
||||
|
Reference in New Issue
Block a user