diff --git a/vscode/extension/tests/broken_project.spec.ts b/vscode/extension/tests/broken_project.spec.ts index af7b022545..8de58c1853 100644 --- a/vscode/extension/tests/broken_project.spec.ts +++ b/vscode/extension/tests/broken_project.spec.ts @@ -5,7 +5,7 @@ import path from 'path' import { openLineageView, openServerPage, - runCommand, + openProblemsView, saveFile, SUSHI_SOURCE_PATH, } from './utils' @@ -277,8 +277,7 @@ test('bad model block, then fixed', async ({ page, sharedCodeServer }) => { // Wait for the error to appear await page.waitForSelector('text=Error creating context') - // Open the problems view - await runCommand(page, 'View: Focus Problems') + await openProblemsView(page) // Assert error is present in the problems view const errorElement = page diff --git a/vscode/extension/tests/diagnostics.spec.ts b/vscode/extension/tests/diagnostics.spec.ts index a520cabcf7..fcac5cecf0 100644 --- a/vscode/extension/tests/diagnostics.spec.ts +++ b/vscode/extension/tests/diagnostics.spec.ts @@ -2,7 +2,7 @@ import { expect, test } from './fixtures' import path from 'path' import fs from 'fs-extra' import os from 'os' -import { openServerPage, runCommand, SUSHI_SOURCE_PATH } from './utils' +import { openProblemsView, openServerPage, SUSHI_SOURCE_PATH } from './utils' import { createPythonInterpreterSettingsSpecifier } from './utils_code_server' import { execAsync } from '../src/utilities/exec' import yaml from 'yaml' @@ -36,8 +36,7 @@ test('Workspace diagnostics show up in the diagnostics panel', async ({ .locator('a') .click() - // Open problems panel - await runCommand(page, 'View: Focus Problems') + await openProblemsView(page) await page.waitForSelector('text=problems') await page.waitForSelector('text=All models should have an owner') @@ -82,8 +81,7 @@ test.describe('Bad config.py/config.yaml file issues', () => { // Wait for the error to appear await page.waitForSelector('text=Error creating context') - // Open the problems view - await runCommand(page, 'View: Focus Problems') + await openProblemsView(page) // Asser that the error is present in the problems view await page @@ -125,8 +123,7 @@ test.describe('Bad config.py/config.yaml file issues', () => { // Wait for the error to appear await page.waitForSelector('text=Error creating context') - // Open the problems view - await runCommand(page, 'View: Focus Problems') + await openProblemsView(page) // Asser that the error is present in the problems view await page @@ -164,8 +161,7 @@ test.describe('Bad config.py/config.yaml file issues', () => { // Expect the error to appear await page.waitForSelector('text=Error creating context') - // Open the problems view - await runCommand(page, 'View: Focus Problems') + await openProblemsView(page) // Assert that the error is present in the problems view const errorElement = page @@ -200,8 +196,7 @@ test.describe('Bad config.py/config.yaml file issues', () => { // Expect the error to appear await page.waitForSelector('text=Error creating context') - // Open the problems view - await runCommand(page, 'View: Focus Problems') + await openProblemsView(page) // Assert that the error is present in the problems view const errorElement = page.getByText('Failed to load config file:').first() @@ -242,8 +237,7 @@ test.describe('Diagnostics for bad SQLMesh models', () => { // Wait for the error to appear await page.waitForSelector('text=Error creating context') - // Open the problems view - await runCommand(page, 'View: Focus Problems') + await openProblemsView(page) // Asser that the error is present in the problems view await page @@ -284,8 +278,7 @@ test.describe('Diagnostics for bad SQLMesh models', () => { // Wait for the error to appear await page.waitForSelector('text=Error creating context') - // Open the problems view - await runCommand(page, 'View: Focus Problems') + await openProblemsView(page) // Assert error is present in the problems view const errorElement = page @@ -331,8 +324,7 @@ test.describe('Diagnostics for bad audits', () => { // Wait for the error to appear await page.waitForSelector('text=Error creating context') - // Open the problems view - await runCommand(page, 'View: Focus Problems') + await openProblemsView(page) // Assert that the error is present in the problems view const errorElement = page diff --git a/vscode/extension/tests/utils.ts b/vscode/extension/tests/utils.ts index e783ae268e..951741bdd1 100644 --- a/vscode/extension/tests/utils.ts +++ b/vscode/extension/tests/utils.ts @@ -87,6 +87,12 @@ export const pipInstall = async ( export const openLineageView = async (page: Page) => await runCommand(page, 'Lineage: Focus On View') +/** + * Open the problems/diagnostics view in the given window. + */ +export const openProblemsView = async (page: Page) => + await runCommand(page, 'View: Focus Problems') + /** * Restart the SQLMesh servers */