* Revert "Revert multi-profile (#4812)"
This reverts commit efe8089b08
.
* fix poor 1000ms wait UX
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores)
* trigger CI
* Add Rust side artifacts for startSketchOn face or plane (#4834)
* Add Rust side artifacts for startSketchOn face or plane
* move ast digging
---------
Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch>
* lint
* lint
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-macos-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-16-cores)
* trigger CI
* chore: disabled file watcher which prevents faster file write (#4835)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* partial fixes
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Trigger CI
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Trigger CI
* Fix up all the tests
* Fix partial execution
* wip
* WIP
* wip
* rust changes to make three point confrom to same as others since we're not ready with name params yet
* most of the fix for 3 point circle
* get overlays working for circle three point
* fmt
* fix types
* cargo fmt
* add face codef ref for walls and caps
* fix sketch on face after updates to rust side artifact graph
* some things needed for multi-profile tests
* bad attempts at fixing rust
* more
* more
* fix rust
* more rust fixes
* overlay fix
* remove duplicate test
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* lint and typing
* maybe fix a unit test
* small thing
* fix circ dep
* fix unit test
* fix some tests
* fix sweep point-and-click test
* fix more tests and add a fix me
* fix more tests
* fix electron specific test
* tsc
* more test tweaks
* update docs
* commint snaps?
* is clippy happy now?
* clippy again
* test works now without me changing anything big-fixed-itself
* small bug
* make three point have cross hair to make it consistent with othe rtools
* fix up state diagram
* fmt
* add draft point for first click of three point circ
* 1 test for three point circle
* 2 test for three point circle
* clean up
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* remove bad doc comment
* remove test skip
* remove onboarding test changes
* Update src/lang/modifyAst.ts
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
* Update output from simulation tests
* Fix to use correct source ranges
This also reduces cloning.
* Change back to skipping face cap none and both
* Update output after changing back to skipping none and both
* Fix clippy warning
* fix profile start snap bug
* add path ids to cap
* fix going into edit sketch
* make other startSketchOn's work
* fix snapshot test
* explain function name
* Update src/lib/rectangleTool.ts
Co-authored-by: Frank Noirot <frank@zoo.dev>
* rename error
* remove file tree from diff
* Update src/clientSideScene/segments.ts
Co-authored-by: Frank Noirot <frank@zoo.dev>
* nit
* Prevent double write to KCL code on revolve
* Update output after adding cap-to-path graph edge
* Fix edit/select sketch-on-cap via feature tree
* clean up for face codeRef
* fix changing tools part way through circle/rect tools
* fix delete of circle profile
* fix close profiles
* fix closing profile bug (tangentArcTo being ignored)
* remove stale comment
* Delete paths associated with sketch when the sketch plane is deleted
* Add support for deleting sketches on caps (not walls)
* get delet working for walls
* make delet of extrusions work for multi profile
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Delete the sketch statement too on the cap and wall cases
* Don't write to file in `split-sketch-pipe-if-needed` unless necessary
* Don't wait for file write to complete within `updateEditorWithAstAndWriteToFile`
It is already debounced internally. If we await it, we will have to wait for a debounced timeout
* docs
* fix circ dep
* tsc
* fix selection enter sketch weirdness
* test fixes
* comment out and fixme for delete related tests
* add skip wins
* try and get last test to pass
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
Co-authored-by: Kevin Nadro <nadr0@users.noreply.github.com>
Co-authored-by: Pierre Jacquier <pierre@zoo.dev>
Co-authored-by: 49lf <ircsurfer33@gmail.com>
Co-authored-by: Frank Noirot <frank@zoo.dev>
Co-authored-by: Frank Noirot <frankjohnson1993@gmail.com>
170 lines
5.3 KiB
TypeScript
170 lines
5.3 KiB
TypeScript
import { test, expect, Page } from './zoo-test'
|
|
import {
|
|
getUtils,
|
|
TEST_COLORS,
|
|
commonPoints,
|
|
PERSIST_MODELING_CONTEXT,
|
|
} from './test-utils'
|
|
import { HomePageFixture } from './fixtures/homePageFixture'
|
|
|
|
test.setTimeout(120000)
|
|
|
|
async function doBasicSketch(
|
|
page: Page,
|
|
homePage: HomePageFixture,
|
|
openPanes: string[]
|
|
) {
|
|
const u = await getUtils(page)
|
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
|
const PUR = 400 / 37.5 //pixeltoUnitRatio
|
|
|
|
await homePage.goToModelingScene()
|
|
await u.waitForPageLoad()
|
|
await page.waitForTimeout(1000)
|
|
await u.openDebugPanel()
|
|
|
|
// If we have the code pane open, we should see the code.
|
|
if (openPanes.includes('code')) {
|
|
await expect(u.codeLocator).toHaveText(``)
|
|
} else {
|
|
// Ensure we don't see the code.
|
|
await expect(u.codeLocator).not.toBeVisible()
|
|
}
|
|
|
|
await expect(
|
|
page.getByRole('button', { name: 'Start Sketch' })
|
|
).not.toBeDisabled()
|
|
await expect(page.getByRole('button', { name: 'Start Sketch' })).toBeVisible()
|
|
|
|
// click on "Start Sketch" button
|
|
await u.clearCommandLogs()
|
|
await page.getByRole('button', { name: 'Start Sketch' }).click()
|
|
await page.waitForTimeout(100)
|
|
|
|
// select a plane
|
|
await page.mouse.click(700, 200)
|
|
|
|
if (openPanes.includes('code')) {
|
|
await expect(u.codeLocator).toHaveText(`sketch001 = startSketchOn('XZ')`)
|
|
}
|
|
await u.closeDebugPanel()
|
|
|
|
await page.waitForTimeout(1000) // TODO detect animation ending, or disable animation
|
|
|
|
const startXPx = 600
|
|
await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10)
|
|
if (openPanes.includes('code')) {
|
|
await expect(u.codeLocator).toContainText(
|
|
`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${commonPoints.startAt}, sketch001)`
|
|
)
|
|
}
|
|
await page.waitForTimeout(500)
|
|
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 10)
|
|
await page.waitForTimeout(500)
|
|
|
|
if (openPanes.includes('code')) {
|
|
await expect(u.codeLocator)
|
|
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${commonPoints.startAt}, sketch001)
|
|
|> xLine(${commonPoints.num1}, %)`)
|
|
}
|
|
await page.waitForTimeout(500)
|
|
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 20)
|
|
if (openPanes.includes('code')) {
|
|
await expect(u.codeLocator)
|
|
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${
|
|
commonPoints.startAt
|
|
}, sketch001)
|
|
|> xLine(${commonPoints.num1}, %)
|
|
|> yLine(${commonPoints.num1 + 0.01}, %)`)
|
|
} else {
|
|
await page.waitForTimeout(500)
|
|
}
|
|
await page.waitForTimeout(200)
|
|
await page.mouse.click(startXPx, 500 - PUR * 20)
|
|
if (openPanes.includes('code')) {
|
|
await expect(u.codeLocator)
|
|
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${
|
|
commonPoints.startAt
|
|
}, sketch001)
|
|
|> xLine(${commonPoints.num1}, %)
|
|
|> yLine(${commonPoints.num1 + 0.01}, %)
|
|
|> xLine(${commonPoints.num2 * -1}, %)`)
|
|
}
|
|
|
|
// deselect line tool
|
|
const btnLine = page.getByTestId('line')
|
|
const btnLineAriaPressed = await btnLine.getAttribute('aria-pressed')
|
|
if (btnLineAriaPressed === 'true') {
|
|
await btnLine.click()
|
|
}
|
|
|
|
await page.waitForTimeout(100)
|
|
|
|
const line1 = await u.getSegmentBodyCoords(`[data-overlay-index="${0}"]`, 0)
|
|
if (openPanes.includes('code')) {
|
|
await expect
|
|
.poll(async () => u.getGreatestPixDiff(line1, TEST_COLORS.WHITE))
|
|
.toBeLessThan(3)
|
|
await page.waitForTimeout(100)
|
|
await expect
|
|
.poll(async () => u.getGreatestPixDiff(line1, [249, 249, 249]))
|
|
.toBeLessThan(3)
|
|
await page.waitForTimeout(100)
|
|
}
|
|
|
|
// click between first two clicks to get center of the line
|
|
await page.mouse.click(startXPx + PUR * 15, 500 - PUR * 10)
|
|
await page.waitForTimeout(100)
|
|
|
|
if (openPanes.includes('code')) {
|
|
await expect(
|
|
await u.getGreatestPixDiff(line1, TEST_COLORS.BLUE)
|
|
).toBeLessThan(3)
|
|
await expect(await u.getGreatestPixDiff(line1, [0, 0, 255])).toBeLessThan(3)
|
|
}
|
|
|
|
// hold down shift
|
|
await page.keyboard.down('Shift')
|
|
await page.waitForTimeout(100)
|
|
|
|
// click between the latest two clicks to get center of the line
|
|
await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 20)
|
|
await page.waitForTimeout(100)
|
|
|
|
// selected two lines therefore there should be two cursors
|
|
if (openPanes.includes('code')) {
|
|
await expect(page.locator('.cm-cursor')).toHaveCount(2)
|
|
await page.waitForTimeout(100)
|
|
}
|
|
|
|
await page.getByRole('button', { name: 'Length: open menu' }).click()
|
|
await page.getByRole('button', { name: 'Equal Length' }).click()
|
|
|
|
// Open the code pane.
|
|
await u.openKclCodePanel()
|
|
await expect(u.codeLocator)
|
|
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${
|
|
commonPoints.startAt
|
|
}, sketch001)
|
|
|> xLine(${commonPoints.num1}, %, $seg01)
|
|
|> yLine(${commonPoints.num1 + 0.01}, %)
|
|
|> xLine(-segLen(seg01), %)`)
|
|
}
|
|
|
|
test.describe('Basic sketch', { tag: ['@skipWin'] }, () => {
|
|
test.fixme('code pane open at start', async ({ page, homePage }) => {
|
|
await doBasicSketch(page, homePage, ['code'])
|
|
})
|
|
|
|
test('code pane closed at start', async ({ page, homePage }) => {
|
|
// Load the app with the code panes
|
|
await page.addInitScript(async (persistModelingContext) => {
|
|
localStorage.setItem(
|
|
persistModelingContext,
|
|
JSON.stringify({ openPanes: [] })
|
|
)
|
|
}, PERSIST_MODELING_CONTEXT)
|
|
await doBasicSketch(page, homePage, [])
|
|
})
|
|
})
|