UNPKG

@salesforce/pwa-kit-mcp

Version:

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

38 lines (37 loc) 1.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.runAccessibilityTest = runAccessibilityTest; var _playwright = require("playwright"); var _playwright2 = _interopRequireDefault(require("@axe-core/playwright")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } 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 */ function runAccessibilityTest(_x) { return _runAccessibilityTest.apply(this, arguments); } function _runAccessibilityTest() { _runAccessibilityTest = _asyncToGenerator(function* (siteUrl) { const browser = yield _playwright.chromium.launch(); const context = yield browser.newContext(); const page = yield context.newPage(); yield page.goto(siteUrl); const results = yield new _playwright2.default({ page }).analyze(); yield browser.close(); return { content: [{ type: 'text', text: JSON.stringify(results) }] }; }); return _runAccessibilityTest.apply(this, arguments); }