Commit Graph
75 Commits
Author SHA1 Message Date
Christophe Monniez b356b19033 [IMP] tests: Add the possibility to tag tests
Purpose: When running tests, all the tests for the installed/updated
files are done. This commit adds a 'tagged' decorator that can be used to
tag tests. Combined with a new 'test-tags' CLI option, it adds the ability
to filter which tests are executed. For example, @tagged('slow') will
add a tag 'slow' to the test. The CLI option 'test-tags="slow"' will
only run tests tagged 'slow'.

One can use prefixes to select cases with tags.
'+' or no prefix means that the tests tagged with this tag are selected
for execution. '-' prefix will exclude the tests tagged with this tag.
Exclusion takes precedence over inclusion.

Also, by default, all Odoo tests cases are tagged 'standard' and with
the technical name of the module.
This means that when selecting tests with the 'test-tags'
parameter, if '-standard' is not specified, all tests tags are
going to be executed.
When tagging tests, one can remove such automatic tag by prefixing the
tag name with '-'. E.g. @tagged('-standard') will remove the standard
tag from the test.

Another example, if one wants to test the 'sale' module alone,
even without adding any 'tagged' decorator thos tests can be selected
like that: --test-tags="sale"

Tests are selected or deselected using a TagsSelector. When instanciated,
 a string is passed with comma separated tests selectors like
'+slow,-standard'. When the 'check' method is called  with a test as argument,
it returns True or False if the test has to be executed or not.
2018-01-18 13:20:37 +01:00
qsm-odoo 2972976962 [REF] web_editor, website, *: complete refactoring
* mass_mailing, payment, point_of_sale, portal, survey, web, web_tour,
  website_blog, website_crm_partner_assign, website_event,
  website_event_questions, website_form, website_forum, website_gengo,
  website_hr_recruitment, website_links, website_mail,
  website_mail_channel, website_mass_mailing, website_quote,
  website_sale, website_sale_options, website_slides, website_twitter

This commit reviews the whole "JS side" of the web_editor and website
apps. This is a first step to be able to improve them with new and
better functionnalities; this commit is not supposed to change any
visual behavior.

The main goal was to achieve a structure similar to the backend one.
Now, the frontend side also has a root widget (like the WebClient)
and all other widgets are attached to it one way or another. This allows
the benefits of using the 'trigger_up' functionnality for example.

As RPC are now mainly done with the `this._rpc` functionnality (being
possible thanks to the parent hierarchy), the frontend will also be
possible to test thanks to QUnit in a future update (besides the "text"
editor side which still requires a refactoring to be able to do that).

---

Here are some of the changes:

(-) conventions and documentation

The code has been updated to follow JS conventions and a lot of code has
been commented (around +2000 lines of comment). This also means that
lots of functions have been renamed to use camelCase or simply to make
their name understandable.
See https://github.com/odoo/odoo/wiki/Javascript-coding-guidelines.

(-) deprecated: web_editor.base

The "web_editor.base" module has been split and does not force the
modules which require it to wait for DOM ready anymore. This was indeed
slowing loading times, but also prevented to use some modules in some
contexts (see the LESS editor use in web_studio which is the subject of
another task).
Now the "editor context" can be got thanks to the "web_editor.context"
JS module with its "get" function.
The "web_editor.base" module should probably not be used anymore (see
its code and recent updates).

(-) new: web.dom_ready

If a JS module should wait for the DOM to be ready to be executed, a
new JS module has been created: "web.dom_ready". This should always
be used in a module which only want to instantiate stuff. Do not
extend (or worst, include) classes after DOM ready.

(-) website.website

The "website.website" module has been split. "website.website" does not
return anything useful anymore, it just initialize some miscellaneous
stuff, without waiting for the DOM to be ready. You might want to check
"website.utils", "website.content.compatibility" or `WebsiteRoot`. Also
`website.form` has been deleted (use `this._rpc`), so has been
`website.error`. `website.prompt` will be removed in a future update to
be replaced by `Dialog.prompt`.

(-) widgets are great

Many classes which were not widgets are now widgets. This allows them to
use the 'events', the 'xmlDependencies' and the 'this._rpc' features for
example. Here are some of the main ones:

- Snippet options: these were classes with a `$el` for the menu element
    and `$target` for the customized element. This is still the case
    but following standard `Widget` structure (one exception: using
    `this.$(...)` searches in the `$target` as before this update).

- Snippet animations: instead of class instances with a `$target`
    element which can be `start` and `stop`, these are now standard
    widgets which can be `start` and `destroy`. `this.$target` is
    an alias to `this.$el` for ease of compatibility.

- Snippet editors: instead of class instances in charge of an editor
    overlay, these are now widgets. Each "child" snippet editor is
    properly attached as a "child", which allows editors to communicate
    and to be properly destroyed.

(-) root widgets and website navbar

The frontend is different of the backend. In the backend, the page has
an empty <body/> element and all the components are instantiated from
parent to children (i.e. the `WebClient` is instantiated and is in
charge of instantiating the `ControlPanel`, etc). The frontend cannot
work like that on page loadings as they are way more frequent than in
the backend and we do not want them to flicker. A frontend page is
loaded as a <body/> element which already contains the website navbar
and its menus and the whole content page. JS code has to be "attached"
to these existing elements. This is possible thanks to the `RootWidget`
instances and the specialized `WebsiteRoot`, `IframeRoot` and
`WebsiteNavbar` (see code for details).

(-) lazy loading

No more (or at least a lot less) XML/JS has to be loaded on page
loading, thanks to the use of the `Widget.xmlDependencies` feature.
XML which have to be lazy loaded is loaded only on related Widget
instantiation if necessary, which allows to execute a lot of JS code
before the DOM is ready and to start many widgets on DOM ready (not
later). A visual benefit of this is clicking on the 'edit' button as
soon as it is possible: before this commit, this was sometimes not
doing anything as event handlers were not binded yet.

Still a possible exception: loading the session and locales. This may
be asynchronous stuff which is still required before widget
instantiations but this will be the subject of another task.

(-) deprecated code and code location

More than reviewing code and organizing it, many apparent dead code was
removed. More importantly, mislocated code was put in the right app.
This is the case for snippet animations which is a concept for website
apps but was defined in the web_editor app, or some translation concepts
which were part of website but should have been part of web_editor.

---

There are probably more things to say about this commit but I will let
the comments speak for those.
2017-08-16 11:04:14 +02:00
Christophe Matthieu ea1c061e11 [IMP] website: convert tours to use web_tour.tour 2016-08-30 13:54:28 +02:00
qsm-odoo f9a84b5ebc [IMP] web_tour, *: allow to properly extend tours
* crm, project, website, website_event, website_blog, website_forum,
website_sale

Eg: the tour 'shop_buy_product' is extended by the website_sale_options
addons to add a step to close a modal.

The current solution was requiring the module that defines the tour
to extend, then add/remove steps in the "step" key of the tour
definition.
Some of the problems with this method were:
* The "register" method calls the "update" method to immediately
search for tip to place once registered (as register may be called
after the DOM is ready). So extensions of tours were happening after
the tours were started (and the tours were not restarted).
* The addition/removal of steps was happening after they were filtered
according to the "edition" key.

To allow extension, the system is changed as follow:
* The "register" method now only saves the steps and options without
modifying them and does not call the "update" method.
* Once the DOM was ready, the tour service started listening to DOM
mutations and called the "update" tour method. Now, this "update" call
is replaced by a "_register_all" call, on DOM ready and at the end of
the current call stack (which makes sure all modules are loaded). This
"_register_all" method marks the registered tours as ready after having
filtered the steps according to the "edition" key and initialized the
current step to trigger.
* Also, tours can now define a "wait_for" option which allow them to
be marked as ready for run and update after the given deferred. Those
tours can now also be extended without having to wait for the deferred.
PhamtomJS must wait for the "ready" key to be true to run the tour.
2016-08-26 13:39:55 +02:00
Jérome Maes 8a399930f3 [REF] website_*: remove render method on website
Since saas-3, website controllers use `request.website.render`
to render the template of a web page. This was kept for retro
compatibility. It's time to stop using deprecated stuff.
Same for `_render` method on website.

'json' route don't use `request.render` since
`JsonRequest` has no `render` method.
2016-08-04 12:02:14 +02:00
Ravi Gadhia fd09ddb6f3 [MIG] website: migration to new api
Migration of website module to new API.
The tricky phase is ir_http.py : we need to use `request.env`
only when the authenfication phase is done. Normally by
calling `super` of `_dispatch` method, but website module
required it to be done before. This is important since
`env`is a lazy property of `request` object.

Some hack were kept since this commit is a migration ('RequestUID'
in ir.http, ...)

Some docstrings were added.
2016-08-04 12:02:14 +02:00
qsm-odoo eaf8e82efb [IMP] *: activate automatic tour tests
* project, crm, point_of_sale, website, website_sale, website_blog,
website_event, website_forum
2016-07-18 14:22:29 +02:00
Christophe Matthieu 087fd6942b [IMP] web_editor: add test translator 2015-07-10 17:00:15 +02:00
Christophe Matthieu 8c559044a5 [IMP] web_editor: split website into web_editor (to use editor in backend for html field) and website 2015-07-10 17:00:11 +02:00
Géry Debongnie ebc39b8788 [FIX] update tests to new module system
Various tests (mostly tours) were broken with the large changes in the
way the js code works.
2015-03-18 09:23:37 +01:00
Christophe Matthieu 9069d0127c [IMP] website: use the new summernote editor 2015-01-05 10:59:42 +01:00
Leonardo Donelli 4a0b13ed92 [REF] remove vim modelines and resulting trailing blank lines
Let 2015 be a year without modelines!
cf #4174
2014-12-31 15:52:13 +01:00
Simon Lejeune 195fa93168 [MERGE] backend front end integration
Render the top-menu (backend menu or frontend editbar) server-side.
Use Fontawesome icons (mail, timezone, chat).
Refactor website widgets, split Website.editorBarin editorbar, ace, editorbar- content, editorbarCustomize.
2014-06-27 11:03:34 +02:00
Christophe Matthieu bc3fc54fac [IMP] Tour: add tour in web module; tour became available in backend. 2014-06-18 12:25:13 +02:00
chm@openerp.com 62814f9c23 [FIX] website: activate new tour tests
bzr revid: chm@openerp.com-20140324081112-15n58puu29weydme
2014-03-24 09:11:12 +01:00
Antony Lesuisse 0772c99bcb [FIX] website test, remove useless test, waitfor banner fix
bzr revid: al@openerp.com-20140316144546-agpgmlwxa532xxmb
2014-03-16 15:45:46 +01:00
Xavier Morel 55a9e5af27 [FIX] re-enable website_sale tests because they pass so whatever
bzr revid: xmo@openerp.com-20140219144754-52dz24qmnjq72zor
2014-02-19 15:47:54 +01:00
Xavier Morel a77097ce60 [REM] broken and PITA test_02_public_login_logout
* / fails to load, it turns out Tour is undefined because unlogged home does
  not load bootstrap-tour

* after injecting bootstrap-tour, redirects to /login (to log in), tries to
  inject tour again except this time ``openerp.website`` is completely empty
  (although it is present on the page), no idea why.

removed test because whatever, if enable-test-fix-tour is ever rewritten and
fixed it may reappear.

bzr revid: xmo@openerp.com-20140219142115-5kpu5uvzpkwnt1ef
2014-02-19 15:21:15 +01:00
Xavier Morel 86a537e6a7 [FIX] typo method name
bzr revid: xmo@openerp.com-20140219140241-5p6u4t818mkuo74w
2014-02-19 15:02:41 +01:00
Xavier Morel 61c82f28a4 [FIX] imports, use @expectedFailure, simplify some inject specs
bzr revid: xmo@openerp.com-20140218160339-2r34z4ks2o4lriu5
2014-02-18 17:03:39 +01:00
Xavier Morel c42f9553ec [IMP] remove pointless semicolons, use @expectedFailure instead of commenting broken test
bzr revid: xmo@openerp.com-20140218140610-t4amo9b2jjkk2r0h
2014-02-18 15:06:10 +01:00
Antony Lesuisse 2112eb6448 [FIX] website_sale enable some tests
bzr revid: al@openerp.com-20140217012827-3rb4mrkgx3ubp0dx
2014-02-17 02:28:27 +01:00
Antony Lesuisse e54758988a [FIX] website tests
bzr revid: al@openerp.com-20140217001148-2ub37hxyz8tbxrwe
2014-02-17 01:11:48 +01:00
Christophe Simonis f6422470dd ಠ_ಠ
bzr revid: chs@openerp.com-20140213152348-alye3ovcn2y53xp3
2014-02-13 16:23:48 +01:00
Antony Lesuisse 9c7f132a7a [IMP] website test_ui simplification
bzr revid: al@openerp.com-20140210005926-03hhcm56gpplgbt2
2014-02-10 01:59:26 +01:00
Antony Lesuisse bf2198e4c8 [IMP] website test shorter code
bzr revid: al@openerp.com-20140209234531-0i2xgr94yjaqzen8
2014-02-10 00:45:31 +01:00
Antony Lesuisse a21b1c4f8c [IMP] test_ui conversion, needs validation from chm
bzr revid: al@openerp.com-20140209232040-12uq85pseheth8z0
2014-02-10 00:20:40 +01:00
Christophe Matthieu efe1e4a183 [FIX] website test: remove hack for runbot
bzr revid: chm@openerp.com-20140207155454-jf3pwp3hl9nvay6m
2014-02-07 16:54:54 +01:00
Christophe Matthieu d432e56661 [FIX] website: for activate test on runbot
bzr revid: chm@openerp.com-20140207143241-e4u7ikvgbl0f980d
2014-02-07 15:32:41 +01:00
Christophe Matthieu 6cb5b1e556 [FIX] website: test tour: use admin insead of tools.config['admin_passwd']
bzr revid: chm@openerp.com-20140207130104-nuwurzlsvt4cu1jr
2014-02-07 14:01:04 +01:00
Christophe Matthieu b21bb08c22 [ADD] website: test login, backend, go back, branding, edit, logout
bzr revid: chm@openerp.com-20140207125231-3zd0i1axdwuht5g4
2014-02-07 13:52:31 +01:00
Christophe Matthieu 4663f5b10c [IMP] website test: add a timeout in phantom js to raise a better error and improve log error
bzr revid: chm@openerp.com-20140207074745-ffrcoi2aj5m67i8m
2014-02-07 08:47:45 +01:00
Christophe Matthieu e8964f896c [FIX] website: tour, test and test_runner
bzr revid: chm@openerp.com-20140206140746-jmeyx8q9qxv7sz1j
2014-02-06 15:07:46 +01:00
Antony Lesuisse 1c283ddf24 phantomjs segfaults
bzr revid: al@openerp.com-20140131002019-tbvgpunj6kj6675v
2014-01-31 01:20:19 +01:00
Christophe Matthieu 4e68fff52e [FIX] website_sale: demo data, test, delivery, context pricelist
bzr revid: chm@openerp.com-20140123104705-679zt0odq0pseu7p
2014-01-23 11:47:05 +01:00
Fabien Meghazi df63fcba81 [MERGE] upstream
bzr revid: fme@openerp.com-20140122102232-77lvvwpzet58sa7p
2014-01-22 11:22:32 +01:00
Christophe Matthieu 53d8280f1d [IMP] website: test class with test for website_sale sale process
bzr revid: chm@openerp.com-20140120182643-tw65rig4qqi3sqqf
2014-01-20 19:26:43 +01:00
Fabien Meghazi 96c79572f8 [FIX] test ui should use /login route for auto login
bzr revid: fme@openerp.com-20140115161318-v8ksw0u0u1mpgn0x
2014-01-15 17:13:18 +01:00
Fabien Meghazi 876760bec4 [IMP] Ignore phantomjs Warnings for ui tests
bzr revid: fme@openerp.com-20140115153235-hicqe8foynkc14yj
2014-01-15 16:32:35 +01:00
ddm@openerp.com 492af3afbf [IMP] attempt to fix intermittent UI test errors
bzr revid: ddm@openerp.com-20140109104234-x1on4xm0hkdym2l8
2014-01-09 11:42:34 +01:00
ddm@openerp.com 7d7cada5d6 Rename
bzr revid: ddm@openerp.com-20140108101857-2tr49ax6qataoiw8
2014-01-08 11:18:57 +01:00
ddm@openerp.com a56ab27bfb Remove useless comments
bzr revid: ddm@openerp.com-20140108100333-ji1dff867e7rqjaj
2014-01-08 11:03:33 +01:00
ddm@openerp.com 56e5fc3c05 [FIX] UI blog tests
bzr revid: ddm@openerp.com-20140107171841-ysj0qzb9g3hqbvad
2014-01-07 18:18:41 +01:00
ddm@openerp.com 2c46694462 [FIX] phantom 1.9.2 OS X 10.9 bug
bzr revid: ddm@openerp.com-20140107114740-7d2444m2fma44v69
2014-01-07 12:47:40 +01:00
ddm 0e430008bd [IMP] Added blog UI test
bzr revid: ddm@openerp.com-20140102151115-16mlisduee7zav6g
2014-01-02 16:11:15 +01:00
ddm c71318e342 [FIX] UI test runner snafu
bzr revid: ddm@openerp.com-20140102103629-r6sjvevgsihricte
2014-01-02 11:36:29 +01:00
ddm 8baadbd7b1 [IMP] code cleanup + comments
bzr revid: ddm@openerp.com-20131231142824-rxyge2oupzaym6mh
2013-12-31 15:28:24 +01:00
ddm 1bfa357e2c [FIX] Broken test runner
bzr revid: ddm@openerp.com-20131230163032-dbzgro9noo2nbtjc
2013-12-30 17:30:32 +01:00
ddm 1813715892 [FIX] Extra long delay for runbot
bzr revid: ddm@openerp.com-20131230161333-e3ibc6b2v33dx31z
2013-12-30 17:13:33 +01:00
ddm 5b55fa570d [FIX] Larger timeout for UI tests
bzr revid: ddm@openerp.com-20131230144702-2ydq0wfc1it4b43t
2013-12-30 15:47:02 +01:00