-
Notifications
You must be signed in to change notification settings - Fork 380
Expand file tree
/
Copy pathformat.spec.ts
More file actions
45 lines (37 loc) · 1.34 KB
/
format.spec.ts
File metadata and controls
45 lines (37 loc) · 1.34 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
import { test, expect } from './fixtures'
import path from 'path'
import fs from 'fs-extra'
import os from 'os'
import {
openServerPage,
runCommand,
SUSHI_SOURCE_PATH,
waitForLoadedSQLMesh,
} from './utils'
import { createPythonInterpreterSettingsSpecifier } from './utils_code_server'
test('Format project works correctly', async ({ page, sharedCodeServer }) => {
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'vscode-test-sushi-'))
await fs.copy(SUSHI_SOURCE_PATH, tempDir)
await createPythonInterpreterSettingsSpecifier(tempDir)
await openServerPage(page, tempDir, sharedCodeServer)
// Wait for the models folder to be visible
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 customer_revenue_lifetime model
await page
.getByRole('treeitem', { name: 'customers.sql', exact: true })
.locator('a')
.click()
await page.waitForSelector('text=grain')
await waitForLoadedSQLMesh(page)
// Format the project
await runCommand(page, 'SQLMesh: Format Project')
// Check that the notification appears saying 'Project formatted successfully'
await expect(
page.getByText('Project formatted successfully', { exact: true }),
).toBeVisible()
})