-
Notifications
You must be signed in to change notification settings - Fork 381
Expand file tree
/
Copy pathstop.spec.ts
More file actions
67 lines (54 loc) · 2.07 KB
/
stop.spec.ts
File metadata and controls
67 lines (54 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import path from 'path'
import { SUSHI_SOURCE_PATH } from './utils'
import os from 'os'
import { test } from '@playwright/test'
import fs from 'fs-extra'
import { startCodeServer, stopCodeServer } from './utils_code_server'
test('Stop server works', async ({ page }) => {
test.setTimeout(120000) // Increase timeout to 2 minutes
console.log('Starting test: Stop server works')
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'vscode-test-sushi-'))
await fs.copy(SUSHI_SOURCE_PATH, tempDir)
const context = await startCodeServer(tempDir, true)
try {
// Navigate to code-server instance
await page.goto(`http://127.0.0.1:${context.codeServerPort}`)
// Wait for code-server to load
await page.waitForLoadState('networkidle')
await page.waitForSelector('[role="application"]', { timeout: 10000 })
// Wait for the models folder to be visible in the file explorer
await page.waitForSelector('text=models')
// Click on the models folder, excluding external_models
await page
.getByRole('treeitem', { name: 'models', exact: true })
.locator('a')
.click()
// Open the customers.sql model
await page
.getByRole('treeitem', { name: 'customers.sql', exact: true })
.locator('a')
.click()
await page.waitForSelector('text=grain')
await page.waitForSelector('text=Loaded SQLMesh Context')
// Stop the server
await page.keyboard.press(
process.platform === 'darwin' ? 'Meta+Shift+P' : 'Control+Shift+P',
)
await page.keyboard.type('SQLMesh: Stop Server')
await page.keyboard.press('Enter')
// Await LSP server stopped message
await page.waitForSelector('text=LSP server stopped')
// Render the model
await page.keyboard.press(
process.platform === 'darwin' ? 'Meta+Shift+P' : 'Control+Shift+P',
)
await page.keyboard.type('Render Model')
await page.keyboard.press('Enter')
// Await error message
await page.waitForSelector(
'text="Failed to render model: LSP client not ready."',
)
} finally {
await stopCodeServer(context)
}
})