diff --git a/e2e/playwright/editor-tests.spec.ts b/e2e/playwright/editor-tests.spec.ts index a6c5d68b51..b2baf1542c 100644 --- a/e2e/playwright/editor-tests.spec.ts +++ b/e2e/playwright/editor-tests.spec.ts @@ -714,17 +714,15 @@ test.describe('Editor tests', () => { |> close(%)`) }) - // failing for the same reason as "Can edit a sketch that has been extruded in the same pipe" - // please fix together - test.fixme('Can undo a sketch modification with ctrl+z', async ({ page }) => { + test('Can undo a sketch modification with ctrl+z', async ({ page }) => { const u = await getUtils(page) await page.addInitScript(async () => { localStorage.setItem( 'persistCode', `const sketch001 = startSketchOn('XZ') - |> startProfileAt([4.61, -14.01], %) + |> startProfileAt([4.61, -10.01], %) |> line([12.73, -0.09], %) - |> tangentialArcTo([24.95, -5.38], %) + |> tangentialArcTo([24.95, -0.38], %) |> close(%) |> extrude(5, %)` ) @@ -759,11 +757,11 @@ test.describe('Editor tests', () => { }) await page.waitForTimeout(100) - const startPX = [665, 458] + const startPX = [665, 397] const dragPX = 40 - await page.getByText('startProfileAt([4.61, -14.01], %)').click() + await page.getByText('startProfileAt([4.61, -10.01], %)').click() await expect( page.getByRole('button', { name: 'Edit Sketch' }) ).toBeVisible() @@ -801,7 +799,7 @@ test.describe('Editor tests', () => { // drag tangentialArcTo handle const tangentEnd = await u.getBoundingBox('[data-overlay-index="1"]') await page.dragAndDrop('#stream', '#stream', { - sourcePosition: { x: tangentEnd.x, y: tangentEnd.y - 5 }, + sourcePosition: { x: tangentEnd.x + 10, y: tangentEnd.y - 5 }, targetPosition: { x: tangentEnd.x + dragPX, y: tangentEnd.y + dragPX, @@ -813,12 +811,12 @@ test.describe('Editor tests', () => { // expect the code to have changed await expect(page.locator('.cm-content')) .toHaveText(`const sketch001 = startSketchOn('XZ') - |> startProfileAt([7.12, -16.82], %) - |> line([15.4, -2.74], %) - |> tangentialArcTo([24.95, -5.38], %) - |> line([2.65, -2.69], %) - |> close(%) - |> extrude(5, %)`) + |> startProfileAt([7.12, -12.68], %) + |> line([15.39, -2.78], %) + |> tangentialArcTo([27.6, -3.05], %) + |> close(%) + |> extrude(5, %) +`) // Hit undo await page.keyboard.down('Control') @@ -827,11 +825,11 @@ test.describe('Editor tests', () => { await expect(page.locator('.cm-content')) .toHaveText(`const sketch001 = startSketchOn('XZ') - |> startProfileAt([7.12, -16.82], %) - |> line([15.4, -2.74], %) - |> tangentialArcTo([24.95, -5.38], %) - |> close(%) - |> extrude(5, %)`) + |> startProfileAt([7.12, -12.68], %) + |> line([15.39, -2.78], %) + |> tangentialArcTo([24.95, -0.38], %) + |> close(%) + |> extrude(5, %)`) // Hit undo again. await page.keyboard.down('Control') @@ -840,11 +838,12 @@ test.describe('Editor tests', () => { await expect(page.locator('.cm-content')) .toHaveText(`const sketch001 = startSketchOn('XZ') - |> startProfileAt([7.12, -16.82], %) - |> line([12.73, -0.09], %) - |> tangentialArcTo([24.95, -5.38], %) - |> close(%) - |> extrude(5, %)`) + |> startProfileAt([7.12, -12.68], %) + |> line([12.73, -0.09], %) + |> tangentialArcTo([24.95, -0.38], %) + |> close(%) + |> extrude(5, %) +`) // Hit undo again. await page.keyboard.down('Control') @@ -854,9 +853,9 @@ test.describe('Editor tests', () => { await page.waitForTimeout(100) await expect(page.locator('.cm-content')) .toHaveText(`const sketch001 = startSketchOn('XZ') - |> startProfileAt([4.61, -14.01], %) + |> startProfileAt([4.61, -10.01], %) |> line([12.73, -0.09], %) - |> tangentialArcTo([24.95, -5.38], %) + |> tangentialArcTo([24.95, -0.38], %) |> close(%) |> extrude(5, %)`) }) diff --git a/e2e/playwright/sketch-tests.spec.ts b/e2e/playwright/sketch-tests.spec.ts index e2e1dd8ecd..0d15c7dd14 100644 --- a/e2e/playwright/sketch-tests.spec.ts +++ b/e2e/playwright/sketch-tests.spec.ts @@ -344,111 +344,108 @@ test.describe('Sketch tests', () => { }) }) - // failing for the same reason as "Can undo a sketch modification with ctrl+z" - // please fix together - test.fixme( - 'Can edit a sketch that has been extruded in the same pipe', - async ({ page }) => { - const u = await getUtils(page) - await page.addInitScript(async () => { - localStorage.setItem( - 'persistCode', - `const sketch001 = startSketchOn('XZ') - |> startProfileAt([4.61, -14.01], %) + test('Can edit a sketch that has been extruded in the same pipe', async ({ + page, + }) => { + const u = await getUtils(page) + await page.addInitScript(async () => { + localStorage.setItem( + 'persistCode', + `const sketch001 = startSketchOn('XZ') + |> startProfileAt([4.61, -10.01], %) |> line([12.73, -0.09], %) - |> tangentialArcTo([24.95, -5.38], %) + |> tangentialArcTo([24.95, -0.38], %) |> close(%) |> extrude(5, %)` - ) - }) + ) + }) - await page.setViewportSize({ width: 1200, height: 500 }) + await page.setViewportSize({ width: 1200, height: 500 }) - await u.waitForAuthSkipAppStart() - await expect( - page.getByRole('button', { name: 'Start Sketch' }) - ).not.toBeDisabled() + await u.waitForAuthSkipAppStart() + await expect( + page.getByRole('button', { name: 'Start Sketch' }) + ).not.toBeDisabled() - await page.waitForTimeout(100) - await u.openAndClearDebugPanel() - await u.sendCustomCmd({ - type: 'modeling_cmd_req', - cmd_id: uuidv4(), - cmd: { - type: 'default_camera_look_at', - vantage: { x: 0, y: -1250, z: 580 }, - center: { x: 0, y: 0, z: 0 }, - up: { x: 0, y: 0, z: 1 }, - }, - }) - await page.waitForTimeout(100) - await u.sendCustomCmd({ - type: 'modeling_cmd_req', - cmd_id: uuidv4(), - cmd: { - type: 'default_camera_get_settings', - }, - }) - await page.waitForTimeout(100) + await page.waitForTimeout(100) + await u.openAndClearDebugPanel() + await u.sendCustomCmd({ + type: 'modeling_cmd_req', + cmd_id: uuidv4(), + cmd: { + type: 'default_camera_look_at', + vantage: { x: 0, y: -1250, z: 580 }, + center: { x: 0, y: 0, z: 0 }, + up: { x: 0, y: 0, z: 1 }, + }, + }) + await page.waitForTimeout(100) + await u.sendCustomCmd({ + type: 'modeling_cmd_req', + cmd_id: uuidv4(), + cmd: { + type: 'default_camera_get_settings', + }, + }) + await page.waitForTimeout(100) - const startPX = [665, 458] + const startPX = [665, 397] - const dragPX = 40 + const dragPX = 40 - await page.getByText('startProfileAt([4.61, -14.01], %)').click() - await expect( - page.getByRole('button', { name: 'Edit Sketch' }) - ).toBeVisible() - await page.getByRole('button', { name: 'Edit Sketch' }).click() - await page.waitForTimeout(400) - let prevContent = await page.locator('.cm-content').innerText() + await page.getByText('startProfileAt([4.61, -10.01], %)').click() + await expect( + page.getByRole('button', { name: 'Edit Sketch' }) + ).toBeVisible() + await page.getByRole('button', { name: 'Edit Sketch' }).click() + await page.waitForTimeout(400) + let prevContent = await page.locator('.cm-content').innerText() - await expect(page.getByTestId('segment-overlay')).toHaveCount(2) + await expect(page.getByTestId('segment-overlay')).toHaveCount(2) - // drag startProfieAt handle - await page.dragAndDrop('#stream', '#stream', { - sourcePosition: { x: startPX[0], y: startPX[1] }, - targetPosition: { x: startPX[0] + dragPX, y: startPX[1] + dragPX }, - }) - await page.waitForTimeout(100) - await expect(page.locator('.cm-content')).not.toHaveText(prevContent) - prevContent = await page.locator('.cm-content').innerText() + // drag startProfieAt handle + await page.dragAndDrop('#stream', '#stream', { + sourcePosition: { x: startPX[0], y: startPX[1] }, + targetPosition: { x: startPX[0] + dragPX, y: startPX[1] + dragPX }, + }) + await page.waitForTimeout(100) + await expect(page.locator('.cm-content')).not.toHaveText(prevContent) + prevContent = await page.locator('.cm-content').innerText() - // drag line handle - await page.waitForTimeout(100) + // drag line handle + await page.waitForTimeout(100) - const lineEnd = await u.getBoundingBox('[data-overlay-index="0"]') - await page.waitForTimeout(100) - await page.dragAndDrop('#stream', '#stream', { - sourcePosition: { x: lineEnd.x - 5, y: lineEnd.y }, - targetPosition: { x: lineEnd.x + dragPX, y: lineEnd.y + dragPX }, - }) - await expect(page.locator('.cm-content')).not.toHaveText(prevContent) - prevContent = await page.locator('.cm-content').innerText() + const lineEnd = await u.getBoundingBox('[data-overlay-index="0"]') + await page.waitForTimeout(100) + await page.dragAndDrop('#stream', '#stream', { + sourcePosition: { x: lineEnd.x - 5, y: lineEnd.y }, + targetPosition: { x: lineEnd.x + dragPX, y: lineEnd.y + dragPX }, + }) + await expect(page.locator('.cm-content')).not.toHaveText(prevContent) + prevContent = await page.locator('.cm-content').innerText() - // drag tangentialArcTo handle - const tangentEnd = await u.getBoundingBox('[data-overlay-index="1"]') - await page.dragAndDrop('#stream', '#stream', { - sourcePosition: { x: tangentEnd.x, y: tangentEnd.y - 5 }, - targetPosition: { - x: tangentEnd.x + dragPX, - y: tangentEnd.y + dragPX, - }, - }) - await page.waitForTimeout(100) - await expect(page.locator('.cm-content')).not.toHaveText(prevContent) + // drag tangentialArcTo handle + const tangentEnd = await u.getBoundingBox('[data-overlay-index="1"]') + await page.dragAndDrop('#stream', '#stream', { + sourcePosition: { x: tangentEnd.x + 10, y: tangentEnd.y - 5 }, + targetPosition: { + x: tangentEnd.x + dragPX, + y: tangentEnd.y + dragPX, + }, + }) + await page.waitForTimeout(100) + await expect(page.locator('.cm-content')).not.toHaveText(prevContent) - // expect the code to have changed - await expect(page.locator('.cm-content')) - .toHaveText(`const sketch001 = startSketchOn('XZ') - |> startProfileAt([7.12, -16.82], %) - |> line([15.4, -2.74], %) - |> tangentialArcTo([24.95, -5.38], %) - |> line([2.65, -2.69], %) - |> close(%) - |> extrude(5, %)`) - } - ) + // expect the code to have changed + await expect(page.locator('.cm-content')) + .toHaveText(`const sketch001 = startSketchOn('XZ') + |> startProfileAt([7.12, -12.68], %) + |> line([15.39, -2.78], %) + |> tangentialArcTo([27.6, -3.05], %) + |> close(%) + |> extrude(5, %) +`) + }) test('Can edit a sketch that has been revolved in the same pipe', async ({ page,