我正在尝试让a11ySuite
Polymer 3.0 测试正常工作。
当我使用 运行测试时polymer test
,测试超时,我可以在自动浏览器的控制台中看到以下错误:
Uncaught ReferenceError: Polymer is not defined
at Suite.a11ySuite.eachTest (a11ySuite.js:51)
at mocha.js:1550
at Object.exports.forEach (mocha.js:1595)
at Suite.eachTest (mocha.js:1550)
at Runner.grepTotal (mocha.js:1224)
at Runner.grep (mocha.js:1215)
at new Runner (mocha.js:1197)
at Mocha.run (mocha.js:592)
at _runMocha (extend.js:41)
at done (util.js:34)
如果我在调试模式下从polymer serve
url 运行,我会收到此错误:
a11ySuite.js:49 Uncaught TypeError: fixtureElement.create is not a function
at Suite.a11ySuite.eachTest (a11ySuite.js:49)
at mocha.js:1550
at Object.exports.forEach (mocha.js:1595)
at Suite.eachTest (mocha.js:1550)
at Runner.grepTotal (mocha.js:1224)
at Runner.grep (mocha.js:1215)
at new Runner (mocha.js:1197)
at Mocha.run (mocha.js:592)
at _runMocha (extend.js:41)
at done (util.js:34)
这之前还有一堆来自 mocha 的 404,关于 lodash、sinonjs 和 test-fixture,假设这是因为它是在serve
模式下运行的。
这是我的测试代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Verifier - a11y test</title>
<script src="../node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
<script src="../node_modules/web-component-tester/browser.js"></script>
<script type="module" src="../src/verifier.js"></script>
</head>
<body>
<test-fixture id="BUVA11y">
<template>
<verifier id="verifier"></verifier>
</template>
</test-fixture>
<script>
suite('A11y testing', function() {
a11ySuite('BUVA11y');
});
</script>
</body>
</html>
我在网上找不到更多信息,而且文档在这个主题上非常有限(实际上并不精确)。