|
|
@ -16,7 +16,7 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
* @param {number} options.steps - The number of steps to perform
|
|
|
|
* @param {number} options.steps - The number of steps to perform
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
const _clickConstrained =
|
|
|
|
const _clickConstrained =
|
|
|
|
(page: Page) =>
|
|
|
|
(page: Page, editor: EditorFixture) =>
|
|
|
|
async ({
|
|
|
|
async ({
|
|
|
|
hoverPos,
|
|
|
|
hoverPos,
|
|
|
|
constraintType,
|
|
|
|
constraintType,
|
|
|
@ -50,10 +50,9 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
y = hoverPos.y - Math.sin(ang * deg) * 32
|
|
|
|
y = hoverPos.y - Math.sin(ang * deg) * 32
|
|
|
|
await page.mouse.move(x, y)
|
|
|
|
await page.mouse.move(x, y)
|
|
|
|
await wiggleMove(page, x, y, 20, 30, ang, 10, 5, locator)
|
|
|
|
await wiggleMove(page, x, y, 20, 30, ang, 10, 5, locator)
|
|
|
|
|
|
|
|
await page.mouse.move(x, y)
|
|
|
|
|
|
|
|
|
|
|
|
await expect(page.locator('.cm-content')).toContainText(
|
|
|
|
await editor.expectEditor.toContain(expectBeforeUnconstrained, { shouldNormalise: true })
|
|
|
|
expectBeforeUnconstrained
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
const constrainedLocator = page.locator(
|
|
|
|
const constrainedLocator = page.locator(
|
|
|
|
`[data-constraint-type="${constraintType}"][data-is-constrained="true"]`
|
|
|
|
`[data-constraint-type="${constraintType}"][data-is-constrained="true"]`
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -63,9 +62,7 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
await page.getByTestId('constraint-symbol-popover').count()
|
|
|
|
await page.getByTestId('constraint-symbol-popover').count()
|
|
|
|
).toBeGreaterThan(0)
|
|
|
|
).toBeGreaterThan(0)
|
|
|
|
await constrainedLocator.click()
|
|
|
|
await constrainedLocator.click()
|
|
|
|
await expect(page.locator('.cm-content')).toContainText(
|
|
|
|
await editor.expectEditor.toContain(expectAfterUnconstrained, { shouldNormalise: true })
|
|
|
|
expectAfterUnconstrained
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await page.mouse.move(0, 0)
|
|
|
|
await page.mouse.move(0, 0)
|
|
|
|
await page.waitForTimeout(1000)
|
|
|
|
await page.waitForTimeout(1000)
|
|
|
@ -73,6 +70,7 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
y = hoverPos.y - Math.sin(ang * deg) * 32
|
|
|
|
y = hoverPos.y - Math.sin(ang * deg) * 32
|
|
|
|
await page.mouse.move(x, y)
|
|
|
|
await page.mouse.move(x, y)
|
|
|
|
await wiggleMove(page, x, y, 20, 30, ang, 10, 5, locator)
|
|
|
|
await wiggleMove(page, x, y, 20, 30, ang, 10, 5, locator)
|
|
|
|
|
|
|
|
await page.mouse.move(x, y)
|
|
|
|
|
|
|
|
|
|
|
|
const unconstrainedLocator = page.locator(
|
|
|
|
const unconstrainedLocator = page.locator(
|
|
|
|
`[data-constraint-type="${constraintType}"][data-is-constrained="false"]`
|
|
|
|
`[data-constraint-type="${constraintType}"][data-is-constrained="false"]`
|
|
|
@ -92,6 +90,7 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.click()
|
|
|
|
.click()
|
|
|
|
await expect(page.locator('.cm-content')).toContainText(expectFinal)
|
|
|
|
await expect(page.locator('.cm-content')).toContainText(expectFinal)
|
|
|
|
|
|
|
|
await editor.expectEditor.toContain(expectFinal, { shouldNormalise: true })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -104,7 +103,7 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
* @param {number} options.steps - The number of steps to perform
|
|
|
|
* @param {number} options.steps - The number of steps to perform
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
const _clickUnconstrained =
|
|
|
|
const _clickUnconstrained =
|
|
|
|
(page: Page) =>
|
|
|
|
(page: Page, editor: EditorFixture) =>
|
|
|
|
async ({
|
|
|
|
async ({
|
|
|
|
hoverPos,
|
|
|
|
hoverPos,
|
|
|
|
constraintType,
|
|
|
|
constraintType,
|
|
|
@ -136,11 +135,10 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
y = hoverPos.y - Math.sin(ang * deg) * 32
|
|
|
|
y = hoverPos.y - Math.sin(ang * deg) * 32
|
|
|
|
await page.mouse.move(x, y)
|
|
|
|
await page.mouse.move(x, y)
|
|
|
|
await wiggleMove(page, x, y, 20, 30, ang, 10, 5, locator)
|
|
|
|
await wiggleMove(page, x, y, 20, 30, ang, 10, 5, locator)
|
|
|
|
|
|
|
|
await page.mouse.move(x, y)
|
|
|
|
|
|
|
|
|
|
|
|
await expect(page.getByText('Added variable')).not.toBeVisible()
|
|
|
|
await expect(page.getByText('Added variable')).not.toBeVisible()
|
|
|
|
await expect(page.locator('.cm-content')).toContainText(
|
|
|
|
await editor.expectEditor.toContain(expectBeforeUnconstrained, { shouldNormalise: true })
|
|
|
|
expectBeforeUnconstrained
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
const unconstrainedLocator = page.locator(
|
|
|
|
const unconstrainedLocator = page.locator(
|
|
|
|
`[data-constraint-type="${constraintType}"][data-is-constrained="false"]`
|
|
|
|
`[data-constraint-type="${constraintType}"][data-is-constrained="false"]`
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -158,9 +156,7 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
name: 'arrow right Continue',
|
|
|
|
name: 'arrow right Continue',
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.click()
|
|
|
|
.click()
|
|
|
|
await expect(page.locator('.cm-content')).toContainText(
|
|
|
|
await editor.expectEditor.toContain(expectAfterUnconstrained, { shouldNormalise: true })
|
|
|
|
expectAfterUnconstrained
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
await expect(page.getByText('Added variable')).not.toBeVisible()
|
|
|
|
await expect(page.getByText('Added variable')).not.toBeVisible()
|
|
|
|
|
|
|
|
|
|
|
|
await page.mouse.move(0, 0)
|
|
|
|
await page.mouse.move(0, 0)
|
|
|
@ -169,6 +165,7 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
y = hoverPos.y - Math.sin(ang * deg) * 32
|
|
|
|
y = hoverPos.y - Math.sin(ang * deg) * 32
|
|
|
|
await page.mouse.move(x, y)
|
|
|
|
await page.mouse.move(x, y)
|
|
|
|
await wiggleMove(page, x, y, 20, 30, ang, 10, 5, locator)
|
|
|
|
await wiggleMove(page, x, y, 20, 30, ang, 10, 5, locator)
|
|
|
|
|
|
|
|
await page.mouse.move(x, y)
|
|
|
|
|
|
|
|
|
|
|
|
const constrainedLocator = page.locator(
|
|
|
|
const constrainedLocator = page.locator(
|
|
|
|
`[data-constraint-type="${constraintType}"][data-is-constrained="true"]`
|
|
|
|
`[data-constraint-type="${constraintType}"][data-is-constrained="true"]`
|
|
|
@ -179,11 +176,12 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
await page.getByTestId('constraint-symbol-popover').count()
|
|
|
|
await page.getByTestId('constraint-symbol-popover').count()
|
|
|
|
).toBeGreaterThan(0)
|
|
|
|
).toBeGreaterThan(0)
|
|
|
|
await constrainedLocator.click()
|
|
|
|
await constrainedLocator.click()
|
|
|
|
await expect(page.locator('.cm-content')).toContainText(expectFinal)
|
|
|
|
await editor.expectEditor.toContain(expectFinal, { shouldNormalise: true })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
test.setTimeout(120000)
|
|
|
|
test.setTimeout(120000)
|
|
|
|
test('for segments [line, angledLine, lineTo, xLineTo]', async ({
|
|
|
|
test('for segments [line, angledLine, lineTo, xLineTo]', async ({
|
|
|
|
page,
|
|
|
|
page,
|
|
|
|
|
|
|
|
editor,
|
|
|
|
homePage,
|
|
|
|
homePage,
|
|
|
|
}) => {
|
|
|
|
}) => {
|
|
|
|
await page.addInitScript(async () => {
|
|
|
|
await page.addInitScript(async () => {
|
|
|
@ -192,20 +190,20 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
`part001 = startSketchOn('XZ')
|
|
|
|
`part001 = startSketchOn('XZ')
|
|
|
|
|> startProfileAt([5 + 0, 20 + 0], %)
|
|
|
|
|> startProfileAt([5 + 0, 20 + 0], %)
|
|
|
|
|> line([0.5, -14 + 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], %)
|
|
|
|
|> lineTo([5 + 33, 20 + 11.5 + 0], %)
|
|
|
|
|> xLineTo(5 + 9 - 5, %)
|
|
|
|
|> xLineTo(5 + 9 - 5, %)
|
|
|
|
|> yLineTo(20 + -10.77, %, $a)
|
|
|
|
|> yLineTo(20 + -10.77, %, $a)
|
|
|
|
|> xLine(26.04, %)
|
|
|
|
|> xLine(26.04, %)
|
|
|
|
|> yLine(21.14 + 0, %)
|
|
|
|
|> yLine(21.14 + 0, %)
|
|
|
|
|> angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %)
|
|
|
|
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|
|
|
|
|> angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)
|
|
|
|
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|
|
|
|
|> angledLineToX({ angle: 3 + 0, to: 5 + 26 }, %)
|
|
|
|
|> angledLineToX({ angle = 3 + 0, to = 5 + 26 }, %)
|
|
|
|
|> angledLineToY({ angle: 89, to: 20 + 9.14 + 0 }, %)
|
|
|
|
|> angledLineToY({ angle = 89, to = 20 + 9.14 + 0 }, %)
|
|
|
|
|> angledLineThatIntersects({
|
|
|
|
|> angledLineThatIntersects({
|
|
|
|
angle: 4.14,
|
|
|
|
angle = 4.14,
|
|
|
|
intersectTag: a,
|
|
|
|
intersectTag = a,
|
|
|
|
offset: 9
|
|
|
|
offset = 9
|
|
|
|
}, %)
|
|
|
|
}, %)
|
|
|
|
|> tangentialArcTo([5 + 3.14 + 13, 20 + 3.14], %)
|
|
|
|
|> tangentialArcTo([5 + 3.14 + 13, 20 + 3.14], %)
|
|
|
|
`
|
|
|
|
`
|
|
|
@ -228,8 +226,8 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
|
|
|
|
|
|
|
|
await expect(page.getByTestId('segment-overlay')).toHaveCount(13)
|
|
|
|
await expect(page.getByTestId('segment-overlay')).toHaveCount(13)
|
|
|
|
|
|
|
|
|
|
|
|
const clickUnconstrained = _clickUnconstrained(page)
|
|
|
|
const clickUnconstrained = _clickUnconstrained(page, editor)
|
|
|
|
const clickConstrained = _clickConstrained(page)
|
|
|
|
const clickConstrained = _clickConstrained(page, editor)
|
|
|
|
|
|
|
|
|
|
|
|
await u.openAndClearDebugPanel()
|
|
|
|
await u.openAndClearDebugPanel()
|
|
|
|
await u.sendCustomCmd({
|
|
|
|
await u.sendCustomCmd({
|
|
|
@ -346,7 +344,7 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
locator: '[data-overlay-toolbar-index="3"]',
|
|
|
|
locator: '[data-overlay-toolbar-index="3"]',
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
test('for segments [yLineTo, xLine]', async ({ page, homePage }) => {
|
|
|
|
test('for segments [yLineTo, xLine]', async ({ page, editor, homePage }) => {
|
|
|
|
await page.addInitScript(async () => {
|
|
|
|
await page.addInitScript(async () => {
|
|
|
|
localStorage.setItem(
|
|
|
|
localStorage.setItem(
|
|
|
|
'persistCode',
|
|
|
|
'persistCode',
|
|
|
@ -360,13 +358,13 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
part001 = startSketchOn('XZ')
|
|
|
|
part001 = startSketchOn('XZ')
|
|
|
|
|> startProfileAt([0, 0], %)
|
|
|
|
|> startProfileAt([0, 0], %)
|
|
|
|
|> line([0.5, yRel001], %)
|
|
|
|
|> line([0.5, yRel001], %)
|
|
|
|
|> angledLine({ angle: angle001, length: len001 }, %)
|
|
|
|
|> angledLine({ angle = angle001, length = len001 }, %)
|
|
|
|
|> lineTo([33, yAbs001], %)
|
|
|
|
|> lineTo([33, yAbs001], %)
|
|
|
|
|> xLineTo(xAbs002, %)
|
|
|
|
|> xLineTo(xAbs002, %)
|
|
|
|
|> yLineTo(-10.77, %, $a)
|
|
|
|
|> yLineTo(-10.77, %, $a)
|
|
|
|
|> xLine(26.04, %)
|
|
|
|
|> xLine(26.04, %)
|
|
|
|
|> yLine(21.14 + 0, %)
|
|
|
|
|> yLine(21.14 + 0, %)
|
|
|
|
|> angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %)
|
|
|
|
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|
|
|
|
`
|
|
|
|
`
|
|
|
|
)
|
|
|
|
)
|
|
|
|
})
|
|
|
|
})
|
|
|
@ -387,7 +385,7 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
|
|
|
|
|
|
|
|
await expect(page.getByTestId('segment-overlay')).toHaveCount(8)
|
|
|
|
await expect(page.getByTestId('segment-overlay')).toHaveCount(8)
|
|
|
|
|
|
|
|
|
|
|
|
const clickUnconstrained = _clickUnconstrained(page)
|
|
|
|
const clickUnconstrained = _clickUnconstrained(page, editor)
|
|
|
|
|
|
|
|
|
|
|
|
await page.mouse.move(700, 250)
|
|
|
|
await page.mouse.move(700, 250)
|
|
|
|
await page.waitForTimeout(100)
|
|
|
|
await page.waitForTimeout(100)
|
|
|
@ -423,6 +421,7 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
test('for segments [yLine, angledLineOfXLength, angledLineOfYLength]', async ({
|
|
|
|
test('for segments [yLine, angledLineOfXLength, angledLineOfYLength]', async ({
|
|
|
|
page,
|
|
|
|
page,
|
|
|
|
|
|
|
|
editor,
|
|
|
|
homePage,
|
|
|
|
homePage,
|
|
|
|
}) => {
|
|
|
|
}) => {
|
|
|
|
await page.addInitScript(async () => {
|
|
|
|
await page.addInitScript(async () => {
|
|
|
@ -431,20 +430,20 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
`part001 = startSketchOn('XZ')
|
|
|
|
`part001 = startSketchOn('XZ')
|
|
|
|
|> startProfileAt([0, 0], %)
|
|
|
|
|> startProfileAt([0, 0], %)
|
|
|
|
|> line([0.5, -14 + 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], %)
|
|
|
|
|> lineTo([33, 11.5 + 0], %)
|
|
|
|
|> xLineTo(9 - 5, %)
|
|
|
|
|> xLineTo(9 - 5, %)
|
|
|
|
|> yLineTo(-10.77, %, $a)
|
|
|
|
|> yLineTo(-10.77, %, $a)
|
|
|
|
|> xLine(26.04, %)
|
|
|
|
|> xLine(26.04, %)
|
|
|
|
|> yLine(21.14 + 0, %)
|
|
|
|
|> yLine(21.14 + 0, %)
|
|
|
|
|> angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %)
|
|
|
|
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|
|
|
|
|> angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)
|
|
|
|
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|
|
|
|
|> angledLineToX({ angle: 3 + 0, to: 26 }, %)
|
|
|
|
|> angledLineToX({ angle = 3 + 0, to = 26 }, %)
|
|
|
|
|> angledLineToY({ angle: 89, to: 9.14 + 0 }, %)
|
|
|
|
|> angledLineToY({ angle = 89, to = 9.14 + 0 }, %)
|
|
|
|
|> angledLineThatIntersects({
|
|
|
|
|> angledLineThatIntersects({
|
|
|
|
angle: 4.14,
|
|
|
|
angle = 4.14,
|
|
|
|
intersectTag: a,
|
|
|
|
intersectTag = a,
|
|
|
|
offset: 9
|
|
|
|
offset = 9
|
|
|
|
}, %)
|
|
|
|
}, %)
|
|
|
|
|> tangentialArcTo([3.14 + 13, 3.14], %)
|
|
|
|
|> tangentialArcTo([3.14 + 13, 3.14], %)
|
|
|
|
`
|
|
|
|
`
|
|
|
@ -469,8 +468,8 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
|
|
|
|
|
|
|
|
await expect(page.getByTestId('segment-overlay')).toHaveCount(13)
|
|
|
|
await expect(page.getByTestId('segment-overlay')).toHaveCount(13)
|
|
|
|
|
|
|
|
|
|
|
|
const clickUnconstrained = _clickUnconstrained(page)
|
|
|
|
const clickUnconstrained = _clickUnconstrained(page, editor)
|
|
|
|
const clickConstrained = _clickConstrained(page)
|
|
|
|
const clickConstrained = _clickConstrained(page, editor)
|
|
|
|
|
|
|
|
|
|
|
|
let ang = 0
|
|
|
|
let ang = 0
|
|
|
|
|
|
|
|
|
|
|
@ -552,6 +551,7 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
test('for segments [angledLineToX, angledLineToY, angledLineThatIntersects]', async ({
|
|
|
|
test('for segments [angledLineToX, angledLineToY, angledLineThatIntersects]', async ({
|
|
|
|
page,
|
|
|
|
page,
|
|
|
|
|
|
|
|
editor,
|
|
|
|
homePage,
|
|
|
|
homePage,
|
|
|
|
}) => {
|
|
|
|
}) => {
|
|
|
|
await page.addInitScript(async () => {
|
|
|
|
await page.addInitScript(async () => {
|
|
|
@ -560,20 +560,20 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
`part001 = startSketchOn('XZ')
|
|
|
|
`part001 = startSketchOn('XZ')
|
|
|
|
|> startProfileAt([0, 0], %)
|
|
|
|
|> startProfileAt([0, 0], %)
|
|
|
|
|> line([0.5, -14 + 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], %)
|
|
|
|
|> lineTo([33, 11.5 + 0], %)
|
|
|
|
|> xLineTo(9 - 5, %)
|
|
|
|
|> xLineTo(9 - 5, %)
|
|
|
|
|> yLineTo(-10.77, %, $a)
|
|
|
|
|> yLineTo(-10.77, %, $a)
|
|
|
|
|> xLine(26.04, %)
|
|
|
|
|> xLine(26.04, %)
|
|
|
|
|> yLine(21.14 + 0, %)
|
|
|
|
|> yLine(21.14 + 0, %)
|
|
|
|
|> angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %)
|
|
|
|
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|
|
|
|
|> angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)
|
|
|
|
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|
|
|
|
|> angledLineToX({ angle: 3 + 0, to: 26 }, %)
|
|
|
|
|> angledLineToX({ angle = 3 + 0, to = 26 }, %)
|
|
|
|
|> angledLineToY({ angle: 89, to: 9.14 + 0 }, %)
|
|
|
|
|> angledLineToY({ angle = 89, to = 9.14 + 0 }, %)
|
|
|
|
|> angledLineThatIntersects({
|
|
|
|
|> angledLineThatIntersects({
|
|
|
|
angle: 4.14,
|
|
|
|
angle = 4.14,
|
|
|
|
intersectTag: a,
|
|
|
|
intersectTag = a,
|
|
|
|
offset: 9
|
|
|
|
offset = 9
|
|
|
|
}, %)
|
|
|
|
}, %)
|
|
|
|
|> tangentialArcTo([3.14 + 13, 1.14], %)
|
|
|
|
|> tangentialArcTo([3.14 + 13, 1.14], %)
|
|
|
|
`
|
|
|
|
`
|
|
|
@ -597,8 +597,8 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
|
|
|
|
|
|
|
|
await expect(page.getByTestId('segment-overlay')).toHaveCount(13)
|
|
|
|
await expect(page.getByTestId('segment-overlay')).toHaveCount(13)
|
|
|
|
|
|
|
|
|
|
|
|
const clickUnconstrained = _clickUnconstrained(page)
|
|
|
|
const clickUnconstrained = _clickUnconstrained(page, editor)
|
|
|
|
const clickConstrained = _clickConstrained(page)
|
|
|
|
const clickConstrained = _clickConstrained(page, editor)
|
|
|
|
|
|
|
|
|
|
|
|
let ang = 0
|
|
|
|
let ang = 0
|
|
|
|
|
|
|
|
|
|
|
@ -666,19 +666,19 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
constraintType: 'angle',
|
|
|
|
constraintType: 'angle',
|
|
|
|
expectBeforeUnconstrained: `angledLineThatIntersects({
|
|
|
|
expectBeforeUnconstrained: `angledLineThatIntersects({
|
|
|
|
angle: 4.14,
|
|
|
|
angle = 4.14,
|
|
|
|
intersectTag: a,
|
|
|
|
intersectTag = a,
|
|
|
|
offset: 9
|
|
|
|
offset = 9
|
|
|
|
}, %)`,
|
|
|
|
}, %)`,
|
|
|
|
expectAfterUnconstrained: `angledLineThatIntersects({
|
|
|
|
expectAfterUnconstrained: `angledLineThatIntersects({
|
|
|
|
angle: angle003,
|
|
|
|
angle = angle003,
|
|
|
|
intersectTag: a,
|
|
|
|
intersectTag = a,
|
|
|
|
offset: 9
|
|
|
|
offset = 9
|
|
|
|
}, %)`,
|
|
|
|
}, %)`,
|
|
|
|
expectFinal: `angledLineThatIntersects({
|
|
|
|
expectFinal: `angledLineThatIntersects({
|
|
|
|
angle: -176,
|
|
|
|
angle = -176,
|
|
|
|
offset: 9,
|
|
|
|
offset = 9,
|
|
|
|
intersectTag: a
|
|
|
|
intersectTag = a
|
|
|
|
}, %)`,
|
|
|
|
}, %)`,
|
|
|
|
ang: ang + 180,
|
|
|
|
ang: ang + 180,
|
|
|
|
locator: '[data-overlay-toolbar-index="11"]',
|
|
|
|
locator: '[data-overlay-toolbar-index="11"]',
|
|
|
@ -691,45 +691,45 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
constraintType: 'intersectionOffset',
|
|
|
|
constraintType: 'intersectionOffset',
|
|
|
|
expectBeforeUnconstrained: `angledLineThatIntersects({
|
|
|
|
expectBeforeUnconstrained: `angledLineThatIntersects({
|
|
|
|
angle: -176,
|
|
|
|
angle = -176,
|
|
|
|
offset: 9,
|
|
|
|
offset = 9,
|
|
|
|
intersectTag: a
|
|
|
|
intersectTag = a
|
|
|
|
}, %)`,
|
|
|
|
}, %)`,
|
|
|
|
expectAfterUnconstrained: `angledLineThatIntersects({
|
|
|
|
expectAfterUnconstrained: `angledLineThatIntersects({
|
|
|
|
angle: -176,
|
|
|
|
angle = -176,
|
|
|
|
offset: perpDist001,
|
|
|
|
offset = perpDist001,
|
|
|
|
intersectTag: a
|
|
|
|
intersectTag = a
|
|
|
|
}, %)`,
|
|
|
|
}, %)`,
|
|
|
|
expectFinal: `angledLineThatIntersects({
|
|
|
|
expectFinal: `angledLineThatIntersects({
|
|
|
|
angle: -176,
|
|
|
|
angle = -176,
|
|
|
|
offset: 9,
|
|
|
|
offset = 9,
|
|
|
|
intersectTag: a
|
|
|
|
intersectTag = a
|
|
|
|
}, %)`,
|
|
|
|
}, %)`,
|
|
|
|
ang: ang + 180,
|
|
|
|
ang: ang + 180,
|
|
|
|
locator: '[data-overlay-toolbar-index="11"]',
|
|
|
|
locator: '[data-overlay-toolbar-index="11"]',
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
test('for segment [tangentialArcTo]', async ({ page, homePage }) => {
|
|
|
|
test('for segment [tangentialArcTo]', async ({ page, editor, homePage }) => {
|
|
|
|
await page.addInitScript(async () => {
|
|
|
|
await page.addInitScript(async () => {
|
|
|
|
localStorage.setItem(
|
|
|
|
localStorage.setItem(
|
|
|
|
'persistCode',
|
|
|
|
'persistCode',
|
|
|
|
`part001 = startSketchOn('XZ')
|
|
|
|
`part001 = startSketchOn('XZ')
|
|
|
|
|> startProfileAt([0, 0], %)
|
|
|
|
|> startProfileAt([0, 0], %)
|
|
|
|
|> line([0.5, -14 + 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], %)
|
|
|
|
|> lineTo([33, 11.5 + 0], %)
|
|
|
|
|> xLineTo(9 - 5, %)
|
|
|
|
|> xLineTo(9 - 5, %)
|
|
|
|
|> yLineTo(-10.77, %, $a)
|
|
|
|
|> yLineTo(-10.77, %, $a)
|
|
|
|
|> xLine(26.04, %)
|
|
|
|
|> xLine(26.04, %)
|
|
|
|
|> yLine(21.14 + 0, %)
|
|
|
|
|> yLine(21.14 + 0, %)
|
|
|
|
|> angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %)
|
|
|
|
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|
|
|
|
|> angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)
|
|
|
|
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|
|
|
|
|> angledLineToX({ angle: 3 + 0, to: 26 }, %)
|
|
|
|
|> angledLineToX({ angle = 3 + 0, to = 26 }, %)
|
|
|
|
|> angledLineToY({ angle: 89, to: 9.14 + 0 }, %)
|
|
|
|
|> angledLineToY({ angle = 89, to = 9.14 + 0 }, %)
|
|
|
|
|> angledLineThatIntersects({
|
|
|
|
|> angledLineThatIntersects({
|
|
|
|
angle: 4.14,
|
|
|
|
angle = 4.14,
|
|
|
|
intersectTag: a,
|
|
|
|
intersectTag = a,
|
|
|
|
offset: 9
|
|
|
|
offset = 9
|
|
|
|
}, %)
|
|
|
|
}, %)
|
|
|
|
|> tangentialArcTo([3.14 + 13, -3.14], %)
|
|
|
|
|> tangentialArcTo([3.14 + 13, -3.14], %)
|
|
|
|
`
|
|
|
|
`
|
|
|
@ -753,8 +753,8 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
|
|
|
|
|
|
|
|
await expect(page.getByTestId('segment-overlay')).toHaveCount(13)
|
|
|
|
await expect(page.getByTestId('segment-overlay')).toHaveCount(13)
|
|
|
|
|
|
|
|
|
|
|
|
const clickUnconstrained = _clickUnconstrained(page)
|
|
|
|
const clickUnconstrained = _clickUnconstrained(page, editor)
|
|
|
|
const clickConstrained = _clickConstrained(page)
|
|
|
|
const clickConstrained = _clickConstrained(page, editor)
|
|
|
|
|
|
|
|
|
|
|
|
const tangentialArcTo = await u.getBoundingBox(
|
|
|
|
const tangentialArcTo = await u.getBoundingBox(
|
|
|
|
'[data-overlay-index="12"]'
|
|
|
|
'[data-overlay-index="12"]'
|
|
|
@ -783,12 +783,12 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
locator: '[data-overlay-toolbar-index="12"]',
|
|
|
|
locator: '[data-overlay-toolbar-index="12"]',
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
test('for segment [circle]', async ({ page, homePage }) => {
|
|
|
|
test('for segment [circle]', async ({ page, editor, homePage }) => {
|
|
|
|
await page.addInitScript(async () => {
|
|
|
|
await page.addInitScript(async () => {
|
|
|
|
localStorage.setItem(
|
|
|
|
localStorage.setItem(
|
|
|
|
'persistCode',
|
|
|
|
'persistCode',
|
|
|
|
`part001 = startSketchOn('XZ')
|
|
|
|
`part001 = startSketchOn('XZ')
|
|
|
|
|> circle({ center: [1 + 0, 0], radius: 8 }, %)
|
|
|
|
|> circle({ center = [1 + 0, 0], radius = 8 }, %)
|
|
|
|
`
|
|
|
|
`
|
|
|
|
)
|
|
|
|
)
|
|
|
|
localStorage.setItem('disableAxis', 'true')
|
|
|
|
localStorage.setItem('disableAxis', 'true')
|
|
|
@ -812,8 +812,8 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
|
|
|
|
|
|
|
|
await expect(page.getByTestId('segment-overlay')).toHaveCount(1)
|
|
|
|
await expect(page.getByTestId('segment-overlay')).toHaveCount(1)
|
|
|
|
|
|
|
|
|
|
|
|
const clickUnconstrained = _clickUnconstrained(page)
|
|
|
|
const clickUnconstrained = _clickUnconstrained(page, editor)
|
|
|
|
const clickConstrained = _clickConstrained(page)
|
|
|
|
const clickConstrained = _clickConstrained(page, editor)
|
|
|
|
|
|
|
|
|
|
|
|
const hoverPos = { x: 789, y: 114 } as const
|
|
|
|
const hoverPos = { x: 789, y: 114 } as const
|
|
|
|
let ang = await u.getAngle('[data-overlay-index="0"]')
|
|
|
|
let ang = await u.getAngle('[data-overlay-index="0"]')
|
|
|
@ -837,10 +837,10 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
expectBeforeUnconstrained:
|
|
|
|
expectBeforeUnconstrained:
|
|
|
|
'circle({ center: [xAbs001, 0], radius: 8 }, %)',
|
|
|
|
'circle({ center: [xAbs001, 0], radius: 8 }, %)',
|
|
|
|
expectAfterUnconstrained:
|
|
|
|
expectAfterUnconstrained:
|
|
|
|
'circle({ center: [xAbs001, yAbs001], radius: 8 }, %)',
|
|
|
|
'circle({ center = [xAbs001, yAbs001], radius = 8 }, %)',
|
|
|
|
expectFinal: 'circle({ center: [xAbs001, 0], radius: 8 }, %)',
|
|
|
|
expectFinal: 'circle({ center = [xAbs001, 0], radius = 8 }, %)',
|
|
|
|
ang: ang + 105,
|
|
|
|
ang: ang + 180,
|
|
|
|
steps: 10,
|
|
|
|
steps: 30,
|
|
|
|
locator: '[data-overlay-toolbar-index="0"]',
|
|
|
|
locator: '[data-overlay-toolbar-index="0"]',
|
|
|
|
})
|
|
|
|
})
|
|
|
|
console.log('circle radius')
|
|
|
|
console.log('circle radius')
|
|
|
@ -860,7 +860,7 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
test.describe('Testing deleting a segment', () => {
|
|
|
|
test.describe('Testing deleting a segment', () => {
|
|
|
|
const _deleteSegmentSequence =
|
|
|
|
const _deleteSegmentSequence =
|
|
|
|
(page: Page) =>
|
|
|
|
(page: Page, editor: EditorFixture) =>
|
|
|
|
async ({
|
|
|
|
async ({
|
|
|
|
hoverPos,
|
|
|
|
hoverPos,
|
|
|
|
codeToBeDeleted,
|
|
|
|
codeToBeDeleted,
|
|
|
@ -886,37 +886,36 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
y = hoverPos.y - Math.sin(ang * deg) * 32
|
|
|
|
y = hoverPos.y - Math.sin(ang * deg) * 32
|
|
|
|
await page.mouse.move(x, y)
|
|
|
|
await page.mouse.move(x, y)
|
|
|
|
await wiggleMove(page, x, y, 20, 30, ang, 10, 5, locator)
|
|
|
|
await wiggleMove(page, x, y, 20, 30, ang, 10, 5, locator)
|
|
|
|
|
|
|
|
await page.mouse.move(x, y)
|
|
|
|
|
|
|
|
|
|
|
|
await expect(page.locator('.cm-content')).toContainText(codeToBeDeleted)
|
|
|
|
await editor.expectEditor.toContain(codeToBeDeleted, { shouldNormalise: true })
|
|
|
|
|
|
|
|
|
|
|
|
await page.locator(`[data-stdlib-fn-name="${stdLibFnName}"]`).click()
|
|
|
|
await page.locator(`[data-stdlib-fn-name="${stdLibFnName}"]`).click()
|
|
|
|
await page.getByText('Delete Segment').click()
|
|
|
|
await page.getByText('Delete Segment').click()
|
|
|
|
|
|
|
|
|
|
|
|
await expect(page.locator('.cm-content')).not.toContainText(
|
|
|
|
await editor.expectEditor.not.toContain(codeToBeDeleted, { shouldNormalise: true })
|
|
|
|
codeToBeDeleted
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
test('all segment types', async ({ page, homePage }) => {
|
|
|
|
test('all segment types', async ({ page, editor, homePage }) => {
|
|
|
|
await page.addInitScript(async () => {
|
|
|
|
await page.addInitScript(async () => {
|
|
|
|
localStorage.setItem(
|
|
|
|
localStorage.setItem(
|
|
|
|
'persistCode',
|
|
|
|
'persistCode',
|
|
|
|
`part001 = startSketchOn('XZ')
|
|
|
|
`part001 = startSketchOn('XZ')
|
|
|
|
|> startProfileAt([0, 0], %)
|
|
|
|
|> startProfileAt([0, 0], %)
|
|
|
|
|> line([0.5, -14 + 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], %)
|
|
|
|
|> lineTo([33, 11.5 + 0], %)
|
|
|
|
|> xLineTo(9 - 5, %)
|
|
|
|
|> xLineTo(9 - 5, %)
|
|
|
|
|> yLineTo(-10.77, %, $a)
|
|
|
|
|> yLineTo(-10.77, %, $a)
|
|
|
|
|> xLine(26.04, %)
|
|
|
|
|> xLine(26.04, %)
|
|
|
|
|> yLine(21.14 + 0, %)
|
|
|
|
|> yLine(21.14 + 0, %)
|
|
|
|
|> angledLineOfXLength({ angle: 181 + 0, length: 23.14 }, %)
|
|
|
|
|> angledLineOfXLength({ angle = 181 + 0, length = 23.14 }, %)
|
|
|
|
|> angledLineOfYLength({ angle: -91, length: 19 + 0 }, %)
|
|
|
|
|> angledLineOfYLength({ angle = -91, length = 19 + 0 }, %)
|
|
|
|
|> angledLineToX({ angle: 3 + 0, to: 26 }, %)
|
|
|
|
|> angledLineToX({ angle = 3 + 0, to = 26 }, %)
|
|
|
|
|> angledLineToY({ angle: 89, to: 9.14 + 0 }, %)
|
|
|
|
|> angledLineToY({ angle = 89, to = 9.14 + 0 }, %)
|
|
|
|
|> angledLineThatIntersects({
|
|
|
|
|> angledLineThatIntersects({
|
|
|
|
angle: 4.14,
|
|
|
|
angle = 4.14,
|
|
|
|
intersectTag: a,
|
|
|
|
intersectTag = a,
|
|
|
|
offset: 9
|
|
|
|
offset = 9
|
|
|
|
}, %)
|
|
|
|
}, %)
|
|
|
|
|> tangentialArcTo([3.14 + 13, 1.14], %)
|
|
|
|
|> tangentialArcTo([3.14 + 13, 1.14], %)
|
|
|
|
`
|
|
|
|
`
|
|
|
@ -927,6 +926,7 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
await page.setViewportSize({ width: 1200, height: 500 })
|
|
|
|
await page.setViewportSize({ width: 1200, height: 500 })
|
|
|
|
|
|
|
|
|
|
|
|
await homePage.goToModelingScene()
|
|
|
|
await homePage.goToModelingScene()
|
|
|
|
|
|
|
|
await u.waitForPageLoad()
|
|
|
|
|
|
|
|
|
|
|
|
// wait for execution done
|
|
|
|
// wait for execution done
|
|
|
|
await u.openDebugPanel()
|
|
|
|
await u.openDebugPanel()
|
|
|
@ -939,7 +939,7 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
await page.waitForTimeout(500)
|
|
|
|
await page.waitForTimeout(500)
|
|
|
|
|
|
|
|
|
|
|
|
await expect(page.getByTestId('segment-overlay')).toHaveCount(13)
|
|
|
|
await expect(page.getByTestId('segment-overlay')).toHaveCount(13)
|
|
|
|
const deleteSegmentSequence = _deleteSegmentSequence(page)
|
|
|
|
const deleteSegmentSequence = _deleteSegmentSequence(page, editor)
|
|
|
|
|
|
|
|
|
|
|
|
let segmentToDelete
|
|
|
|
let segmentToDelete
|
|
|
|
|
|
|
|
|
|
|
@ -961,9 +961,9 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
await deleteSegmentSequence({
|
|
|
|
await deleteSegmentSequence({
|
|
|
|
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
|
|
|
hoverPos: { x: segmentToDelete.x, y: segmentToDelete.y },
|
|
|
|
codeToBeDeleted: `angledLineThatIntersects({
|
|
|
|
codeToBeDeleted: `angledLineThatIntersects({
|
|
|
|
angle: 4.14,
|
|
|
|
angle = 4.14,
|
|
|
|
intersectTag: a,
|
|
|
|
intersectTag = a,
|
|
|
|
offset: 9
|
|
|
|
offset = 9
|
|
|
|
}, %)`,
|
|
|
|
}, %)`,
|
|
|
|
stdLibFnName: 'angledLineThatIntersects',
|
|
|
|
stdLibFnName: 'angledLineThatIntersects',
|
|
|
|
ang: ang + 180,
|
|
|
|
ang: ang + 180,
|
|
|
@ -1072,16 +1072,15 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
5,
|
|
|
|
5,
|
|
|
|
'[data-overlay-toolbar-index="2"]'
|
|
|
|
'[data-overlay-toolbar-index="2"]'
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
await page.mouse.move(hoverPos.x, hoverPos.y)
|
|
|
|
|
|
|
|
|
|
|
|
const codeToBeDeleted = 'lineTo([33, 11.5 + 0], %)'
|
|
|
|
const codeToBeDeleted = 'lineTo([33, 11.5 + 0], %)'
|
|
|
|
await expect(page.locator('.cm-content')).toContainText(codeToBeDeleted)
|
|
|
|
await editor.expectEditor.toContain(codeToBeDeleted, { shouldNormalise: true })
|
|
|
|
|
|
|
|
|
|
|
|
await page.getByTestId('overlay-menu').click()
|
|
|
|
await page.getByTestId('overlay-menu').click()
|
|
|
|
await page.getByText('Delete Segment').click()
|
|
|
|
await page.getByText('Delete Segment').click()
|
|
|
|
|
|
|
|
|
|
|
|
await expect(page.locator('.cm-content')).not.toContainText(
|
|
|
|
await editor.expectEditor.not.toContain(codeToBeDeleted, { shouldNormalise: true })
|
|
|
|
codeToBeDeleted
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
segmentToDelete = await getOverlayByIndex(1)
|
|
|
|
segmentToDelete = await getOverlayByIndex(1)
|
|
|
|
ang = await u.getAngle(`[data-overlay-index="${1}"]`)
|
|
|
|
ang = await u.getAngle(`[data-overlay-index="${1}"]`)
|
|
|
@ -1127,7 +1126,7 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
const isObj = lineOfInterest.includes('{ angle = 3,')
|
|
|
|
const isObj = lineOfInterest.includes('{ angle = 3,')
|
|
|
|
test(`${lineOfInterest.split('(')[0]}${isObj ? '-[obj-input]' : ''}${
|
|
|
|
test(`${lineOfInterest.split('(')[0]}${isObj ? '-[obj-input]' : ''}${
|
|
|
|
doesHaveTagOutsideSketch ? '-[tagOutsideSketch]' : ''
|
|
|
|
doesHaveTagOutsideSketch ? '-[tagOutsideSketch]' : ''
|
|
|
|
}`, async ({ page, homePage }) => {
|
|
|
|
}`, async ({ page, editor, homePage }) => {
|
|
|
|
await page.addInitScript(
|
|
|
|
await page.addInitScript(
|
|
|
|
async ({ lineToBeDeleted, extraLine }) => {
|
|
|
|
async ({ lineToBeDeleted, extraLine }) => {
|
|
|
|
localStorage.setItem(
|
|
|
|
localStorage.setItem(
|
|
|
@ -1176,9 +1175,7 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
await page.mouse.move(hoverPos.x + x, hoverPos.y + y)
|
|
|
|
await page.mouse.move(hoverPos.x + x, hoverPos.y + y)
|
|
|
|
await page.mouse.move(hoverPos.x, hoverPos.y, { steps: 5 })
|
|
|
|
await page.mouse.move(hoverPos.x, hoverPos.y, { steps: 5 })
|
|
|
|
|
|
|
|
|
|
|
|
await expect(page.locator('.cm-content')).toContainText(
|
|
|
|
await editor.expectEditor.toContain(lineOfInterest, { shouldNormalise: true })
|
|
|
|
lineOfInterest
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await page.getByTestId('overlay-menu').click()
|
|
|
|
await page.getByTestId('overlay-menu').click()
|
|
|
|
await page.waitForTimeout(100)
|
|
|
|
await page.waitForTimeout(100)
|
|
|
@ -1189,9 +1186,7 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
await page.mouse.move(hoverPos.x + x, hoverPos.y + y)
|
|
|
|
await page.mouse.move(hoverPos.x + x, hoverPos.y + y)
|
|
|
|
await page.mouse.move(hoverPos.x, hoverPos.y, { steps: 5 })
|
|
|
|
await page.mouse.move(hoverPos.x, hoverPos.y, { steps: 5 })
|
|
|
|
|
|
|
|
|
|
|
|
await expect(page.locator('.cm-content')).toContainText(
|
|
|
|
await editor.expectEditor.toContain(lineOfInterest, { shouldNormalise: true })
|
|
|
|
lineOfInterest
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await page.getByTestId('overlay-menu').click()
|
|
|
|
await page.getByTestId('overlay-menu').click()
|
|
|
|
await page.waitForTimeout(100)
|
|
|
|
await page.waitForTimeout(100)
|
|
|
@ -1207,16 +1202,12 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
)
|
|
|
|
)
|
|
|
|
).toBeTruthy()
|
|
|
|
).toBeTruthy()
|
|
|
|
// eslint-disable-next-line jest/no-conditional-expect
|
|
|
|
// eslint-disable-next-line jest/no-conditional-expect
|
|
|
|
await expect(page.locator('.cm-content')).toContainText(
|
|
|
|
await editor.expectEditor.toContain(lineOfInterest, { shouldNormalise: true })
|
|
|
|
lineOfInterest
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// eslint-disable-next-line jest/no-conditional-expect
|
|
|
|
// eslint-disable-next-line jest/no-conditional-expect
|
|
|
|
await expect(page.locator('.cm-content')).not.toContainText(
|
|
|
|
await editor.expectEditor.not.toContain(lineOfInterest, { shouldNormalise: true })
|
|
|
|
lineOfInterest
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
// eslint-disable-next-line jest/no-conditional-expect
|
|
|
|
// eslint-disable-next-line jest/no-conditional-expect
|
|
|
|
await expect(page.locator('.cm-content')).not.toContainText('seg01')
|
|
|
|
await editor.expectEditor.not.toContain('seg01', { shouldNormalise: true })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1287,6 +1278,7 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
const isObj = before.includes('{ angle: 3')
|
|
|
|
const isObj = before.includes('{ angle: 3')
|
|
|
|
test(`${before.split('(')[0]}${isObj ? '-[obj-input]' : ''}`, async ({
|
|
|
|
test(`${before.split('(')[0]}${isObj ? '-[obj-input]' : ''}`, async ({
|
|
|
|
page,
|
|
|
|
page,
|
|
|
|
|
|
|
|
editor,
|
|
|
|
homePage,
|
|
|
|
homePage,
|
|
|
|
}) => {
|
|
|
|
}) => {
|
|
|
|
await page.addInitScript(
|
|
|
|
await page.addInitScript(
|
|
|
@ -1308,6 +1300,7 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
await page.setViewportSize({ width: 1200, height: 500 })
|
|
|
|
await page.setViewportSize({ width: 1200, height: 500 })
|
|
|
|
|
|
|
|
|
|
|
|
await homePage.goToModelingScene()
|
|
|
|
await homePage.goToModelingScene()
|
|
|
|
|
|
|
|
await u.waitForPageLoad()
|
|
|
|
await page.waitForTimeout(300)
|
|
|
|
await page.waitForTimeout(300)
|
|
|
|
|
|
|
|
|
|
|
|
await page.getByText(before).click()
|
|
|
|
await page.getByText(before).click()
|
|
|
@ -1340,14 +1333,16 @@ test.describe('Testing segment overlays', () => {
|
|
|
|
5,
|
|
|
|
5,
|
|
|
|
'[data-overlay-toolbar-index="0"]'
|
|
|
|
'[data-overlay-toolbar-index="0"]'
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
await page.mouse.move(x, y)
|
|
|
|
|
|
|
|
|
|
|
|
await expect(page.locator('.cm-content')).toContainText(before)
|
|
|
|
await editor.expectEditor.toContain(before, { shouldNormalise: true })
|
|
|
|
|
|
|
|
|
|
|
|
await page.getByTestId('overlay-menu').click()
|
|
|
|
await page.getByTestId('overlay-menu').click()
|
|
|
|
await page.waitForTimeout(100)
|
|
|
|
await page.waitForTimeout(100)
|
|
|
|
await page.getByText('Remove constraints').click()
|
|
|
|
await page.getByText('Remove constraints').click()
|
|
|
|
|
|
|
|
|
|
|
|
await expect(page.locator('.cm-content')).toContainText(after)
|
|
|
|
await editor.expectEditor.toContain(after, { shouldNormalise: true })
|
|
|
|
|
|
|
|
|
|
|
|
// check the cursor was left in the correct place after transform
|
|
|
|
// check the cursor was left in the correct place after transform
|
|
|
|
await expect(page.locator('.cm-activeLine')).toHaveText('|> ' + after)
|
|
|
|
await expect(page.locator('.cm-activeLine')).toHaveText('|> ' + after)
|
|
|
|
await expect(page.getByTestId('segment-overlay')).toHaveCount(3)
|
|
|
|
await expect(page.getByTestId('segment-overlay')).toHaveCount(3)
|
|
|
|