-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Master imp click all test moc #25768
Master imp click all test moc #25768
Conversation
Hello @ged-odoo , I need to rebase but I finally found how to handle the filter options problem. |
What a beautiful thing, this tests should come more often.! |
@nhomar Thanks ! |
@d-fence that make sense, we have a ton of phantom tests for our deployment processes and yes it takes a ton of time, this should be integrated with the nightly process I think... before release the nightly packaging, run this, may be twice per day or every smart commit analysis... but excellent, have the test is the very first step... it is great! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other comment: you do not test the form views! This is not totally trivial, but it would be interesting, each time you open a menu item, to see if you can find a way to open a form view
@@ -128,6 +128,7 @@ var AbstractWebClient = Widget.extend(ServiceProviderMixin, KeyboardNavigationMi | |||
// Listen to 'scroll' event and propagate it on main bus | |||
self.action_manager.$el.on('scroll', core.bus.trigger.bind(core.bus, 'scroll')); | |||
core.bus.trigger('web_client_ready'); | |||
odoo.isReady = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now that I think of it, you can do this in the test itself (where you monkey patch the web client to add hooks)
@@ -82,7 +82,7 @@ var AbstractController = AbstractAction.extend(ControlPanelMixin, { | |||
var self = this; | |||
|
|||
this.$el.addClass('o_view_controller'); | |||
|
|||
this.$el.attr('data-view-type', this.viewType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, this can be done in the test itself
'version': '1.0', | ||
'category': 'Tools', | ||
'description': """ | ||
This module will test the main menus of Odoo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by clicking on each of them
'description': """ | ||
This module will test the main menus of Odoo. | ||
""", | ||
'depends': ['lunch', ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure you depend on lunch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's only on dev purpose, that way, I have a module to test :-)
I will remove that depends at the end.
var testedApps; | ||
var testedMenus; | ||
|
||
function prepareMonkeys() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing docstring. Also, I would use a more descriptive name, maybe something like addWebClientHooks
* Test a menu item by: | ||
* 1 - clikcing on the menuItem | ||
* 2 - Orchestrate the view switch | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
incorrect docstring:
/**
* Test a menu item by:
* 1 - clicking on the menuItem
* 2 - Orchestrate the view switch
*
* @param {DomElement) the App menu item
* @returns {Deferred}
*/
* 1 - clikcing on the menuItem | ||
* 2 - Orchestrate the view switch | ||
*/ | ||
function testMenuItem($element){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}; | ||
|
||
|
||
function testViews() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docstring
* @param viewType: a string for the view type to test (list, kanban ...) | ||
* returns a deferred that wait for the view to be loaded | ||
*/ | ||
function testViewSwitch(viewType){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
incorrect docstring:
/**
* Test a view button
*
* @param {string) viewType: a string for the view type to test (list, kanban ...)
* @returns {Deferred} a deferred that wait for the view to be loaded
*/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note that the type of the parameter is string
} | ||
|
||
/** | ||
* Test filters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
incorrect docstring:
/**
* Test filters
* Click on each filter in the control panel
*
* @returns {Deferred}
*/
Now it works in enterprise too but takes 1985 seconds (33 minutes) |
8746812
to
286abb2
Compare
099f013
to
e508554
Compare
cbc3de3
to
d2b7371
Compare
target branch |
add menu in debug manager to run test |
d948f65
to
e21948e
Compare
@ged-odoo I think it's finished. I added the debug manager menu entry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice :)
var testedApps; | ||
var testedMenus; | ||
|
||
// provide a hook for the python test to signal when the test is ready to be started |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can remove this
}); | ||
|
||
|
||
Discuss.include({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (Discuss) {
Discuss.include({
});
}
* 2 - Orchestrate the view switch | ||
* | ||
* @param {DomElement} element: the menu item | ||
* @returns a {Deferred} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @returns {Deferred}
* 3 - clicking on each menu | ||
* 3.1 - clicking on each view | ||
* @param {DomElement} element: the App menu item | ||
* returns a {Deferred} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @return{Deferred}
/** | ||
* Test a view button | ||
* @param {string} viewType: a string for the view type to test (list, kanban ...) | ||
* returns {Deferred} a deferred that wait for the view to be loaded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@returns {Deferred}
/** | ||
* Wait a certain amount of time for a condition to occur | ||
* @param stopCondition: a function that returns a boolean | ||
* returns a deferred that is rejected if the timeout is exceeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem
* @param $elements: a list of jquery elements to be passed as arg to the function | ||
* @param deferred: the deferred on which other deferreds will be chained | ||
* @param f: the function to be deferred | ||
* return : the chained deferred |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
odoo.define('web.clickEverywhere', function (require) { | ||
"use strict"; | ||
var ajax = require('web.ajax'); | ||
var startClickEverywhere = function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function startClickEverywhere () {
ajax.loadJS('web/static/src/js/tools/test_menus.js').then(
function() {
clickEverywhere();
}
);
}
@@ -307,6 +308,7 @@ | |||
<script type="text/javascript" src="/web/static/src/js/report/utils.js"/> | |||
<script type="text/javascript" src="/web/static/src/js/report/client_action.js"/> | |||
<link rel="stylesheet" type="text/scss" href="/web/static/src/scss/report_backend.scss"/> | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really useful...
This commit adds a new js test in web that enters each app and click on each view switcher, each menu and each search filter. This test is tagged '-standard' and 'click_all' as it could last a long time, that way it's not executed by default. It could also be started from the browser console with 'clickEverywhere();'.
e21948e
to
8704671
Compare
Description of the issue/feature this PR addresses: A test that open each installed App, switch each view, click on each menu and finally activate each filter.
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr