Skip to content

Commit 291c5d9

Browse files
authored
E2E tests: remove some, remove pixel checks and pixel-based clicks from some (#7960)
1 parent f6a37a8 commit 291c5d9

21 files changed

+445
-1676
lines changed

e2e/playwright/boolean.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ test.describe('Point and click for boolean workflows', () => {
4747
}, file)
4848
await homePage.goToModelingScene()
4949
await scene.settled(cmdBar)
50+
await toolbar.closePane('code')
5051

5152
// Test coordinates for selection - these might need adjustment based on actual scene layout
5253
const cylinderPoint = { x: 592, y: 174 }
@@ -114,6 +115,8 @@ test.describe('Point and click for boolean workflows', () => {
114115

115116
await cmdBar.submit()
116117
await scene.settled(cmdBar)
118+
await editor.openPane()
119+
await editor.scrollToText(operation.code)
117120
await editor.expectEditor.toContain(operation.code)
118121
})
119122

@@ -126,7 +129,6 @@ test.describe('Point and click for boolean workflows', () => {
126129
await toolbar.closePane('feature-tree')
127130

128131
// Expect changes in ft and code
129-
await toolbar.openPane('code')
130132
await editor.expectEditor.not.toContain(operation.code)
131133
await expect(
132134
await toolbar.getFeatureTreeOperation(operationName, 0)

e2e/playwright/editor-tests.spec.ts

Lines changed: 5 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,7 @@ sketch001 = startSketchOn(XZ)
13311331
test(
13321332
`Can import a local OBJ file`,
13331333
{ tag: '@desktop' },
1334-
async ({ page, context }, testInfo) => {
1334+
async ({ page, context, scene, cmdBar }, testInfo) => {
13351335
await context.folderSetupFn(async (dir) => {
13361336
const bracketDir = join(dir, 'cube')
13371337
await fsp.mkdir(bracketDir, { recursive: true })
@@ -1348,66 +1348,19 @@ sketch001 = startSketchOn(XZ)
13481348
// Locators and constants
13491349
const u = await getUtils(page)
13501350
const projectLink = page.getByRole('link', { name: 'cube' })
1351-
const gizmo = page.locator('[aria-label*=gizmo]')
1352-
const resetCameraButton = page.getByRole('button', { name: 'Reset view' })
1353-
const locationToHaveColor = async (
1354-
position: { x: number; y: number },
1355-
color: [number, number, number]
1356-
) => {
1357-
return u.getGreatestPixDiff(position, color)
1358-
}
1359-
const notTheOrigin = {
1360-
x: viewportSize.width * 0.55,
1361-
y: viewportSize.height * 0.3,
1362-
}
1363-
const origin = { x: viewportSize.width / 2, y: viewportSize.height / 2 }
13641351
const errorIndicators = page.locator('.cm-lint-marker-error')
13651352

1366-
await test.step(`Open the empty file, see the default planes`, async () => {
1353+
await test.step(`Open the empty file`, async () => {
13671354
await projectLink.click()
1368-
await u.waitForPageLoad()
1369-
await expect
1370-
.poll(
1371-
async () =>
1372-
locationToHaveColor(notTheOrigin, TEST_COLORS.DARK_MODE_PLANE_XZ),
1373-
{
1374-
timeout: 5000,
1375-
message: 'XZ plane color is visible',
1376-
}
1377-
)
1378-
.toBeLessThan(15)
1355+
await scene.settled(cmdBar)
13791356
})
13801357
await test.step(`Write the import function line`, async () => {
13811358
await u.codeLocator.fill(`import 'cube.obj'\ncube`)
13821359
await page.waitForTimeout(800)
13831360
})
1384-
await test.step(`Reset the camera before checking`, async () => {
1385-
await u.doAndWaitForCmd(async () => {
1386-
await gizmo.click({ button: 'right' })
1387-
await resetCameraButton.click()
1388-
}, 'zoom_to_fit')
1389-
})
1390-
await test.step(`Verify that we see the imported geometry and no errors`, async () => {
1361+
await test.step(`Verify that we see no errors`, async () => {
1362+
await scene.settled(cmdBar)
13911363
await expect(errorIndicators).toHaveCount(0)
1392-
await expect
1393-
.poll(
1394-
async () =>
1395-
locationToHaveColor(origin, TEST_COLORS.DARK_MODE_PLANE_XZ),
1396-
{
1397-
timeout: 3000,
1398-
message: 'Plane color should not be visible',
1399-
}
1400-
)
1401-
.toBeGreaterThan(15)
1402-
await expect
1403-
.poll(
1404-
async () => locationToHaveColor(origin, TEST_COLORS.DARK_MODE_BKGD),
1405-
{
1406-
timeout: 3000,
1407-
message: 'Background color should not be visible',
1408-
}
1409-
)
1410-
.toBeGreaterThan(15)
14111364
})
14121365
}
14131366
)

e2e/playwright/file-tree.spec.ts

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ test.describe('integrations tests', () => {
1414
test(
1515
'Creating a new file or switching file while in sketchMode should exit sketchMode',
1616
{ tag: '@desktop' },
17-
async ({ page, context, homePage, scene, editor, toolbar, cmdBar }) => {
17+
async ({ page, context, homePage, scene, toolbar, cmdBar }) => {
1818
await context.folderSetupFn(async (dir) => {
1919
const bracketDir = join(dir, 'test-sample')
2020
await fsp.mkdir(bracketDir, { recursive: true })
@@ -24,8 +24,6 @@ test.describe('integrations tests', () => {
2424
)
2525
})
2626

27-
const [clickObj] = scene.makeMouseHelpers(726, 272)
28-
2927
await test.step('setup test', async () => {
3028
await homePage.expectState({
3129
projectCards: [
@@ -37,27 +35,15 @@ test.describe('integrations tests', () => {
3735
sortBy: 'last-modified-desc',
3836
})
3937
await homePage.openProject('test-sample')
40-
})
41-
await test.step('enter sketch mode', async () => {
4238
await scene.connectionEstablished()
4339
await scene.settled(cmdBar)
44-
await clickObj()
45-
await page.waitForTimeout(1000)
46-
await scene.moveNoWhere()
47-
await editor.expectState({
48-
activeLines: [
49-
'|>startProfile(at=[75.8,317.2])//[$startCapTag,$EndCapTag]',
50-
],
51-
highlightedCode: '',
52-
diagnostics: [],
53-
})
54-
await toolbar.editSketch()
55-
await expect(toolbar.exitSketchBtn).toBeVisible()
5640
})
5741

42+
await toolbar.editSketch()
43+
5844
const fileName = 'Untitled.kcl'
5945
await test.step('check sketch mode is exited when creating new file', async () => {
60-
await toolbar.fileTreeBtn.click()
46+
await toolbar.openPane('files')
6147
await toolbar.expectFileTreeState(['main.kcl'])
6248

6349
await toolbar.createFile({ fileName, waitForToastToDisappear: true })
@@ -69,19 +55,7 @@ test.describe('integrations tests', () => {
6955
await test.step('setup for next assertion', async () => {
7056
await toolbar.openFile('main.kcl')
7157
await page.waitForTimeout(2000)
72-
await clickObj()
73-
await page.waitForTimeout(1000)
74-
await scene.moveNoWhere()
75-
await page.waitForTimeout(1000)
76-
await editor.expectState({
77-
activeLines: [
78-
'|>startProfile(at=[75.8,317.2])//[$startCapTag,$EndCapTag]',
79-
],
80-
highlightedCode: '',
81-
diagnostics: [],
82-
})
8358
await toolbar.editSketch()
84-
await expect(toolbar.exitSketchBtn).toBeVisible()
8559
await toolbar.expectFileTreeState(['main.kcl', fileName])
8660
})
8761
await test.step('check sketch mode is exited when opening a different file', async () => {

e2e/playwright/fixtures/editorFixture.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class EditorFixture {
2020
private paneButtonTestId = 'code-pane-button'
2121
private diagnosticsTooltip!: Locator
2222
private diagnosticsGutterIcon!: Locator
23-
private codeContent!: Locator
23+
public codeContent!: Locator
2424
public activeLine!: Locator
2525

2626
constructor(page: Page) {

0 commit comments

Comments
 (0)