Skip to content

Commit

Permalink
Revert multi-profile (#4812)
Browse files Browse the repository at this point in the history
* Revert "multi-profile follow up. (#4802)"

This reverts commit 2b2ed47.

* Revert "multi profile (#4532)"

This reverts commit 04e586d.

* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores)

* Re-run CI after snapshots

* Re-run CI after snapshots

* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores)

* Re-run CI after snapshots

* Add `fixme` to onboarding test

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
franknoirot and github-actions[bot] authored Dec 16, 2024
1 parent 49de3b0 commit efe8089
Show file tree
Hide file tree
Showing 63 changed files with 1,278 additions and 3,588 deletions.
27 changes: 10 additions & 17 deletions e2e/playwright/basic-sketch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,23 @@ async function doBasicSketch(page: Page, openPanes: string[]) {
const startXPx = 600
await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10)
if (openPanes.includes('code')) {
await expect(u.codeLocator).toContainText(
`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${commonPoints.startAt}, sketch001)`
)
await expect(u.codeLocator).toHaveText(`sketch001 = startSketchOn('XZ')
|> startProfileAt(${commonPoints.startAt}, %)`)
}
await page.waitForTimeout(500)
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 10)
await page.waitForTimeout(500)

if (openPanes.includes('code')) {
await expect(u.codeLocator)
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${commonPoints.startAt}, sketch001)
await expect(u.codeLocator).toHaveText(`sketch001 = startSketchOn('XZ')
|> startProfileAt(${commonPoints.startAt}, %)
|> xLine(${commonPoints.num1}, %)`)
}
await page.waitForTimeout(500)
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 20)
if (openPanes.includes('code')) {
await expect(u.codeLocator)
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${
commonPoints.startAt
}, sketch001)
await expect(u.codeLocator).toHaveText(`sketch001 = startSketchOn('XZ')
|> startProfileAt(${commonPoints.startAt}, %)
|> xLine(${commonPoints.num1}, %)
|> yLine(${commonPoints.num1 + 0.01}, %)`)
} else {
Expand All @@ -85,10 +82,8 @@ async function doBasicSketch(page: Page, openPanes: string[]) {
await page.waitForTimeout(200)
await page.mouse.click(startXPx, 500 - PUR * 20)
if (openPanes.includes('code')) {
await expect(u.codeLocator)
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${
commonPoints.startAt
}, sketch001)
await expect(u.codeLocator).toHaveText(`sketch001 = startSketchOn('XZ')
|> startProfileAt(${commonPoints.startAt}, %)
|> xLine(${commonPoints.num1}, %)
|> yLine(${commonPoints.num1 + 0.01}, %)
|> xLine(${commonPoints.num2 * -1}, %)`)
Expand Down Expand Up @@ -145,10 +140,8 @@ async function doBasicSketch(page: Page, openPanes: string[]) {

// Open the code pane.
await u.openKclCodePanel()
await expect(u.codeLocator)
.toHaveText(`sketch001 = startSketchOn('XZ')profile001 = startProfileAt(${
commonPoints.startAt
}, sketch001)
await expect(u.codeLocator).toHaveText(`sketch001 = startSketchOn('XZ')
|> startProfileAt(${commonPoints.startAt}, %)
|> xLine(${commonPoints.num1}, %, $seg01)
|> yLine(${commonPoints.num1 + 0.01}, %)
|> xLine(-segLen(seg01), %)`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ test.describe('Can create sketches on all planes and their back sides', () => {
},
}

const code = `sketch001 = startSketchOn('${plane}')profile001 = startProfileAt([0.9, -1.22], sketch001)`
const code = `sketch001 = startSketchOn('${plane}')
|> startProfileAt([0.9, -1.22], %)`

await u.openDebugPanel()

Expand Down
44 changes: 12 additions & 32 deletions e2e/playwright/fixtures/sceneFixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {

type mouseParams = {
pixelDiff?: number
shouldDbClick?: boolean
}
type mouseDragToParams = mouseParams & {
fromPoint: { x: number; y: number }
Expand Down Expand Up @@ -76,16 +75,11 @@ export class SceneFixture {
if (clickParams?.pixelDiff) {
return doAndWaitForImageDiff(
this.page,
() =>
clickParams?.shouldDbClick
? this.page.mouse.dblclick(x, y)
: this.page.mouse.click(x, y),
() => this.page.mouse.click(x, y),
clickParams.pixelDiff
)
}
return clickParams?.shouldDbClick
? this.page.mouse.dblclick(x, y)
: this.page.mouse.click(x, y)
return this.page.mouse.click(x, y)
},
(moveParams?: mouseParams) => {
if (moveParams?.pixelDiff) {
Expand Down Expand Up @@ -216,7 +210,7 @@ export class SceneFixture {
}

expectPixelColor = async (
colour: [number, number, number] | [number, number, number][],
colour: [number, number, number],
coords: { x: number; y: number },
diff: number
) => {
Expand All @@ -237,36 +231,22 @@ export class SceneFixture {
}
}

function isColourArray(
colour: [number, number, number] | [number, number, number][]
): colour is [number, number, number][] {
return Array.isArray(colour[0])
}

export async function expectPixelColor(
page: Page,
colour: [number, number, number] | [number, number, number][],
colour: [number, number, number],
coords: { x: number; y: number },
diff: number
) {
let finalValue = colour
await expect
.poll(
async () => {
const pixel = (await getPixelRGBs(page)(coords, 1))[0]
if (!pixel) return null
finalValue = pixel
if (!isColourArray(colour)) {
return pixel.every(
(channel, index) => Math.abs(channel - colour[index]) < diff
)
}
return colour.some((c) =>
c.every((channel, index) => Math.abs(pixel[index] - channel) < diff)
)
},
{ timeout: 10_000 }
)
.poll(async () => {
const pixel = (await getPixelRGBs(page)(coords, 1))[0]
if (!pixel) return null
finalValue = pixel
return pixel.every(
(channel, index) => Math.abs(channel - colour[index]) < diff
)
})
.toBeTruthy()
.catch((cause) => {
throw new Error(
Expand Down
15 changes: 0 additions & 15 deletions e2e/playwright/fixtures/toolbarFixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ export class ToolbarFixture {
offsetPlaneButton!: Locator
startSketchBtn!: Locator
lineBtn!: Locator
tangentialArcBtn!: Locator
circleBtn!: Locator
rectangleBtn!: Locator
lengthConstraintBtn!: Locator
exitSketchBtn!: Locator
editSketchBtn!: Locator
fileTreeBtn!: Locator
Expand All @@ -36,10 +33,7 @@ export class ToolbarFixture {
this.offsetPlaneButton = page.getByTestId('plane-offset')
this.startSketchBtn = page.getByTestId('sketch')
this.lineBtn = page.getByTestId('line')
this.tangentialArcBtn = page.getByTestId('tangential-arc')
this.circleBtn = page.getByTestId('circle-center')
this.rectangleBtn = page.getByTestId('corner-rectangle')
this.lengthConstraintBtn = page.getByTestId('constraint-length')
this.exitSketchBtn = page.getByTestId('sketch-exit')
this.editSketchBtn = page.getByText('Edit Sketch')
this.fileTreeBtn = page.locator('[id="files-button-holder"]')
Expand Down Expand Up @@ -97,13 +91,4 @@ export class ToolbarFixture {
await expect(this.exeIndicator).toBeVisible({ timeout: 15_000 })
}
}
selectCenterRectangle = async () => {
await this.page
.getByRole('button', { name: 'caret down Corner rectangle:' })
.click()
await expect(
this.page.getByTestId('dropdown-center-rectangle')
).toBeVisible()
await this.page.getByTestId('dropdown-center-rectangle').click()
}
}
2 changes: 1 addition & 1 deletion e2e/playwright/onboarding-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ test.describe('Onboarding tests', () => {
})
})

test(
test.fixme(
'Restarting onboarding on desktop takes one attempt',
{ tag: '@electron' },
async ({ browser: _ }, testInfo) => {
Expand Down
Loading

0 comments on commit efe8089

Please sign in to comment.