Path: blob/main/extensions/copilot/test/e2e/workspace-e2e.stest.ts
13388 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { ssuite, stest } from '../base/stest';6import { validate } from '../base/validate';7import { discoverScenarios } from './scenarioLoader';8import { generateScenarioTestRunner, shouldSkip } from './scenarioTest';910ssuite({ title: 'workspace', subtitle: 'e2e', location: 'panel' }, (inputPath) => {11// No default cases checked in at the moment12if (!inputPath) {13return;14}1516const scenariosFolder = inputPath;17const scenarios = discoverScenarios(scenariosFolder);18for (const scenario of scenarios) {19const fileName = scenario[0].name;20const testName = fileName.substring(0, fileName.indexOf('.'));21stest.optional(shouldSkip.bind(undefined, scenario), { description: testName },22generateScenarioTestRunner(23scenario,24async (accessor, question, answer) => {25if (scenario[0].json.keywords !== undefined) {26const err = validate(answer, scenario[0].json.keywords);27if (err) {28return { success: false, errorMessage: err };29}3031return { success: true, errorMessage: answer };32}3334return { success: true, errorMessage: 'No requirements set for test.' };35}));36}37});383940