polymerpolymer-2.xhtml-imports

Polymer tests break after importing official paper libraries


Question

I've created a polymer element using the CLI. This gives me an element entry and basic tests. Those tests are running fine.

After including paper-input or iron-icons, the tests in Firefox still work. The same tests in Chrome, however, break with a strange error.

How can I import elements without breaking the tests? The same issue occurred when importing iron elements. Chrome in production and CI is very important to me.

reproduction:

Polymer CLI 1.6.0

Polymer 2.5.0

user@randy-ubuntu:~/IdeaProjects/music-app-header$ polymer init

Which starter template would you like to use: polymer-2-element

info: Running template polymer-2-element...

Element name: music-app-header

Brief description of the element: music-app-header

polymer test

Test run ended with great success

chrome 65 (2/0/0)                       firefox 59 (2/0/0)

Changing the code:

bower install paper-button

Adding the paper-button import as follows:

<link rel="import" href="../polymer/polymer-element.html">
<link rel="import" href="bower_components/paper-button/paper-button.html">

<dom-module id="music-app-header">

polymer test

  Failed to execute 'define' on 'CustomElementRegistry': this name has already been used with this registry
    <unknown> at   <unknown> at /components/music-app-header/bower_components/polymer/lib/elements/dom-module.html:137:0
    <unknown> at   <unknown> at /components/music-app-header/bower_components/polymer/lib/elements/dom-module.html:142:0

chrome 65                Tests failed: 1 failed tests

Test run ended in failure: 1 failed tests

chrome 65 (2/0/1)                       firefox 59 (2/0/0)


Error: 1 failed tests

Solution

  • This has to do with a dependency issue.

    Instead of installing paper-button, you're supposed to install PolymerElements/paper-button.

    bower install --save PolymerElements/paper-button