-
Notifications
You must be signed in to change notification settings - Fork 380
Expand file tree
/
Copy pathstop.spec.ts
More file actions
57 lines (47 loc) · 1.67 KB
/
stop.spec.ts
File metadata and controls
57 lines (47 loc) · 1.67 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
import path from 'path'
import { startVSCode, SUSHI_SOURCE_PATH } from './utils'
import os from 'os'
import { test } from '@playwright/test'
import fs from 'fs-extra'
test('Stop server works', async () => {
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'vscode-test-sushi-'))
await fs.copy(SUSHI_SOURCE_PATH, tempDir)
try {
const { window, close } = await startVSCode(tempDir)
// Wait for the models folder to be visible
await window.waitForSelector('text=models')
// Click on the models folder, excluding external_models
await window
.getByRole('treeitem', { name: 'models', exact: true })
.locator('a')
.click()
// Open the customer_revenue_lifetime model
await window
.getByRole('treeitem', { name: 'customers.sql', exact: true })
.locator('a')
.click()
await window.waitForSelector('text=grain')
await window.waitForSelector('text=Loaded SQLMesh Context')
// Stop the server
await window.keyboard.press(
process.platform === 'darwin' ? 'Meta+Shift+P' : 'Control+Shift+P',
)
await window.keyboard.type('SQLMesh: Stop Server')
await window.keyboard.press('Enter')
// Await LSP server stopped message
await window.waitForSelector('text=LSP server stopped')
// Render the model
await window.keyboard.press(
process.platform === 'darwin' ? 'Meta+Shift+P' : 'Control+Shift+P',
)
await window.keyboard.type('Render Model')
await window.keyboard.press('Enter')
// Await error message
await window.waitForSelector(
'text="Failed to render model: LSP client not ready."',
)
await close()
} finally {
await fs.remove(tempDir)
}
})