[FIX] web, web_tour: qunit tests: do not log "test successful"
Python tests that run chrome headless wait for "test successful"
to be printed in the console to end the test with green status.
Tours and qunit suites logs that message when their work is done.
Commit [1] reworked the tour system and introduced some qunit
tests of the tour engine. However, running fake tours in qunit
tests produced the "test successful" message, which caused the end
of the suite. As a consequence, only a small part of the WebSuite
test suite was really executed.
This commit mocks console.log in those tour qunit tests, s.t. the
suite is now fully executed again.
[1] 3a798039d6
Part-of: odoo/odoo#115841
This commit is contained in:
@@ -305,7 +305,8 @@ export function setupQUnit() {
|
||||
errorMessages.push(`${result.failed} / ${result.total} tests failed.`);
|
||||
}
|
||||
if (!result.failed && allModulesLoaded) {
|
||||
console.log("test successful");
|
||||
console.log("QUnit test suite done.");
|
||||
console.log("test successful"); // for ChromeBowser to know it's over and ok
|
||||
} else {
|
||||
logErrors();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { markup, whenReady, reactive } from "@odoo/owl";
|
||||
import { browser } from "@web/core/browser/browser";
|
||||
import { isMobileOS } from "@web/core/browser/feature_detection";
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import { MacroEngine } from "@web/core/macro";
|
||||
@@ -186,7 +187,7 @@ export const tourService = {
|
||||
}
|
||||
pointer.stop();
|
||||
// Used to signal the python test runner that the tour finished without error.
|
||||
console.log("test successful");
|
||||
browser.console.log("test successful");
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { browser } from "@web/core/browser/browser";
|
||||
import { registry } from "@web/core/registry";
|
||||
import { tourService } from "@web_tour/tour_service/tour_service";
|
||||
import { rpcService } from "@web/core/network/rpc_service";
|
||||
@@ -15,6 +16,7 @@ import {
|
||||
click,
|
||||
triggerEvent,
|
||||
nextTick,
|
||||
patchWithCleanup,
|
||||
} from "@web/../tests/helpers/utils";
|
||||
import { makeTestEnv } from "@web/../tests/helpers/mock_env";
|
||||
import { Component, useState, xml } from "@odoo/owl";
|
||||
@@ -59,6 +61,10 @@ QUnit.module("Tour service", (hooks) => {
|
||||
.add("notification", notificationService)
|
||||
.add("effect", effectService)
|
||||
.add("tour_service", tourService);
|
||||
patchWithCleanup(browser.console, {
|
||||
// prevent form logging "tour successful" which would end the qunit suite test
|
||||
log: () => {}
|
||||
});
|
||||
});
|
||||
|
||||
hooks.afterEach(() => {
|
||||
|
||||
Reference in New Issue
Block a user