Only show "Edit sketch" button when code pane is focused with sketch selected (#5691)

* Only show "Edit sketch" button when code pane is focused with sketch selected

Closes #4273. WIP until tests are updated, since this will impact many
that look for the "Edit sketch" button.

* Start removing "edit sketch" point-and-click from E2E

* Update more E2E tests

* Update more tests that assumed Edit Sketch button

* A snapshot a day keeps the bugs away! 📷🐛

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Frank Noirot
2025-03-20 13:10:28 -04:00
committed by GitHub
parent 612d03bf73
commit b36e416ab2
10 changed files with 61 additions and 47 deletions

View File

@ -12,6 +12,7 @@ import {
} from './test-utils'
import { uuidv4, roundOff } from 'lib/utils'
import { SceneFixture } from './fixtures/sceneFixture'
import { ToolbarFixture } from './fixtures/toolbarFixture'
import { CmdBarFixture } from './fixtures/cmdBarFixture'
test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
@ -193,6 +194,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
homePage: HomePageFixture,
openPanes: string[],
scene: SceneFixture,
toolbar: ToolbarFixture,
cmdBar: CmdBarFixture
) => {
// Load the app with the code panes
@ -282,11 +284,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
// Select the sketch
await page.mouse.click(700, 370)
}
await expect(
page.getByRole('button', { name: 'Edit Sketch' })
).toBeVisible()
await page.getByRole('button', { name: 'Edit Sketch' }).click()
await page.waitForTimeout(400)
await toolbar.editSketch()
if (openPanes.includes('code')) {
prevContent = await page.locator('.cm-content').innerText()
}
@ -417,7 +415,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
test(
'code pane open at start-handles',
{ tag: ['@skipWin'] },
async ({ page, homePage, scene, cmdBar }) => {
async ({ page, homePage, scene, toolbar, cmdBar }) => {
// Load the app with the code panes
await page.addInitScript(async () => {
localStorage.setItem(
@ -435,6 +433,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
homePage,
['code'],
scene,
toolbar,
cmdBar
)
}
@ -443,7 +442,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
test(
'code pane closed at start-handles',
{ tag: ['@skipWin'] },
async ({ page, homePage, scene, cmdBar }) => {
async ({ page, homePage, scene, toolbar, cmdBar }) => {
// Load the app with the code panes
await page.addInitScript(async (persistModelingContext) => {
localStorage.setItem(
@ -451,7 +450,14 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
JSON.stringify({ openPanes: [] })
)
}, PERSIST_MODELING_CONTEXT)
await doEditSegmentsByDraggingHandle(page, homePage, [], scene, cmdBar)
await doEditSegmentsByDraggingHandle(
page,
homePage,
[],
scene,
toolbar,
cmdBar
)
}
)
})
@ -2545,7 +2551,7 @@ profile002 = startProfileAt([85.81, 52.55], sketch002)
const [startProfileAt] = scene.makeMouseHelpers(606, 184)
const [nextPoint] = scene.makeMouseHelpers(763, 130)
await page.getByText('startProfileAt([85.81, 52.55], sketch002)').click()
await toolbar.editSketch()
await toolbar.editSketch(1)
// timeout wait for engine animation is unavoidable
await page.waitForTimeout(600)
@ -2765,7 +2771,7 @@ extrude003 = extrude(profile011, length = 2.5)
await test.step(title, async () => {
await camPositionForSelectingSketchOnWallProfiles()
await selectClick()
await toolbar.editSketch()
await toolbar.editSketch(1)
await page.waitForTimeout(600)
await verifyWallProfilesAreDrawn()
await toolbar.exitSketchBtn.click()