@@ -30,9 +30,85 @@ test('Render works correctly', async () => {
3030
3131 // Check if the model is rendered by check if "`oi`.`order_id` AS `order_id`," is in the window
3232 await expect ( window . locator ( 'text="marketing"."customer_id" AS' ) ) . toBeVisible ( ) ;
33+ await expect ( window . locator ( 'text=sushi.customers (rendered)' ) ) . toBeVisible ( ) ;
3334
3435 await close ( ) ;
3536 } finally {
3637 await fs . remove ( tempDir ) ;
3738 }
38- } ) ;
39+ } ) ;
40+
41+ test ( 'Render works correctly with model without a description' , async ( ) => {
42+ const tempDir = await fs . mkdtemp ( path . join ( os . tmpdir ( ) , 'vscode-test-sushi-' ) ) ;
43+ await fs . copy ( SUSHI_SOURCE_PATH , tempDir ) ;
44+
45+ try {
46+ const { window, close } = await startVSCode ( tempDir ) ;
47+
48+ // Wait for the models folder to be visible
49+ await window . waitForSelector ( 'text=models' ) ;
50+
51+ // Click on the models folder, excluding external_models
52+ await window . getByRole ( 'treeitem' , { name : 'models' , exact : true } ) . locator ( 'a' ) . click ( ) ;
53+
54+ // Open the latest_order model
55+ await window . getByRole ( 'treeitem' , { name : 'latest_order.sql' , exact : true } ) . locator ( 'a' ) . click ( ) ;
56+
57+ await window . waitForSelector ( 'text=custom_full_with_custom_kind' ) ;
58+ await window . waitForSelector ( 'text=Loaded SQLMesh Context' )
59+
60+ // Render the model
61+ await window . keyboard . press ( process . platform === 'darwin' ? 'Meta+Shift+P' : 'Control+Shift+P' ) ;
62+ await window . keyboard . type ( 'Render Model' ) ;
63+ await window . keyboard . press ( 'Enter' ) ;
64+
65+ // Check if the model is rendered correctly
66+ await expect ( window . locator ( 'text="orders"."id" AS "id",' ) ) . toBeVisible ( ) ;
67+ await expect ( window . locator ( 'text=sushi.latest_order (rendered)' ) ) . toBeVisible ( ) ;
68+
69+ await close ( ) ;
70+ } finally {
71+ await fs . remove ( tempDir ) ;
72+ }
73+ } ) ;
74+
75+ test ( 'Render works correctly with every rendered model opening a new tab' , async ( ) => {
76+ const tempDir = await fs . mkdtemp ( path . join ( os . tmpdir ( ) , 'vscode-test-sushi-' ) ) ;
77+ await fs . copy ( SUSHI_SOURCE_PATH , tempDir ) ;
78+
79+ try {
80+ const { window, close } = await startVSCode ( tempDir ) ;
81+
82+ // Wait for the models folder to be visible
83+ await window . waitForSelector ( 'text=models' ) ;
84+ await window . getByRole ( 'treeitem' , { name : 'models' , exact : true } ) . locator ( 'a' ) . click ( ) ;
85+ await window . getByRole ( 'treeitem' , { name : 'latest_order.sql' , exact : true } ) . locator ( 'a' ) . click ( ) ;
86+ await window . waitForSelector ( 'text=custom_full_with_custom_kind' ) ;
87+ await window . waitForSelector ( 'text=Loaded SQLMesh Context' )
88+
89+ // Render the model
90+ await window . keyboard . press ( process . platform === 'darwin' ? 'Meta+Shift+P' : 'Control+Shift+P' ) ;
91+ await window . keyboard . type ( 'Render Model' ) ;
92+ await window . keyboard . press ( 'Enter' ) ;
93+
94+ // Check if the model is rendered correctly
95+ await expect ( window . locator ( 'text=sushi.latest_order (rendered)' ) ) . toBeVisible ( ) ;
96+
97+ // Open the customers model
98+ await window . getByRole ( 'treeitem' , { name : 'customers.sql' , exact : true } ) . locator ( 'a' ) . click ( ) ;
99+ await window . waitForSelector ( 'text=grain' ) ;
100+
101+ // Render the customers model
102+ await window . keyboard . press ( process . platform === 'darwin' ? 'Meta+Shift+P' : 'Control+Shift+P' ) ;
103+ await window . keyboard . type ( 'Render Model' ) ;
104+ await window . keyboard . press ( 'Enter' ) ;
105+
106+ // Assert both tabs exist
107+ await expect ( window . locator ( 'text=sushi.latest_order (rendered)' ) ) . toBeVisible ( ) ;
108+ await expect ( window . locator ( 'text=sushi.customers (rendered)' ) ) . toBeVisible ( ) ;
109+
110+ await close ( ) ;
111+ } finally {
112+ await fs . remove ( tempDir ) ;
113+ }
114+ } )
0 commit comments