我使用Polymer 1创建一个非常简单的Web组件元素(在此处查找由其他人https://github.com/googlecodelabs/polymer-first-elements.git完成的代码)。
我自己创建了一个非常简单的测试。现在,当我进行聚合物测试时,我得到了
16:59:35.148 INFO - Selenium Server is up and running
Error: Unable to connect to selenium
error: [cli.main] cli runtime exception: Error: Unable to connect to selenium
error: [cli.main] Error: Unable to connect to selenium
at Timeout.hasStarted [as _onTimeout] (C:\Users\myUser\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\selenium-standalo
ne\lib\check-started.js:17:10)
at ontimeout (timers.js:482:11)
at tryOnTimeout (timers.js:317:5)
at Timer.listOnTimeout (timers.js:277:5)
以下是我的测试:
的index.html
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<title>Tests</title>
<script src="../bower_components/web-component-tester/browser.js"></script>
</head>
<body>
<script>
WCT.loadSuites([
'for-testing.html'
]);
</script>
</body>
</html>
一个非常简单的测试
<!doctype html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<title>to-test</title>
<script src="../bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<script src="../bower_components/web-component-tester/browser.js"></script>
<link rel="import" href="../demo/icon-toggle-demo.html">
</head>
<body>
<test-fixture id="basic">
<template>
<icon-toggle-demo></icon-toggle-demo>
</template>
</test-fixture>
<script>
suite('suite tests', function() {
var home;
setup(function() {
home = fixture('basic');
});
test('SIMPLE: assert 1 to 1', function() {
assert.equal('1', '1');
})
});
</script>
</body>
</html>
有趣的是,如果我运行应用程序(聚合物服务),它的工作原理。我的意思是,元素会根据我的浏览器进行处理。