Fix tests for M80
As of M80(chrome version >= 80), chrome removed the native htmlImports support, tho we have the polyfill from webcomponents, the loading of html changed from sync to async which cause a lot test to fail in M80. The fix is introducing a util method `readyToTest` which wait until htmlImports finished before running any tests. Updated some tests to have only one top suite per test so we only need one `readyToTest` and also multiple `readyToTest` actually affect tests' stub functionality. Tested locally with `npm run test` on all passed tests and also with manual failure to make sure the updated tests can still catch any errors if have. Bug: Issue 12294 Change-Id: Ib0c464f8ff9f36a401e6c3b249e6bb6d68ee6e2f
This commit is contained in:
@@ -23,11 +23,13 @@ limitations under the License.
|
||||
|
||||
<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="/bower_components/web-component-tester/browser.js"></script>
|
||||
<script src="../../test/test-pre-setup.js"></script>
|
||||
<link rel="import" href="../../test/common-test-setup.html"/>
|
||||
<link rel="import" href="async-foreach-behavior.html">
|
||||
|
||||
<script>
|
||||
suite('async-foreach-behavior tests', () => {
|
||||
suite('async-foreach-behavior tests', async () => {
|
||||
await readyToTest();
|
||||
test('loops over each item', () => {
|
||||
const fn = sinon.stub().returns(Promise.resolve());
|
||||
return Gerrit.AsyncForeachBehavior.asyncForeach([1, 2, 3], fn)
|
||||
|
||||
@@ -23,6 +23,7 @@ limitations under the License.
|
||||
|
||||
<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="/bower_components/web-component-tester/browser.js"></script>
|
||||
<script src="../../test/test-pre-setup.js"></script>
|
||||
<link rel="import" href="../../test/common-test-setup.html"/>
|
||||
<script>
|
||||
/** @type {string} */
|
||||
@@ -45,7 +46,8 @@ limitations under the License.
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
suite('base-url-behavior tests', () => {
|
||||
suite('base-url-behavior tests', async () => {
|
||||
await readyToTest();
|
||||
let element;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
let overlay;
|
||||
|
||||
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
<!-- Polymer included for the html import polyfill. -->
|
||||
<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="/bower_components/web-component-tester/browser.js"></script>
|
||||
<script src="../../test/test-pre-setup.js"></script>
|
||||
<link rel="import" href="../../test/common-test-setup.html"/>
|
||||
<title>docs-url-behavior</title>
|
||||
|
||||
@@ -33,7 +34,8 @@ limitations under the License.
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
suite('docs-url-behavior tests', () => {
|
||||
suite('docs-url-behavior tests', async () => {
|
||||
await readyToTest();
|
||||
let element;
|
||||
|
||||
suiteSetup(() => {
|
||||
|
||||
@@ -23,6 +23,7 @@ limitations under the License.
|
||||
|
||||
<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="/bower_components/web-component-tester/browser.js"></script>
|
||||
<script src="../../test/test-pre-setup.js"></script>
|
||||
<link rel="import" href="../../test/common-test-setup.html"/>
|
||||
<link rel="import" href="dom-util-behavior.html">
|
||||
|
||||
@@ -40,7 +41,8 @@ limitations under the License.
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
suite('dom-util-behavior tests', () => {
|
||||
suite('dom-util-behavior tests', async () => {
|
||||
await readyToTest();
|
||||
let element;
|
||||
let divs;
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ limitations under the License.
|
||||
|
||||
<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="/bower_components/web-component-tester/browser.js"></script>
|
||||
<script src="../../test/test-pre-setup.js"></script>
|
||||
<link rel="import" href="../../test/common-test-setup.html"/>
|
||||
<link rel="import" href="gr-access-behavior.html">
|
||||
|
||||
@@ -33,7 +34,8 @@ limitations under the License.
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
suite('gr-access-behavior tests', () => {
|
||||
suite('gr-access-behavior tests', async () => {
|
||||
await readyToTest();
|
||||
let element;
|
||||
|
||||
suiteSetup(() => {
|
||||
|
||||
@@ -23,6 +23,7 @@ limitations under the License.
|
||||
|
||||
<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="/bower_components/web-component-tester/browser.js"></script>
|
||||
<script src="../../test/test-pre-setup.js"></script>
|
||||
<link rel="import" href="../../test/common-test-setup.html"/>
|
||||
<link rel="import" href="gr-admin-nav-behavior.html">
|
||||
|
||||
@@ -33,7 +34,8 @@ limitations under the License.
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
suite('gr-admin-nav-behavior tests', () => {
|
||||
suite('gr-admin-nav-behavior tests', async () => {
|
||||
await readyToTest();
|
||||
let element;
|
||||
let sandbox;
|
||||
let capabilityStub;
|
||||
|
||||
@@ -23,6 +23,7 @@ limitations under the License.
|
||||
|
||||
<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="/bower_components/web-component-tester/browser.js"></script>
|
||||
<script src="../../test/test-pre-setup.js"></script>
|
||||
<link rel="import" href="../../test/common-test-setup.html"/>
|
||||
<link rel="import" href="gr-change-table-behavior.html">
|
||||
|
||||
@@ -41,7 +42,8 @@ limitations under the License.
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
suite('gr-change-table-behavior tests', () => {
|
||||
suite('gr-change-table-behavior tests', async () => {
|
||||
await readyToTest();
|
||||
let element;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
let overlay;
|
||||
|
||||
@@ -23,6 +23,7 @@ limitations under the License.
|
||||
|
||||
<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="/bower_components/web-component-tester/browser.js"></script>
|
||||
<script src="../../test/test-pre-setup.js"></script>
|
||||
<link rel="import" href="../../test/common-test-setup.html"/>
|
||||
<link rel="import" href="gr-display-name-behavior.html">
|
||||
|
||||
@@ -33,7 +34,8 @@ limitations under the License.
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
suite('gr-display-name-behavior tests', () => {
|
||||
suite('gr-display-name-behavior tests', async () => {
|
||||
await readyToTest();
|
||||
let element;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const config = {
|
||||
|
||||
@@ -23,6 +23,7 @@ limitations under the License.
|
||||
|
||||
<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="/bower_components/web-component-tester/browser.js"></script>
|
||||
<script src="../../test/test-pre-setup.js"></script>
|
||||
<link rel="import" href="../../test/common-test-setup.html"/>
|
||||
<link rel="import" href="gr-list-view-behavior.html">
|
||||
|
||||
@@ -33,7 +34,8 @@ limitations under the License.
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
suite('gr-list-view-behavior tests', () => {
|
||||
suite('gr-list-view-behavior tests', async () => {
|
||||
await readyToTest();
|
||||
let element;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
let overlay;
|
||||
|
||||
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
<!-- Polymer included for the html import polyfill. -->
|
||||
<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="/bower_components/web-component-tester/browser.js"></script>
|
||||
<script src="../../test/test-pre-setup.js"></script>
|
||||
<link rel="import" href="../../test/common-test-setup.html"/>
|
||||
<title>gr-patch-set-behavior</title>
|
||||
|
||||
@@ -25,7 +26,8 @@ limitations under the License.
|
||||
<link rel="import" href="gr-patch-set-behavior.html">
|
||||
|
||||
<script>
|
||||
suite('gr-patch-set-behavior tests', () => {
|
||||
suite('gr-patch-set-behavior tests', async () => {
|
||||
await readyToTest();
|
||||
test('getRevisionByPatchNum', () => {
|
||||
const get = Gerrit.PatchSetBehavior.getRevisionByPatchNum;
|
||||
const revisions = [
|
||||
|
||||
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
<!-- Polymer included for the html import polyfill. -->
|
||||
<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="/bower_components/web-component-tester/browser.js"></script>
|
||||
<script src="../../test/test-pre-setup.js"></script>
|
||||
<link rel="import" href="../../test/common-test-setup.html"/>
|
||||
<title>gr-path-list-behavior</title>
|
||||
|
||||
@@ -25,7 +26,8 @@ limitations under the License.
|
||||
<link rel="import" href="gr-path-list-behavior.html">
|
||||
|
||||
<script>
|
||||
suite('gr-path-list-behavior tests', () => {
|
||||
suite('gr-path-list-behavior tests', async () => {
|
||||
await readyToTest();
|
||||
test('special sort', () => {
|
||||
const sort = Gerrit.PathListBehavior.specialFilePathCompare;
|
||||
const testFiles = [
|
||||
|
||||
@@ -22,6 +22,7 @@ limitations under the License.
|
||||
|
||||
<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="/bower_components/web-component-tester/browser.js"></script>
|
||||
<script src="../../test/test-pre-setup.js"></script>
|
||||
<link rel="import" href="../../test/common-test-setup.html"/>
|
||||
<link rel="import" href="gr-tooltip-behavior.html">
|
||||
|
||||
@@ -34,7 +35,8 @@ limitations under the License.
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
suite('gr-tooltip-behavior tests', () => {
|
||||
suite('gr-tooltip-behavior tests', async () => {
|
||||
await readyToTest();
|
||||
let element;
|
||||
let sandbox;
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ limitations under the License.
|
||||
|
||||
<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="/bower_components/web-component-tester/browser.js"></script>
|
||||
<script src="../../test/test-pre-setup.js"></script>
|
||||
<link rel="import" href="../../test/common-test-setup.html"/>
|
||||
<link rel="import" href="gr-url-encoding-behavior.html">
|
||||
|
||||
@@ -34,7 +35,8 @@ limitations under the License.
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
suite('gr-url-encoding-behavior tests', () => {
|
||||
suite('gr-url-encoding-behavior tests', async () => {
|
||||
await readyToTest();
|
||||
let element;
|
||||
let sandbox;
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ limitations under the License.
|
||||
|
||||
<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="/bower_components/web-component-tester/browser.js"></script>
|
||||
<script src="../../test/test-pre-setup.js"></script>
|
||||
<link rel="import" href="../../test/common-test-setup.html"/>
|
||||
<link rel="import" href="keyboard-shortcut-behavior.html">
|
||||
|
||||
@@ -41,7 +42,8 @@ limitations under the License.
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
suite('keyboard-shortcut-behavior tests', () => {
|
||||
suite('keyboard-shortcut-behavior tests', async () => {
|
||||
await readyToTest();
|
||||
const kb = window.Gerrit.KeyboardShortcutBinder;
|
||||
|
||||
let element;
|
||||
|
||||
@@ -23,6 +23,7 @@ limitations under the License.
|
||||
|
||||
<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="/bower_components/web-component-tester/browser.js"></script>
|
||||
<script src="../../test/test-pre-setup.js"></script>
|
||||
<link rel="import" href="../../test/common-test-setup.html"/>
|
||||
<script>
|
||||
/** @type {string} */
|
||||
@@ -47,7 +48,8 @@ limitations under the License.
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
suite('rest-client-behavior tests', () => {
|
||||
suite('rest-client-behavior tests', async () => {
|
||||
await readyToTest();
|
||||
let element;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
let overlay;
|
||||
|
||||
@@ -22,6 +22,7 @@ limitations under the License.
|
||||
|
||||
<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="/bower_components/web-component-tester/browser.js"></script>
|
||||
<script src="../../test/test-pre-setup.js"></script>
|
||||
<link rel="import" href="../../test/common-test-setup.html"/>
|
||||
<link rel="import" href="safe-types-behavior.html">
|
||||
|
||||
@@ -34,7 +35,8 @@ limitations under the License.
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
suite('gr-tooltip-behavior tests', () => {
|
||||
suite('gr-tooltip-behavior tests', async () => {
|
||||
await readyToTest();
|
||||
let element;
|
||||
let sandbox;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user