Я пытаюсь запустить два теста с web-component-tester
в интерактивном режиме для проекта Polymer 2 в Chrome v69, web-component-test v 6.5.0 и webcomponentsjs v 2.1.3.Первый super basic test
проходит, а второй завершается ошибкой со следующей ошибкой:
Ошибка: не определен полимер в flush на shop-home.test.html: 36
<html>
<head>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<title>shop-home</title>
<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<script>void(0)</script>
<script src="/bower_components/web-component-tester/browser.js"></script>
<link rel="import" href="/bower_components/test-fixture/test-fixture.html">
<link rel="import" href="../shop-home.html">
</head>
<body>
<test-fixture id="basic">
<template>
<shop-home></shop-home>
</template>
</test-fixture>
<script>
suite('shop-home tests', () => {
var home;
setup(() => {
home = fixture('basic');
});
test('super basic test', (done) => {
flush(() => {
console.log('what a great test')
done();
});
});
test('load mission statement', (done) => {
flush(() => {
let ms = Polymer.dom(home.root).querySelector('mission-statement');
assert.exists(ms, 'mission statement is neither `null` nor `undefined`');
done();
});
});
});
При запуске через командную строку ошибка дает более подробную информацию:
Ошибка: ошибка выдается за пределами функции теста: document.getElementById (fixtureId) .create не является функцией.(В 'document.getElementById (fixtureId) .create (model)', 'document.getElementById (fixtureId) .create' не определено) в shop-home.html: 25, 1 неудачные тесты, Ошибка, выданная за пределами функции теста: документ.getElementById (...). create не является функцией shop-home.html: 25
Как я могу предотвратить это и запустить надлежащий модульный тест?