Go back to fix up sketch-tests test

This commit is contained in:
49lf
2024-11-21 12:00:32 -05:00
parent 634cd3c5da
commit b1616f9c6b
5 changed files with 1807 additions and 1893 deletions

File diff suppressed because it is too large Load Diff

View File

@ -416,6 +416,10 @@ export async function getUtils(page: Page, test_?: typeof test) {
.boundingBox({ timeout: 5_000 })
.then((box) => ({ ...box, x: box?.x || 0, y: box?.y || 0 })),
codeLocator: page.locator('.cm-content'),
crushKclCodeIntoOneLineAndThenMaybeSome: async () => {
const code = await page.locator('.cm-content').innerText()
return code.replaceAll(' ', '').replaceAll("\n", '')
},
normalisedEditorCode: async () => {
const code = await page.locator('.cm-content').innerText()
return normaliseKclNumbers(code)

File diff suppressed because it is too large Load Diff

View File

@ -5,10 +5,6 @@ import { Coords2d } from 'lang/std/sketch'
import { KCL_DEFAULT_LENGTH } from 'lib/constants'
import { uuidv4 } from 'lib/utils'
test.describe('Testing selections', () => {
test.setTimeout(90_000)
test('Selections work on fresh and edited sketch', { tag: ['@skipWin'] }, async ({ page, homePage }) => { // Skip on windows its being weird.

37
to-electron.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/sh
FILE="$1"
sg run --update-all \
--pattern 'await $_A.waitForAuthSkipAppStart()' \
--rewrite 'await homePage.goToModelingScene()' \
"$FILE"
sg --update-all \
--pattern 'test($DESC, async ({ page, $$$ARGS }) => { $$$BODY })' \
--rewrite 'test($DESC, async ({ page, $$$ARGS homePage }) => { $$$BODY })' \
"$FILE"
sg --update-all \
--pattern 'test($DESC, async ({ page }) => { $$$BODY })' \
--rewrite 'test($DESC, async ({ page, homePage }) => { $$$BODY })' \
"$FILE"
sg --update-all \
--pattern 'test($DESC, $OPT, async ({ page }) => { $$$BODY })' \
--rewrite 'test($DESC, $OPT, async ({ page, homePage }) => { $$$BODY })' \
"$FILE"
sg --update-all --pattern 'test.beforeEach($$$)' --rewrite '' "$FILE"
sg --update-all --pattern 'test.afterEach($$$)' --rewrite '' "$FILE"
# Unfortunately some tests are tied to the viewport size.
# sg --update-all --pattern 'await page.setViewportSize($$$ARGS)' --rewrite '' "$FILE"
sg --update-all --pattern "await page.goto('/')" --rewrite '' "$FILE"
sg --update-all --pattern 'await page.setViewportSize($$$ARGS)' --rewrite 'await page.setBodyDimensions($$$ARGS)' "$FILE"
sed -i -e 's/@playwright\/test/.\/zoo-test/' "$FILE"
sed -i -e 's/, setup, tearDown,//' "$FILE"
sed -i -e 's/setup, tearDown,//' "$FILE"
sed -i -e 's/setup, tearDown//' "$FILE"