Skip to content
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

Merged
merged 2 commits into from
Aug 29, 2018

Conversation

d-fence
Copy link
Contributor

@d-fence d-fence commented Jul 14, 2018

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

@d-fence d-fence requested a review from ged-odoo July 14, 2018 08:37
@d-fence
Copy link
Contributor Author

d-fence commented Jul 14, 2018

Hello @ged-odoo , I need to rebase but I finally found how to handle the filter options problem.
So it works.
I didn't find why it cycles in an infinite loop. So I resolve the deferred when each App is tested.
See you on monday.

@nhomar
Copy link
Collaborator

nhomar commented Jul 15, 2018

What a beautiful thing, this tests should come more often.!

@d-fence
Copy link
Contributor Author

d-fence commented Jul 15, 2018

@nhomar Thanks !
We plan to run it each night.
I just ran the test in community and it took 1542 seconds (25 minutes) to complete.
I'll test it in enterprise tomorrow.

@nhomar
Copy link
Collaborator

nhomar commented Jul 15, 2018

@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!

Copy link
Contributor

@ged-odoo ged-odoo left a 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;
Copy link
Contributor

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);
Copy link
Contributor

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.
Copy link
Contributor

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', ],
Copy link
Contributor

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?

Copy link
Contributor Author

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() {
Copy link
Contributor

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
*/
Copy link
Contributor

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){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$element is not a jquery element => element (no $)

};


function testViews() {
Copy link
Contributor

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){
Copy link
Contributor

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
     */

Copy link
Contributor

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
Copy link
Contributor

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}
     */

@C3POdoo C3POdoo added the RD research & development, internal work label Jul 16, 2018
@d-fence
Copy link
Contributor Author

d-fence commented Jul 18, 2018

Now it works in enterprise too but takes 1985 seconds (33 minutes)

@d-fence d-fence force-pushed the master-imp-click_all_test-moc branch from 8746812 to 286abb2 Compare August 7, 2018 10:21
@d-fence d-fence force-pushed the master-imp-click_all_test-moc branch 6 times, most recently from 099f013 to e508554 Compare August 24, 2018 15:01
@d-fence d-fence force-pushed the master-imp-click_all_test-moc branch 2 times, most recently from cbc3de3 to d2b7371 Compare August 27, 2018 14:20
@ged-odoo
Copy link
Contributor

target branch

@ged-odoo
Copy link
Contributor

add menu in debug manager to run test

@d-fence d-fence changed the base branch from master to saas-11.5 August 29, 2018 08:46
@d-fence d-fence force-pushed the master-imp-click_all_test-moc branch from d948f65 to e21948e Compare August 29, 2018 11:36
@d-fence
Copy link
Contributor Author

d-fence commented Aug 29, 2018

@ged-odoo I think it's finished. I added the debug manager menu entry.

Copy link
Contributor

@ged-odoo ged-odoo left a 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
Copy link
Contributor

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({
Copy link
Contributor

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}
Copy link
Contributor

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}
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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() {
Copy link
Contributor

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"/>

Copy link
Contributor

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();'.
@d-fence d-fence force-pushed the master-imp-click_all_test-moc branch from e21948e to 8704671 Compare August 29, 2018 14:55
@d-fence d-fence merged commit 984554f into odoo:saas-11.5 Aug 29, 2018
@d-fence d-fence deleted the master-imp-click_all_test-moc branch September 2, 2018 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants