UNPKG

@salesforce/pwa-kit-mcp

Version:

MCP server that helps you build Salesforce Commerce Cloud PWA Kit Composable Storefront

47 lines (46 loc) 2.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TestWithPlaywrightTool = void 0; var _siteTestPerformance = require("./site-test-performance"); var _siteTestAccessibility = require("./site-test-accessibility"); function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); } function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } /* * Copyright (c) 2025, Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ const DEFAULT_SITE_URL = 'https://pwa-kit.mobify-storefront.com'; class TestWithPlaywrightTool { /** * Runs a Playwright test file by name (e.g., 'performance' or 'accessibility') * @param {string} testType - 'performance' or 'accessibility' * @param {string} [siteUrl] - Optional site URL to test * @returns {object} - Result of the test run */ run(testType, siteUrl = DEFAULT_SITE_URL) { return _asyncToGenerator(function* () { switch (testType) { case 'performance': { return (0, _siteTestPerformance.runPerformanceTest)(siteUrl); } case 'accessibility': { return (0, _siteTestAccessibility.runAccessibilityTest)(siteUrl); } default: { const result = { error: 'unsupported test type' }; console.log('Unsupported test type result:', result); return result; } } })(); } } exports.TestWithPlaywrightTool = TestWithPlaywrightTool;