Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ rust/**/*.ts
!rust/kcl-language-server/client/src/**/*.ts
*.typegen.ts
packages/codemirror-lsp-client/dist/*
e2e/playwright/snapshots/prompt-to-edit/*
.vscode-test
4 changes: 2 additions & 2 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ jobs:
shell: bash
id: git-check
run: |
git add e2e/playwright/snapshot-tests.spec.ts-snapshots e2e/playwright/snapshots
git add e2e/playwright/snapshot-tests.spec.ts-snapshots
if git status | grep -q "Changes to be committed"
then echo "modified=true" >> $GITHUB_OUTPUT
else echo "modified=false" >> $GITHUB_OUTPUT
Expand All @@ -257,7 +257,7 @@ jobs:
if: ${{ false && needs.conditions.outputs.should-run == 'true' && steps.git-check.outputs.modified == 'true' }}
shell: bash
run: |
git add e2e/playwright/snapshot-tests.spec.ts-snapshots e2e/playwright/snapshots
git add e2e/playwright/snapshot-tests.spec.ts-snapshots
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
Expand Down
2 changes: 0 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ coverage
*.hbs
target
e2e/playwright/export-snapshots
e2e/playwright/snapshots/prompt-to-edit


# XState generated files
src/machines/**.typegen.ts
Expand Down
7 changes: 7 additions & 0 deletions e2e/playwright/feature-tree-pane.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import * as fsp from 'fs/promises'
import { join } from 'path'

import {
orRunWhenFullSuiteEnabled,
runningOnWindows,
} from '@e2e/playwright/test-utils'
import { expect, test } from '@e2e/playwright/zoo-test'

const FEATURE_TREE_EXAMPLE_CODE = `export fn timesFive(x) {
Expand Down Expand Up @@ -65,6 +69,9 @@ test.describe('Feature Tree pane', () => {
'User can go to definition and go to function definition',
{ tag: '@electron' },
async ({ context, homePage, scene, editor, toolbar, cmdBar, page }) => {
if (runningOnWindows()) {
test.fixme(orRunWhenFullSuiteEnabled())
}
await context.folderSetupFn(async (dir) => {
const bracketDir = join(dir, 'test-sample')
await fsp.mkdir(bracketDir, { recursive: true })
Expand Down
71 changes: 1 addition & 70 deletions e2e/playwright/fixtures/cmdBarFixture.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import type { Locator, Page, Request, Route, TestInfo } from '@playwright/test'
import type { Locator, Page } from '@playwright/test'
import { expect } from '@playwright/test'
import * as fs from 'fs'
import * as path from 'path'

type CmdBarSerialised =
| {
Expand Down Expand Up @@ -177,71 +175,4 @@ export class CmdBarFixture {
selectOption = (options: Parameters<typeof this.page.getByRole>[1]) => {
return this.page.getByRole('option', options)
}

/**
* Captures a snapshot of the request sent to the text-to-cad API endpoint
* and saves it to a file named after the current test.
*
* The snapshot file will be saved in the specified directory with a filename
* derived from the test's full path (including describe blocks).
*
* @param testInfoInOrderToGetTestTitle The TestInfo object from the test context
* @param customOutputDir Optional custom directory for the output file
*/
async captureTextToCadRequestSnapshot(
testInfoInOrderToGetTestTitle: TestInfo,
customOutputDir = 'e2e/playwright/snapshots/prompt-to-edit'
) {
// First sanitize each title component individually
const sanitizedTitleComponents = [
...testInfoInOrderToGetTestTitle.titlePath.slice(0, -1), // Get all parent titles
testInfoInOrderToGetTestTitle.title, // Add the test title
].map(
(component) =>
component
.replace(/[^a-z0-9]/gi, '-') // Replace non-alphanumeric chars with hyphens
.toLowerCase()
.replace(/-+/g, '-') // Replace multiple consecutive hyphens with a single one
.replace(/^-|-$/g, '') // Remove leading/trailing hyphens
)

// Join the sanitized components with -- as a clear separator
const sanitizedTestName = sanitizedTitleComponents.join('--')

// Create the output path
const outputPath = path.join(
customOutputDir,
`${sanitizedTestName}.snap.json`
)

// Create a handler function that saves request bodies to a file
const requestHandler = (route: Route, request: Request) => {
try {
const requestBody = request.postDataJSON()

// Ensure directory exists
const dir = path.dirname(outputPath)
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true })
}

// Write the request body to the file
fs.writeFileSync(outputPath, JSON.stringify(requestBody, null, 2))

console.log(`Saved text-to-cad API request to: ${outputPath}`)
} catch (error) {
console.error('Error processing text-to-cad request:', error)
}

// Use void to explicitly mark the promise as ignored
void route.continue()
}

// Start monitoring requests
await this.page.route('**/ml/text-to-cad/iteration', requestHandler)

console.log(
`Monitoring text-to-cad API requests. Output will be saved to: ${outputPath}`
)
}
}
100 changes: 0 additions & 100 deletions e2e/playwright/prompt-to-edit-snapshot-tests.spec.ts

This file was deleted.

This file was deleted.

This file was deleted.

Loading