Skip to content

Commit c200c71

Browse files
authored
chore(vscode): add an integration test for gtd (#4608)
1 parent 5285753 commit c200c71

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed

vscode/extension/tests/go_to_definition.spec.ts

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ test('Go to definition for macro', async () => {
1111
try {
1212
const { window, close } = await startVSCode(tempDir);
1313

14-
// Wait for the models folder to be visible
14+
// Wait for the models folder to be visible
1515
await window.waitForSelector('text=models');
1616

17-
// Click on the models folder, excluding external_models
17+
// Click on the models folder
1818
await window.getByRole('treeitem', { name: 'models', exact: true }).locator('a').click();
1919

2020
// Open the customer_revenue_lifetime model
@@ -24,7 +24,7 @@ test('Go to definition for macro', async () => {
2424
await window.waitForSelector('text=Loaded SQLMesh Context')
2525

2626
// Render the model
27-
window.locator("text=@MULTIPLY").click({
27+
await window.locator("text=@MULTIPLY").click({
2828
modifiers: ["Meta"]
2929
})
3030

@@ -35,4 +35,34 @@ test('Go to definition for macro', async () => {
3535
} finally {
3636
await fs.removeSync(tempDir);
3737
}
38-
});
38+
});
39+
40+
test("Go to definition for model", async () => {
41+
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'vscode-test-sushi-'));
42+
await fs.copy(SUSHI_SOURCE_PATH, tempDir);
43+
44+
try {
45+
const { window, close } = await startVSCode(tempDir);
46+
47+
// Wait for the models folder to be visible
48+
await window.waitForSelector('text=models');
49+
50+
// Click on the models folder
51+
await window.getByRole('treeitem', { name: 'models', exact: true }).locator('a').click();
52+
53+
// Open the top_waiters model
54+
await window.getByRole('treeitem', { name: 'top_waiters.sql', exact: true }).locator('a').click();
55+
56+
await window.waitForSelector('text=grain');
57+
await window.waitForSelector('text=Loaded SQLMesh Context')
58+
59+
// Go to definition for the model
60+
await window.locator("text=sushi.waiter_revenue_by_day").first().click({
61+
modifiers: ["Meta"]
62+
})
63+
await expect(window.locator('text=SUM(oi.quantity * i.price)::DOUBLE AS revenue')).toBeVisible();
64+
await close();
65+
} finally {
66+
await fs.removeSync(tempDir);
67+
}
68+
})

0 commit comments

Comments
 (0)