Manually updating some tests before run conversion script
Some tests don't work correctly after polymer-modulizer conversion and must be updated. Changes are small and it is easier to make changes manually than to automate such changes. The change has the following updates: * gr-comment-api-mock_test.js doesn't wait for HTMLImportsLoaded event anymore. * gr-app_test.html loads gr-app.html statically with <link ...> tag (instead of dynamic loading with document.head.appendChild(...). polymer-modulizer converts the link tag to 'import' statement. * Remove waiting and call someAction() immediately in tests: readyToTest().then(() => { someAction(); }) * Update some script src path. Without these updates web-component-tester fails after conversion The change makes some tests unstable, so gerrit-ci can fail on this change. Tests will become stable after conversion to es6-modules. Change-Id: Ieceb498bff0fc3398e82ab8647efa819cdd50448
This commit is contained in:
parent
31f655eb15
commit
23505e90b6
@ -17,7 +17,6 @@
|
|||||||
(function() {
|
(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
window.addEventListener('HTMLImportsLoaded', () => {
|
|
||||||
class CommentApiMock extends Polymer.GestureEventListeners(
|
class CommentApiMock extends Polymer.GestureEventListeners(
|
||||||
Polymer.LegacyElementMixin(
|
Polymer.LegacyElementMixin(
|
||||||
Polymer.Element)) {
|
Polymer.Element)) {
|
||||||
@ -52,5 +51,4 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
customElements.define(CommentApiMock.is, CommentApiMock);
|
customElements.define(CommentApiMock.is, CommentApiMock);
|
||||||
});
|
|
||||||
})();
|
})();
|
||||||
|
@ -25,13 +25,7 @@ limitations under the License.
|
|||||||
<script src="/bower_components/web-component-tester/browser.js"></script>
|
<script src="/bower_components/web-component-tester/browser.js"></script>
|
||||||
<script src="../test/test-pre-setup.js"></script>
|
<script src="../test/test-pre-setup.js"></script>
|
||||||
<link rel="import" href="../test/common-test-setup.html"/>
|
<link rel="import" href="../test/common-test-setup.html"/>
|
||||||
|
<link rel="import" href="gr-app.html"/>
|
||||||
<script>
|
|
||||||
const link = document.createElement('link');
|
|
||||||
link.setAttribute('rel', 'import');
|
|
||||||
link.setAttribute('href', 'gr-app.html');
|
|
||||||
document.head.appendChild(link);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script>void(0);</script>
|
<script>void(0);</script>
|
||||||
|
|
||||||
@ -84,7 +78,7 @@ limitations under the License.
|
|||||||
sandbox.restore();
|
sandbox.restore();
|
||||||
});
|
});
|
||||||
|
|
||||||
appElement = () => element.$['app-element'];
|
const appElement = () => element.$['app-element'];
|
||||||
|
|
||||||
test('reporting', () => {
|
test('reporting', () => {
|
||||||
assert.isTrue(appElement().$.reporting.appStarted.calledOnce);
|
assert.isTrue(appElement().$.reporting.appStarted.calledOnce);
|
||||||
|
@ -31,7 +31,6 @@ limitations under the License.
|
|||||||
|
|
||||||
<dom-element id="some-element">
|
<dom-element id="some-element">
|
||||||
<script>
|
<script>
|
||||||
readyToTest().then(() => {
|
|
||||||
Polymer({
|
Polymer({
|
||||||
is: 'some-element',
|
is: 'some-element',
|
||||||
properties: {
|
properties: {
|
||||||
@ -41,7 +40,6 @@ limitations under the License.
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</dom-element>
|
</dom-element>
|
||||||
|
@ -31,7 +31,6 @@ limitations under the License.
|
|||||||
|
|
||||||
<dom-element id="some-element">
|
<dom-element id="some-element">
|
||||||
<script>
|
<script>
|
||||||
readyToTest().then(() => {
|
|
||||||
Polymer({
|
Polymer({
|
||||||
is: 'some-element',
|
is: 'some-element',
|
||||||
|
|
||||||
@ -46,7 +45,6 @@ limitations under the License.
|
|||||||
Gerrit.FireBehavior,
|
Gerrit.FireBehavior,
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</dom-element>
|
</dom-element>
|
||||||
|
@ -45,7 +45,6 @@ limitations under the License.
|
|||||||
element = fixture('basic');
|
element = fixture('basic');
|
||||||
sandbox = sinon.sandbox.create();
|
sandbox = sinon.sandbox.create();
|
||||||
sandbox.stub(document.body, 'appendChild');
|
sandbox.stub(document.body, 'appendChild');
|
||||||
sandbox.stub(Polymer, 'importHref');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
teardown(() => {
|
teardown(() => {
|
||||||
|
@ -41,9 +41,7 @@ limitations under the License.
|
|||||||
<div id="barfoo">some test module</div>
|
<div id="barfoo">some test module</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
readyToTest().then(() => {
|
|
||||||
Polymer({is: 'gr-user-test-popup'});
|
Polymer({is: 'gr-user-test-popup'});
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</dom-module>
|
</dom-module>
|
||||||
|
|
||||||
|
@ -35,9 +35,7 @@ limitations under the License.
|
|||||||
<div id="wrapper"></div>
|
<div id="wrapper"></div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
readyToTest().then(() => {
|
|
||||||
Polymer({is: 'gr-style-test-element'});
|
Polymer({is: 'gr-style-test-element'});
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</dom-module>
|
</dom-module>
|
||||||
|
|
||||||
|
@ -25,7 +25,13 @@ limitations under the License.
|
|||||||
<script src="/bower_components/web-component-tester/browser.js"></script>
|
<script src="/bower_components/web-component-tester/browser.js"></script>
|
||||||
<script src="../../../test/test-pre-setup.js"></script>
|
<script src="../../../test/test-pre-setup.js"></script>
|
||||||
<link rel="import" href="../../../test/common-test-setup.html"/>
|
<link rel="import" href="../../../test/common-test-setup.html"/>
|
||||||
<script src="/bower_components/iron-test-helpers/mock-interactions.js"></script>
|
<!-- Can't use absolute path below for mock-interaction.js.
|
||||||
|
Web component tester(wct) has a built-in http server and it serves "/components" directory (which is
|
||||||
|
actually /node_modules directory). Also, wct patches some files to load modules from /components.
|
||||||
|
With the absolute path, browser tries to load dom-module from 2 different places (/component/... and
|
||||||
|
/node_modules/...) though this is actually the same file. This leads to a run-time error.
|
||||||
|
-->
|
||||||
|
<script src="../../../node_modules/iron-test-helpers/mock-interactions.js"></script>
|
||||||
|
|
||||||
<link rel="import" href="gr-editable-content.html">
|
<link rel="import" href="gr-editable-content.html">
|
||||||
|
|
||||||
|
@ -25,7 +25,13 @@ limitations under the License.
|
|||||||
<script src="/bower_components/web-component-tester/browser.js"></script>
|
<script src="/bower_components/web-component-tester/browser.js"></script>
|
||||||
<script src="../../../test/test-pre-setup.js"></script>
|
<script src="../../../test/test-pre-setup.js"></script>
|
||||||
<link rel="import" href="../../../test/common-test-setup.html"/>
|
<link rel="import" href="../../../test/common-test-setup.html"/>
|
||||||
<script src="/bower_components/iron-test-helpers/mock-interactions.js"></script>
|
<!-- Can't use absolute path below for mock-interaction.js.
|
||||||
|
Web component tester(wct) has a built-in http server and it serves "/components" directory (which is
|
||||||
|
actually /node_modules directory). Also, wct patches some files to load modules from /components.
|
||||||
|
With the absolute path, browser tries to load dom-module from 2 different places (/component/... and
|
||||||
|
/node_modules/...) though this is actually the same file. This leads to a run-time error.
|
||||||
|
-->
|
||||||
|
<script src="../../../node_modules/iron-test-helpers/mock-interactions.js"></script>
|
||||||
|
|
||||||
<link rel="import" href="gr-editable-label.html">
|
<link rel="import" href="gr-editable-label.html">
|
||||||
|
|
||||||
|
@ -25,7 +25,13 @@ limitations under the License.
|
|||||||
<script src="/bower_components/web-component-tester/browser.js"></script>
|
<script src="/bower_components/web-component-tester/browser.js"></script>
|
||||||
<script src="../../../test/test-pre-setup.js"></script>
|
<script src="../../../test/test-pre-setup.js"></script>
|
||||||
<link rel="import" href="../../../test/common-test-setup.html"/>
|
<link rel="import" href="../../../test/common-test-setup.html"/>
|
||||||
<script src="/bower_components/iron-test-helpers/mock-interactions.js"></script>
|
<!-- Can't use absolute path below for mock-interaction.js.
|
||||||
|
Web component tester(wct) has a built-in http server and it serves "/components" directory (which is
|
||||||
|
actually /node_modules directory). Also, wct patches some files to load modules from /components.
|
||||||
|
With the absolute path, browser tries to load dom-module from 2 different places (/component/... and
|
||||||
|
/node_modules/...) though this is actually the same file. This leads to a run-time error.
|
||||||
|
-->
|
||||||
|
<script src="../../../node_modules/iron-test-helpers/mock-interactions.js"></script>
|
||||||
|
|
||||||
<link rel="import" href="gr-hovercard.html">
|
<link rel="import" href="gr-hovercard.html">
|
||||||
|
|
||||||
|
@ -25,7 +25,13 @@ limitations under the License.
|
|||||||
<script src="/bower_components/web-component-tester/browser.js"></script>
|
<script src="/bower_components/web-component-tester/browser.js"></script>
|
||||||
<script src="../../../test/test-pre-setup.js"></script>
|
<script src="../../../test/test-pre-setup.js"></script>
|
||||||
<link rel="import" href="../../../test/common-test-setup.html"/>
|
<link rel="import" href="../../../test/common-test-setup.html"/>
|
||||||
<script src="/bower_components/iron-test-helpers/mock-interactions.js"></script>
|
<!-- Can't use absolute path below for mock-interaction.js.
|
||||||
|
Web component tester(wct) has a built-in http server and it serves "/components" directory (which is
|
||||||
|
actually /node_modules directory). Also, wct patches some files to load modules from /components.
|
||||||
|
With the absolute path, browser tries to load dom-module from 2 different places (/component/... and
|
||||||
|
/node_modules/...) though this is actually the same file. This leads to a run-time error.
|
||||||
|
-->
|
||||||
|
<script src="../../../node_modules/iron-test-helpers/mock-interactions.js"></script>
|
||||||
|
|
||||||
<link rel="import" href="gr-linked-chip.html">
|
<link rel="import" href="gr-linked-chip.html">
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ limitations under the License.
|
|||||||
<script src="../../../test/test-pre-setup.js"></script>
|
<script src="../../../test/test-pre-setup.js"></script>
|
||||||
<link rel="import" href="../../../test/common-test-setup.html"/>
|
<link rel="import" href="../../../test/common-test-setup.html"/>
|
||||||
|
|
||||||
<script src="gr-etag-decorator.js"></script>
|
<link rel="import" href="./gr-etag-decorator.html">
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
suite('gr-etag-decorator', async () => {
|
suite('gr-etag-decorator', async () => {
|
||||||
|
@ -19,8 +19,8 @@ limitations under the License.
|
|||||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
||||||
<title>Elements Test Runner</title>
|
<title>Elements Test Runner</title>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
|
<script src="/node_modules/@webcomponents/webcomponentsjs/webcomponents-lite.js"></script>
|
||||||
<script src="/bower_components/web-component-tester/browser.js"></script>
|
<script src="/node_modules/web-component-tester/browser.js"></script>
|
||||||
<style>
|
<style>
|
||||||
/* Prevent horizontal scrolling on page.
|
/* Prevent horizontal scrolling on page.
|
||||||
New version of web-component-tester creates very narrow iframe */
|
New version of web-component-tester creates very narrow iframe */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user