Skip to content

Commit cbcdf21

Browse files
committed
fix(vscode): scope render tab assertions to the editor tab
The render e2e tests asserted on the rendered model's tab title with a bare text selector. Recent VS Code builds show the active editor's name in the chat view as well, so the selector matches two elements and Playwright fails with a strict mode violation: locator('text=sushi.customers (rendered)') resolved to 2 elements: 1) <a class="label-name">sushi.customers (rendered)</a> 2) <span class="monaco-highlighted-label">sushi.customers (rendered)</span> aka getByLabel('Enable current file context').locator('a') Match the editor tab by role instead, which ignores the chat entry. Verified against code-server 4.107.1 and 4.137.0. Signed-off-by: Adegbite Ayoade <tripleaceme@gmail.com>
1 parent ad2377e commit cbcdf21

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎vscode/extension/tests/render.spec.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ test('Render works correctly', async ({ page, sharedCodeServer, tempDir }) => {
3838

3939
// Check if the model is rendered by check if "`oi`.`order_id` AS `order_id`," is in the window
4040
await expect(page.locator('text="marketing"."customer_id" AS')).toBeVisible()
41-
await expect(page.locator('text=sushi.customers (rendered)')).toBeVisible()
41+
await expect(page.getByRole('tab', { name: 'sushi.customers (rendered)' })).toBeVisible()
4242
})
4343

4444
test('Render works correctly with model without a description', async ({
@@ -74,7 +74,7 @@ test('Render works correctly with model without a description', async ({
7474

7575
// Check if the model is rendered correctly
7676
await expect(page.locator('text="orders"."id" AS "id",')).toBeVisible()
77-
await expect(page.locator('text=sushi.latest_order (rendered)')).toBeVisible()
77+
await expect(page.getByRole('tab', { name: 'sushi.latest_order (rendered)' })).toBeVisible()
7878
})
7979

8080
test('Render works correctly with every rendered model opening a new tab', async ({
@@ -104,7 +104,7 @@ test('Render works correctly with every rendered model opening a new tab', async
104104
await runCommand(page, 'Render Model')
105105

106106
// Check if the model is rendered correctly
107-
await expect(page.locator('text=sushi.latest_order (rendered)')).toBeVisible()
107+
await expect(page.getByRole('tab', { name: 'sushi.latest_order (rendered)' })).toBeVisible()
108108

109109
// Open the customers model
110110
await page
@@ -117,8 +117,8 @@ test('Render works correctly with every rendered model opening a new tab', async
117117
await runCommand(page, 'Render Model')
118118

119119
// Assert both tabs exist
120-
await expect(page.locator('text=sushi.latest_order (rendered)')).toBeVisible()
121-
await expect(page.locator('text=sushi.customers (rendered)')).toBeVisible()
120+
await expect(page.getByRole('tab', { name: 'sushi.latest_order (rendered)' })).toBeVisible()
121+
await expect(page.getByRole('tab', { name: 'sushi.customers (rendered)' })).toBeVisible()
122122
})
123123

124124
test('Render shows model picker when no active editor is open', async ({
@@ -146,7 +146,7 @@ test('Render shows model picker when no active editor is open', async ({
146146
await page.locator('text=sushi.customers').click()
147147

148148
// Verify the rendered model is shown
149-
await expect(page.locator('text=sushi.customers (rendered)')).toBeVisible({
149+
await expect(page.getByRole('tab', { name: 'sushi.customers (rendered)' })).toBeVisible({
150150
timeout: 2_000,
151151
})
152152
})

0 commit comments

Comments
 (0)