Got testing-segment-overlays passing

This commit is contained in:
49lf
2024-11-20 13:06:46 -05:00
parent 5f3402990e
commit 1e5f89bf65

View File

@ -1,17 +1,9 @@
import { test, expect, Page } from '@playwright/test'
import { test, expect, Page } from './zoo-test'
import { deg, getUtils, setup, tearDown, wiggleMove } from './test-utils'
import { deg, getUtils, wiggleMove } from './test-utils'
import { LineInputsType } from 'lang/std/sketchcombos'
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('Testing segment overlays', () => {
test.describe('Hover over a segment should show its overlay, hovering over the input overlays should show its popover, clicking the input overlay should constrain/unconstrain it:\nfor the following segments', () => {
/**
@ -190,29 +182,27 @@ test.describe('Testing segment overlays', () => {
await expect(page.locator('.cm-content')).toContainText(expectFinal)
}
test.setTimeout(120000)
test('for segments [line, angledLine, lineTo, xLineTo]', async ({
page,
}) => {
await page.addInitScript(async () => {
test('for segments [line, angledLine, lineTo, xLineTo]', async ({ page, homePage }) => { await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`part001 = startSketchOn('XZ')
|> startProfileAt([5 + 0, 20 + 0], %)
|> line([0.5, -14 + 0], %)
|> angledLine({ angle = 3 + 0, length = 32 + 0 }, %)
|> angledLine({ angle: 3 + 0, length: 32 + 0 }, %)
|> lineTo([5 + 33, 20 + 11.5 + 0], %)
|> xLineTo(5 + 9 - 5, %)
|> yLineTo(20 + -10.77, %, $a)
|> xLine(26.04, %)
|> yLine(21.14 + 0, %)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|> angledLineToX({ angle = 3 + 0, to = 5 + 26 }, %)
|> angledLineToY({ angle = 89, to = 20 + 9.14 + 0 }, %)
|> angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %)
|> angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)
|> angledLineToX({ angle: 3 + 0, to: 5 + 26 }, %)
|> angledLineToY({ angle: 89, to: 20 + 9.14 + 0 }, %)
|> angledLineThatIntersects({
angle = 4.14,
intersectTag = a,
offset = 9
angle: 4.14,
intersectTag: a,
offset: 9
}, %)
|> tangentialArcTo([5 + 3.14 + 13, 20 + 3.14], %)
`
@ -221,7 +211,7 @@ test.describe('Testing segment overlays', () => {
const u = await getUtils(page)
await page.setViewportSize({ width: 1200, height: 500 })
await u.waitForAuthSkipAppStart()
await homePage.goToModelingScene()
// wait for execution done
await u.openDebugPanel()
@ -292,10 +282,9 @@ test.describe('Testing segment overlays', () => {
hoverPos: { x: angledLine.x, y: angledLine.y },
constraintType: 'angle',
expectBeforeUnconstrained:
'angledLine({ angle = 3 + 0, length = 32 + 0 }, %)',
expectAfterUnconstrained:
'angledLine({ angle = 3, length = 32 + 0 }, %)',
expectFinal: 'angledLine({ angle = angle001, length = 32 + 0 }, %)',
'angledLine({ angle: 3 + 0, length: 32 + 0 }, %)',
expectAfterUnconstrained: 'angledLine({ angle: 3, length: 32 + 0 }, %)',
expectFinal: 'angledLine({ angle: angle001, length: 32 + 0 }, %)',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="1"]',
})
@ -304,10 +293,10 @@ test.describe('Testing segment overlays', () => {
hoverPos: { x: angledLine.x, y: angledLine.y },
constraintType: 'length',
expectBeforeUnconstrained:
'angledLine({ angle = angle001, length = 32 + 0 }, %)',
'angledLine({ angle: angle001, length: 32 + 0 }, %)',
expectAfterUnconstrained:
'angledLine({ angle = angle001, length = 32 }, %)',
expectFinal: 'angledLine({ angle = angle001, length = len001 }, %)',
'angledLine({ angle: angle001, length: 32 }, %)',
expectFinal: 'angledLine({ angle: angle001, length: len001 }, %)',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="1"]',
})
@ -352,10 +341,8 @@ test.describe('Testing segment overlays', () => {
ang: ang + 180,
steps: 8,
locator: '[data-overlay-toolbar-index="3"]',
})
})
test('for segments [yLineTo, xLine]', async ({ page }) => {
await page.addInitScript(async () => {
}) })
test('for segments [yLineTo, xLine]', async ({ page, homePage }) => { await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`yRel001 = -14
@ -368,20 +355,20 @@ xAbs002 = 4
part001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line([0.5, yRel001], %)
|> angledLine({ angle = angle001, length = len001 }, %)
|> angledLine({ angle: angle001, length: len001 }, %)
|> lineTo([33, yAbs001], %)
|> xLineTo(xAbs002, %)
|> yLineTo(-10.77, %, $a)
|> xLine(26.04, %)
|> yLine(21.14 + 0, %)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|> angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %)
`
)
})
const u = await getUtils(page)
await page.setViewportSize({ width: 1200, height: 500 })
await u.waitForAuthSkipAppStart()
await homePage.goToModelingScene()
// wait for execution done
await u.openDebugPanel()
@ -427,31 +414,27 @@ part001 = startSketchOn('XZ')
steps: 10,
ang: ang + 180,
locator: '[data-overlay-toolbar-index="5"]',
})
})
test('for segments [yLine, angledLineOfXLength, angledLineOfYLength]', async ({
page,
}) => {
await page.addInitScript(async () => {
}) })
test('for segments [yLine, angledLineOfXLength, angledLineOfYLength]', async ({ page, homePage }) => { await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`part001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line([0.5, -14 + 0], %)
|> angledLine({ angle = 3 + 0, length = 32 + 0 }, %)
|> angledLine({ angle: 3 + 0, length: 32 + 0 }, %)
|> lineTo([33, 11.5 + 0], %)
|> xLineTo(9 - 5, %)
|> yLineTo(-10.77, %, $a)
|> xLine(26.04, %)
|> yLine(21.14 + 0, %)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|> angledLineToX({ angle = 3 + 0, to = 26 }, %)
|> angledLineToY({ angle = 89, to = 9.14 + 0 }, %)
|> angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %)
|> angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)
|> angledLineToX({ angle: 3 + 0, to: 26 }, %)
|> angledLineToY({ angle: 89, to: 9.14 + 0 }, %)
|> angledLineThatIntersects({
angle = 4.14,
intersectTag = a,
offset = 9
angle: 4.14,
intersectTag: a,
offset: 9
}, %)
|> tangentialArcTo([3.14 + 13, 3.14], %)
`
@ -461,7 +444,7 @@ part001 = startSketchOn('XZ')
const u = await getUtils(page)
await page.setViewportSize({ width: 1200, height: 500 })
await u.waitForAuthSkipAppStart()
await homePage.goToModelingScene()
// wait for execution done
await u.openDebugPanel()
@ -503,11 +486,11 @@ part001 = startSketchOn('XZ')
hoverPos: { x: angledLineOfXLength.x, y: angledLineOfXLength.y },
constraintType: 'angle',
expectBeforeUnconstrained:
'angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)',
'angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %)',
expectAfterUnconstrained:
'angledLineOfXLength({ angle = -179, length = 23.14 }, %)',
'angledLineOfXLength({ angle: -179, length: 23.14 }, %)',
expectFinal:
'angledLineOfXLength({ angle = angle001, length = 23.14 }, %)',
'angledLineOfXLength({ angle: angle001, length: 23.14 }, %)',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="7"]',
})
@ -516,11 +499,11 @@ part001 = startSketchOn('XZ')
hoverPos: { x: angledLineOfXLength.x, y: angledLineOfXLength.y },
constraintType: 'xRelative',
expectBeforeUnconstrained:
'angledLineOfXLength({ angle = angle001, length = 23.14 }, %)',
'angledLineOfXLength({ angle: angle001, length: 23.14 }, %)',
expectAfterUnconstrained:
'angledLineOfXLength({ angle = angle001, length = xRel001 }, %)',
'angledLineOfXLength({ angle: angle001, length: xRel001 }, %)',
expectFinal:
'angledLineOfXLength({ angle = angle001, length = 23.14 }, %)',
'angledLineOfXLength({ angle: angle001, length: 23.14 }, %)',
steps: 7,
ang: ang + 180,
locator: '[data-overlay-toolbar-index="7"]',
@ -535,10 +518,10 @@ part001 = startSketchOn('XZ')
hoverPos: { x: angledLineOfYLength.x, y: angledLineOfYLength.y },
constraintType: 'angle',
expectBeforeUnconstrained:
'angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)',
'angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)',
expectAfterUnconstrained:
'angledLineOfYLength({ angle = angle002, length = 19 + 0 }, %)',
expectFinal: 'angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)',
'angledLineOfYLength({ angle: angle002, length: 19 + 0 }, %)',
expectFinal: 'angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)',
ang: ang + 180,
steps: 6,
locator: '[data-overlay-toolbar-index="8"]',
@ -548,49 +531,45 @@ part001 = startSketchOn('XZ')
hoverPos: { x: angledLineOfYLength.x, y: angledLineOfYLength.y },
constraintType: 'yRelative',
expectBeforeUnconstrained:
'angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)',
'angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)',
expectAfterUnconstrained:
'angledLineOfYLength({ angle = -91, length = 19 }, %)',
expectFinal:
'angledLineOfYLength({ angle = -91, length = yRel002 }, %)',
'angledLineOfYLength({ angle: -91, length: 19 }, %)',
expectFinal: 'angledLineOfYLength({ angle: -91, length: yRel002 }, %)',
ang: ang + 180,
steps: 7,
locator: '[data-overlay-toolbar-index="8"]',
})
})
test('for segments [angledLineToX, angledLineToY, angledLineThatIntersects]', async ({
page,
}) => {
await page.addInitScript(async () => {
}) })
test('for segments [angledLineToX, angledLineToY, angledLineThatIntersects]', async ({ page, homePage }) => { await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`part001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line([0.5, -14 + 0], %)
|> angledLine({ angle = 3 + 0, length = 32 + 0 }, %)
|> angledLine({ angle: 3 + 0, length: 32 + 0 }, %)
|> lineTo([33, 11.5 + 0], %)
|> xLineTo(9 - 5, %)
|> yLineTo(-10.77, %, $a)
|> xLine(26.04, %)
|> yLine(21.14 + 0, %)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|> angledLineToX({ angle = 3 + 0, to = 26 }, %)
|> angledLineToY({ angle = 89, to = 9.14 + 0 }, %)
|> angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %)
|> angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)
|> angledLineToX({ angle: 3 + 0, to: 26 }, %)
|> angledLineToY({ angle: 89, to: 9.14 + 0 }, %)
|> angledLineThatIntersects({
angle = 4.14,
intersectTag = a,
offset = 9
angle: 4.14,
intersectTag: a,
offset: 9
}, %)
|> tangentialArcTo([3.14 + 13, 1.14], %)
`
)
localStorage.setItem('disableAxis', 'true')
})
const u = await getUtils(page)
await page.setViewportSize({ width: 1200, height: 500 })
await u.waitForAuthSkipAppStart()
await homePage.goToModelingScene()
// wait for execution done
await u.openDebugPanel()
@ -615,10 +594,9 @@ part001 = startSketchOn('XZ')
await clickConstrained({
hoverPos: { x: angledLineToX.x, y: angledLineToX.y },
constraintType: 'angle',
expectBeforeUnconstrained:
'angledLineToX({ angle = 3 + 0, to = 26 }, %)',
expectAfterUnconstrained: 'angledLineToX({ angle = 3, to = 26 }, %)',
expectFinal: 'angledLineToX({ angle = angle001, to = 26 }, %)',
expectBeforeUnconstrained: 'angledLineToX({ angle: 3 + 0, to: 26 }, %)',
expectAfterUnconstrained: 'angledLineToX({ angle: 3, to: 26 }, %)',
expectFinal: 'angledLineToX({ angle: angle001, to: 26 }, %)',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="9"]',
})
@ -627,10 +605,10 @@ part001 = startSketchOn('XZ')
hoverPos: { x: angledLineToX.x, y: angledLineToX.y },
constraintType: 'xAbsolute',
expectBeforeUnconstrained:
'angledLineToX({ angle = angle001, to = 26 }, %)',
'angledLineToX({ angle: angle001, to: 26 }, %)',
expectAfterUnconstrained:
'angledLineToX({ angle = angle001, to = xAbs001 }, %)',
expectFinal: 'angledLineToX({ angle = angle001, to = 26 }, %)',
'angledLineToX({ angle: angle001, to: xAbs001 }, %)',
expectFinal: 'angledLineToX({ angle: angle001, to: 26 }, %)',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="9"]',
})
@ -642,10 +620,10 @@ part001 = startSketchOn('XZ')
hoverPos: { x: angledLineToY.x, y: angledLineToY.y },
constraintType: 'angle',
expectBeforeUnconstrained:
'angledLineToY({ angle = 89, to = 9.14 + 0 }, %)',
'angledLineToY({ angle: 89, to: 9.14 + 0 }, %)',
expectAfterUnconstrained:
'angledLineToY({ angle = angle002, to = 9.14 + 0 }, %)',
expectFinal: 'angledLineToY({ angle = 89, to = 9.14 + 0 }, %)',
'angledLineToY({ angle: angle002, to: 9.14 + 0 }, %)',
expectFinal: 'angledLineToY({ angle: 89, to: 9.14 + 0 }, %)',
steps: process.platform === 'darwin' ? 8 : 9,
ang: ang + 180,
locator: '[data-overlay-toolbar-index="10"]',
@ -655,9 +633,9 @@ part001 = startSketchOn('XZ')
hoverPos: { x: angledLineToY.x, y: angledLineToY.y },
constraintType: 'yAbsolute',
expectBeforeUnconstrained:
'angledLineToY({ angle = 89, to = 9.14 + 0 }, %)',
expectAfterUnconstrained: 'angledLineToY({ angle = 89, to = 9.14 }, %)',
expectFinal: 'angledLineToY({ angle = 89, to = yAbs001 }, %)',
'angledLineToY({ angle: 89, to: 9.14 + 0 }, %)',
expectAfterUnconstrained: 'angledLineToY({ angle: 89, to: 9.14 }, %)',
expectFinal: 'angledLineToY({ angle: 89, to: yAbs001 }, %)',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="10"]',
})
@ -674,19 +652,19 @@ part001 = startSketchOn('XZ')
},
constraintType: 'angle',
expectBeforeUnconstrained: `angledLineThatIntersects({
angle = 4.14,
intersectTag = a,
offset = 9
angle: 4.14,
intersectTag: a,
offset: 9
}, %)`,
expectAfterUnconstrained: `angledLineThatIntersects({
angle = angle003,
intersectTag = a,
offset = 9
angle: angle003,
intersectTag: a,
offset: 9
}, %)`,
expectFinal: `angledLineThatIntersects({
angle = -176,
offset = 9,
intersectTag = a
angle: -176,
offset: 9,
intersectTag: a
}, %)`,
ang: ang + 180,
locator: '[data-overlay-toolbar-index="11"]',
@ -699,45 +677,43 @@ part001 = startSketchOn('XZ')
},
constraintType: 'intersectionOffset',
expectBeforeUnconstrained: `angledLineThatIntersects({
angle = -176,
offset = 9,
intersectTag = a
angle: -176,
offset: 9,
intersectTag: a
}, %)`,
expectAfterUnconstrained: `angledLineThatIntersects({
angle = -176,
offset = perpDist001,
intersectTag = a
angle: -176,
offset: perpDist001,
intersectTag: a
}, %)`,
expectFinal: `angledLineThatIntersects({
angle = -176,
offset = 9,
intersectTag = a
angle: -176,
offset: 9,
intersectTag: a
}, %)`,
ang: ang + 180,
locator: '[data-overlay-toolbar-index="11"]',
})
})
test('for segment [tangentialArcTo]', async ({ page }) => {
await page.addInitScript(async () => {
}) })
test('for segment [tangentialArcTo]', async ({ page, homePage }) => { await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`part001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line([0.5, -14 + 0], %)
|> angledLine({ angle = 3 + 0, length = 32 + 0 }, %)
|> angledLine({ angle: 3 + 0, length: 32 + 0 }, %)
|> lineTo([33, 11.5 + 0], %)
|> xLineTo(9 - 5, %)
|> yLineTo(-10.77, %, $a)
|> xLine(26.04, %)
|> yLine(21.14 + 0, %)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|> angledLineToX({ angle = 3 + 0, to = 26 }, %)
|> angledLineToY({ angle = 89, to = 9.14 + 0 }, %)
|> angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %)
|> angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)
|> angledLineToX({ angle: 3 + 0, to: 26 }, %)
|> angledLineToY({ angle: 89, to: 9.14 + 0 }, %)
|> angledLineThatIntersects({
angle = 4.14,
intersectTag = a,
offset = 9
angle: 4.14,
intersectTag: a,
offset: 9
}, %)
|> tangentialArcTo([3.14 + 13, -3.14], %)
`
@ -747,7 +723,7 @@ part001 = startSketchOn('XZ')
const u = await getUtils(page)
await page.setViewportSize({ width: 1200, height: 500 })
await u.waitForAuthSkipAppStart()
await homePage.goToModelingScene()
// wait for execution done
await u.openDebugPanel()
@ -789,14 +765,12 @@ part001 = startSketchOn('XZ')
ang: ang + 180,
steps: 10,
locator: '[data-overlay-toolbar-index="12"]',
})
})
test('for segment [circle]', async ({ page }) => {
await page.addInitScript(async () => {
}) })
test('for segment [circle]', async ({ page, homePage }) => { await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`part001 = startSketchOn('XZ')
|> circle({ center = [1 + 0, 0], radius = 8 }, %)
|> circle({ center: [1 + 0, 0], radius: 8 }, %)
`
)
localStorage.setItem('disableAxis', 'true')
@ -804,7 +778,7 @@ part001 = startSketchOn('XZ')
const u = await getUtils(page)
await page.setViewportSize({ width: 1200, height: 500 })
await u.waitForAuthSkipAppStart()
await homePage.goToModelingScene()
// wait for execution done
await u.openDebugPanel()
@ -812,7 +786,7 @@ part001 = startSketchOn('XZ')
await u.closeDebugPanel()
await page
.getByText('circle({ center = [1 + 0, 0], radius = 8 }, %)')
.getByText('circle({ center: [1 + 0, 0], radius: 8 }, %)')
.click()
await page.waitForTimeout(100)
await page.getByRole('button', { name: 'Edit Sketch' }).click()
@ -831,9 +805,9 @@ part001 = startSketchOn('XZ')
hoverPos,
constraintType: 'xAbsolute',
expectBeforeUnconstrained:
'circle({ center = [1 + 0, 0], radius = 8 }, %)',
expectAfterUnconstrained: 'circle({ center = [1, 0], radius = 8 }, %)',
expectFinal: 'circle({ center = [xAbs001, 0], radius = 8 }, %)',
'circle({ center: [1 + 0, 0], radius: 8 }, %)',
expectAfterUnconstrained: 'circle({ center: [1, 0], radius: 8 }, %)',
expectFinal: 'circle({ center: [xAbs001, 0], radius: 8 }, %)',
ang: ang + 105,
steps: 6,
locator: '[data-overlay-toolbar-index="0"]',
@ -843,10 +817,10 @@ part001 = startSketchOn('XZ')
hoverPos,
constraintType: 'yAbsolute',
expectBeforeUnconstrained:
'circle({ center = [xAbs001, 0], radius = 8 }, %)',
'circle({ center: [xAbs001, 0], radius: 8 }, %)',
expectAfterUnconstrained:
'circle({ center = [xAbs001, yAbs001], radius = 8 }, %)',
expectFinal: 'circle({ center = [xAbs001, 0], radius = 8 }, %)',
'circle({ center: [xAbs001, yAbs001], radius: 8 }, %)',
expectFinal: 'circle({ center: [xAbs001, 0], radius: 8 }, %)',
ang: ang + 105,
steps: 10,
locator: '[data-overlay-toolbar-index="0"]',
@ -856,15 +830,14 @@ part001 = startSketchOn('XZ')
hoverPos,
constraintType: 'radius',
expectBeforeUnconstrained:
'circle({ center = [xAbs001, 0], radius = 8 }, %)',
'circle({ center: [xAbs001, 0], radius: 8 }, %)',
expectAfterUnconstrained:
'circle({ center = [xAbs001, 0], radius = radius001 }, %)',
expectFinal: 'circle({ center = [xAbs001, 0], radius = 8 }, %)',
'circle({ center: [xAbs001, 0], radius: radius001 }, %)',
expectFinal: 'circle({ center: [xAbs001, 0], radius: 8 }, %)',
ang: ang + 105,
steps: 10,
locator: '[data-overlay-toolbar-index="0"]',
})
})
}) })
})
test.describe('Testing deleting a segment', () => {
const _deleteSegmentSequence =
@ -904,27 +877,27 @@ part001 = startSketchOn('XZ')
codeToBeDeleted
)
}
test('all segment types', async ({ page }) => {
await page.addInitScript(async () => {
test('all segment types', async ({ page, homePage }) => { await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`part001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line([0.5, -14 + 0], %)
|> angledLine({ angle = 3 + 0, length = 32 + 0 }, %)
|> angledLine({ angle: 3 + 0, length: 32 + 0 }, %)
|> lineTo([33, 11.5 + 0], %)
|> xLineTo(9 - 5, %)
|> yLineTo(-10.77, %, $a)
|> xLine(26.04, %)
|> yLine(21.14 + 0, %)
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|> angledLineToX({ angle = 3 + 0, to = 26 }, %)
|> angledLineToY({ angle = 89, to = 9.14 + 0 }, %)
|> angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %)
|> angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)
|> angledLineToX({ angle: 3 + 0, to: 26 }, %)
|> angledLineToY({ angle: 89, to: 9.14 + 0 }, %)
|> angledLineThatIntersects({
angle = 4.14,
intersectTag = a,
offset = 9
angle: 4.14,
intersectTag: a,
offset: 9
}, %)
|> tangentialArcTo([3.14 + 13, 1.14], %)
`
@ -934,7 +907,7 @@ part001 = startSketchOn('XZ')
const u = await getUtils(page)
await page.setViewportSize({ width: 1200, height: 500 })
await u.waitForAuthSkipAppStart()
await homePage.goToModelingScene()
// wait for execution done
await u.openDebugPanel()
@ -969,9 +942,9 @@ part001 = startSketchOn('XZ')
await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: `angledLineThatIntersects({
angle = 4.14,
intersectTag = a,
offset = 9
angle: 4.14,
intersectTag: a,
offset: 9
}, %)`,
stdLibFnName: 'angledLineThatIntersects',
ang: ang + 180,
@ -983,7 +956,7 @@ part001 = startSketchOn('XZ')
ang = await u.getAngle(`[data-overlay-index="${10}"]`)
await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'angledLineToY({ angle = 89, to = 9.14 + 0 }, %)',
codeToBeDeleted: 'angledLineToY({ angle: 89, to: 9.14 + 0 }, %)',
stdLibFnName: 'angledLineToY',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="10"]',
@ -993,7 +966,7 @@ part001 = startSketchOn('XZ')
ang = await u.getAngle(`[data-overlay-index="${9}"]`)
await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'angledLineToX({ angle = 3 + 0, to = 26 }, %)',
codeToBeDeleted: 'angledLineToX({ angle: 3 + 0, to: 26 }, %)',
stdLibFnName: 'angledLineToX',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="9"]',
@ -1004,7 +977,7 @@ part001 = startSketchOn('XZ')
await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted:
'angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)',
'angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)',
stdLibFnName: 'angledLineOfYLength',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="8"]',
@ -1015,7 +988,7 @@ part001 = startSketchOn('XZ')
await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted:
'angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)',
'angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %)',
stdLibFnName: 'angledLineOfXLength',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="7"]',
@ -1095,7 +1068,7 @@ part001 = startSketchOn('XZ')
ang = await u.getAngle(`[data-overlay-index="${1}"]`)
await deleteSegmentSequence({
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
codeToBeDeleted: 'angledLine({ angle = 3 + 0, length = 32 + 0 }, %)',
codeToBeDeleted: 'angledLine({ angle: 3 + 0, length: 32 + 0 }, %)',
stdLibFnName: 'angledLine',
ang: ang + 180,
locator: '[data-overlay-toolbar-index="1"]',
@ -1110,8 +1083,7 @@ part001 = startSketchOn('XZ')
ang: ang + 180,
})
await page.waitForTimeout(200)
})
await page.waitForTimeout(200) })
})
test.describe('Testing delete with dependent segments', () => {
const cases = [
@ -1135,8 +1107,7 @@ part001 = startSketchOn('XZ')
const isObj = lineOfInterest.includes('{ angle = 3,')
test(`${lineOfInterest.split('(')[0]}${isObj ? '-[obj-input]' : ''}${
doesHaveTagOutsideSketch ? '-[tagOutsideSketch]' : ''
}`, async ({ page }) => {
await page.addInitScript(
}`, async ({ page, homePage }) => { await page.addInitScript(
async ({ lineToBeDeleted, extraLine }) => {
localStorage.setItem(
'persistCode',
@ -1156,7 +1127,7 @@ ${extraLine ? 'myVar = segLen(seg01)' : ''}`
const u = await getUtils(page)
await page.setViewportSize({ width: 1200, height: 500 })
await u.waitForAuthSkipAppStart()
await homePage.goToModelingScene()
await page.waitForTimeout(300)
await page.getByText(lineOfInterest).click()
@ -1225,8 +1196,7 @@ ${extraLine ? 'myVar = segLen(seg01)' : ''}`
)
// eslint-disable-next-line jest/no-conditional-expect
await expect(page.locator('.cm-content')).not.toContainText('seg01')
}
})
} })
}
}
})
@ -1292,11 +1262,8 @@ ${extraLine ? 'myVar = segLen(seg01)' : ''}`
]
for (const { before, after } of cases) {
const isObj = before.includes('{ angle = 3')
test(`${before.split('(')[0]}${isObj ? '-[obj-input]' : ''}`, async ({
page,
}) => {
await page.addInitScript(
const isObj = before.includes('{ angle: 3')
test(`${before.split('(')[0]}${isObj ? '-[obj-input]' : ''}`, async ({ page, homePage }) => { await page.addInitScript(
async ({ lineToBeDeleted }) => {
localStorage.setItem(
'persistCode',
@ -1314,7 +1281,7 @@ ${extraLine ? 'myVar = segLen(seg01)' : ''}`
const u = await getUtils(page)
await page.setViewportSize({ width: 1200, height: 500 })
await u.waitForAuthSkipAppStart()
await homePage.goToModelingScene()
await page.waitForTimeout(300)
await page.getByText(before).click()
@ -1357,8 +1324,7 @@ ${extraLine ? 'myVar = segLen(seg01)' : ''}`
await expect(page.locator('.cm-content')).toContainText(after)
// check the cursor was left in the correct place after transform
await expect(page.locator('.cm-activeLine')).toHaveText('|> ' + after)
await expect(page.getByTestId('segment-overlay')).toHaveCount(3)
})
await expect(page.getByTestId('segment-overlay')).toHaveCount(3) })
}
})
})