* WIP: experimenting with Loft UI Relates to #4470 * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Add selection guard * Working loft for two sketches in the right hardcoded order * First pass at handling more than 2 sketches * WIP selections * WIP selections * More checks * Appends the loft line after the 'last' sketch in the code * Clean up * Enable multiple selections after the button click * First point-click loft test (not working locally, loft gets inserted at the wrong place) * Lint * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * Clean up and working pw test * Add test for doesSceneHaveSweepableSketch with count = 2 * Clean up loftSketches function * Add pw test for preselected sketches * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Move to fromPromise-based Actor * Move error logic out of loftSketches, fix pw tests * Remove comments * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Fix typo * Revert snapshots * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger CI * WIP: initial shell code addition * Rollback pw values to pre cam change * WIP: more additions * WIP: closer * WIP: first time working shell mod * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * Add extrude lookup for more generic shell * Handle walls * Add pw tests for cap shell * Add shell wall test * Fix lint * Add selection guard and clean up * Lint fix * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * WIP mutliple faces * WIP circular dep * Lint * Look at this (photo)Graph *in the voice of Nickelback* * Trigger CI * Working multi-face shell across types * Cap and wall pw test * Apply suggestions from Frank's review Co-authored-by: Frank Noirot <frank@zoo.dev> * Fix test annotations * Add unit tests for doesSceneHaveExtrudedSketch * Manual resolution of snapshot conflicts * Fix assertParse * Updated pathToNode construct --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@zoo.dev>
95 lines
2.9 KiB
TypeScript
95 lines
2.9 KiB
TypeScript
import type { Page, Locator } from '@playwright/test'
|
|
import { expect } from './fixtureSetup'
|
|
import { doAndWaitForImageDiff } from '../test-utils'
|
|
|
|
export class ToolbarFixture {
|
|
public page: Page
|
|
|
|
extrudeButton!: Locator
|
|
loftButton!: Locator
|
|
shellButton!: Locator
|
|
offsetPlaneButton!: Locator
|
|
startSketchBtn!: Locator
|
|
lineBtn!: Locator
|
|
rectangleBtn!: Locator
|
|
exitSketchBtn!: Locator
|
|
editSketchBtn!: Locator
|
|
fileTreeBtn!: Locator
|
|
createFileBtn!: Locator
|
|
fileCreateToast!: Locator
|
|
filePane!: Locator
|
|
exeIndicator!: Locator
|
|
treeInputField!: Locator
|
|
|
|
constructor(page: Page) {
|
|
this.page = page
|
|
this.reConstruct(page)
|
|
}
|
|
reConstruct = (page: Page) => {
|
|
this.page = page
|
|
this.extrudeButton = page.getByTestId('extrude')
|
|
this.loftButton = page.getByTestId('loft')
|
|
this.shellButton = page.getByTestId('shell')
|
|
this.offsetPlaneButton = page.getByTestId('plane-offset')
|
|
this.startSketchBtn = page.getByTestId('sketch')
|
|
this.lineBtn = page.getByTestId('line')
|
|
this.rectangleBtn = page.getByTestId('corner-rectangle')
|
|
this.exitSketchBtn = page.getByTestId('sketch-exit')
|
|
this.editSketchBtn = page.getByText('Edit Sketch')
|
|
this.fileTreeBtn = page.locator('[id="files-button-holder"]')
|
|
this.createFileBtn = page.getByTestId('create-file-button')
|
|
this.treeInputField = page.getByTestId('tree-input-field')
|
|
|
|
this.filePane = page.locator('#files-pane')
|
|
this.fileCreateToast = page.getByText('Successfully created')
|
|
this.exeIndicator = page.getByTestId('model-state-indicator-execution-done')
|
|
}
|
|
|
|
startSketchPlaneSelection = async () =>
|
|
doAndWaitForImageDiff(this.page, () => this.startSketchBtn.click(), 500)
|
|
|
|
editSketch = async () => {
|
|
await this.editSketchBtn.first().click()
|
|
// One of the rare times we want to allow a arbitrary wait
|
|
// this is for the engine animation, as it takes 500ms to complete
|
|
await this.page.waitForTimeout(600)
|
|
}
|
|
|
|
private _serialiseFileTree = async () => {
|
|
return this.page
|
|
.locator('#files-pane')
|
|
.getByTestId('file-tree-item')
|
|
.allInnerTexts()
|
|
}
|
|
/**
|
|
* TODO folders, in expect state
|
|
*/
|
|
expectFileTreeState = async (expected: string[]) => {
|
|
await expect.poll(this._serialiseFileTree).toEqual(expected)
|
|
}
|
|
createFile = async (args: {
|
|
fileName: string
|
|
waitForToastToDisappear: boolean
|
|
}) => {
|
|
await this.createFileBtn.click()
|
|
await this.treeInputField.fill(args.fileName)
|
|
await this.treeInputField.press('Enter')
|
|
await expect(this.fileCreateToast).toBeVisible()
|
|
if (args.waitForToastToDisappear) {
|
|
await this.fileCreateToast.waitFor({ state: 'detached' })
|
|
}
|
|
}
|
|
/**
|
|
* Opens file by it's name and waits for execution to finish
|
|
*/
|
|
openFile = async (
|
|
fileName: string,
|
|
{ wait }: { wait?: boolean } = { wait: true }
|
|
) => {
|
|
await this.filePane.getByText(fileName).click()
|
|
if (wait) {
|
|
await expect(this.exeIndicator).toBeVisible({ timeout: 15_000 })
|
|
}
|
|
}
|
|
}
|