Skip to content

Commit b632fbd

Browse files
committed
temp
1 parent b4d1f03 commit b632fbd

File tree

15 files changed

+105
-127
lines changed

15 files changed

+105
-127
lines changed

.github/workflows/pr.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ concurrency:
1010
cancel-in-progress: true
1111
jobs:
1212
test-vscode:
13+
runs-on: ubuntu-latest
1314
env:
1415
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
15-
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v4
1818
- uses: actions/setup-node@v4
@@ -53,6 +53,7 @@ jobs:
5353
run: pnpm exec playwright install
5454
- name: Run e2e tests
5555
working-directory: ./vscode/extension
56+
timeout-minutes: 90
5657
run: |
5758
source ../../.venv/bin/activate
5859
pnpm run test:e2e

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ vscode/extension/out
2020
vscode/extension/src_react
2121
vscode/extension/tsconfig.tsbuildinfo
2222
vscode/extension/.vscode-test/
23+
vscode/extension/playwright-report/
24+
vscode/extension/test-results/
25+
vscode/extension/.test_setup
2326

2427
sqlmesh
2528
docs

vscode/extension/.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ node_modules
22
dist
33
out
44
.vscode-test
5+
.test_setup
56
*.vsix
67
LICENSE
78
src_react
8-
!src_react/.gitkeep
9+
!src_react/.gitkeep
10+
playwright-report

vscode/extension/.vscodeignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@ tsconfig.test.json
2424
tsconfig.build.json
2525
src/test/**
2626
tests/**
27-
.claude
27+
.claude
28+
.idea
29+
.test_setup
Binary file not shown.

vscode/extension/playwright-report/index.html

Lines changed: 0 additions & 77 deletions
This file was deleted.

vscode/extension/playwright.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import { defineConfig } from '@playwright/test'
33
export default defineConfig({
44
testDir: 'tests',
55
timeout: 60_000,
6+
// TODO: When stable, allow retries in CI
67
retries: process.env.CI ? 1 : 0,
7-
workers: 1,
8+
workers: 4,
89
reporter: [['html', { outputFolder: 'playwright-report' }], ['list']],
10+
globalSetup: './tests/global-setup.ts',
911
projects: [
1012
{
1113
name: 'electron-vscode',

vscode/extension/tests/broken_project.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,9 @@ test('working project, then broken through adding double model, then refixed', a
9292
.locator('a')
9393
.click()
9494
// Save to refresh the context
95-
await page.keyboard.press('Control+S')
96-
await page.keyboard.press('Meta+S')
95+
await page.keyboard.press(
96+
process.platform === 'darwin' ? 'Meta+S' : 'Control+S',
97+
)
9798

9899
// Wait for the error to appear
99100
// TODO: Selector doesn't work in the linage view
@@ -103,8 +104,9 @@ test('working project, then broken through adding double model, then refixed', a
103104
await fs.remove(path.join(tempDir, 'models', 'customers_duplicated.sql'))
104105

105106
// Save again to refresh the context
106-
await page.keyboard.press('Control+S')
107-
await page.keyboard.press('Meta+S')
107+
await page.keyboard.press(
108+
process.platform === 'darwin' ? 'Meta+S' : 'Control+S',
109+
)
108110

109111
// Wait for the error to go away and context to reload
110112
// TODO: Selector doesn't work in the linage view

vscode/extension/tests/format.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ test('Format project works correctly', async ({ page }) => {
3636
await page.waitForSelector('text=Loaded SQLMesh Context')
3737

3838
// Format the project
39-
await runCommand(page, 'Format SQLMesh Project')
39+
await runCommand(page, 'SQLMesh: Format Project')
4040

4141
// Check that the notification appears saying 'Project formatted successfully'
4242
await expect(
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { execSync } from 'child_process'
2+
import path from 'path'
3+
import fs from 'fs-extra'
4+
5+
async function globalSetup() {
6+
console.log('Setting up extension for Playwright tests...')
7+
8+
const extensionDir = path.join(__dirname, '..')
9+
const testSetupDir = path.join(extensionDir, '.test_setup')
10+
const extensionsDir = path.join(testSetupDir, 'extensions')
11+
12+
// Clean up any existing test setup directory
13+
await fs.remove(testSetupDir)
14+
await fs.ensureDir(extensionsDir)
15+
16+
// Get the extension version from package.json
17+
const packageJson = JSON.parse(
18+
fs.readFileSync(path.join(extensionDir, 'package.json'), 'utf-8'),
19+
)
20+
const version = packageJson.version
21+
const extensionName = packageJson.name || 'sqlmesh'
22+
23+
// Look for the specific version .vsix file
24+
const vsixFileName = `${extensionName}-${version}.vsix`
25+
const vsixPath = path.join(extensionDir, vsixFileName)
26+
27+
if (!fs.existsSync(vsixPath)) {
28+
throw new Error(
29+
`Extension file ${vsixFileName} not found. Run "pnpm run vscode:package" first.`,
30+
)
31+
}
32+
33+
console.log(`Installing extension: ${vsixFileName}`)
34+
35+
// Create a temporary user data directory for the installation
36+
const tempUserDataDir = await fs.mkdtemp(
37+
path.join(require('os').tmpdir(), 'vscode-test-install-user-data-'),
38+
)
39+
40+
try {
41+
execSync(
42+
`pnpm run code-server --user-data-dir "${tempUserDataDir}" --extensions-dir "${extensionsDir}" --install-extension "${vsixPath}"`,
43+
{
44+
stdio: 'inherit',
45+
cwd: extensionDir,
46+
},
47+
)
48+
console.log('Extension installed successfully to .test_setup/extensions')
49+
} finally {
50+
// Clean up temporary user data directory
51+
await fs.remove(tempUserDataDir)
52+
}
53+
}
54+
55+
export default globalSetup

0 commit comments

Comments
 (0)