summaryrefslogtreecommitdiff
path: root/addons/test_website
AgeCommit message (Collapse)Author
2021-04-27[FIX] website: use correct url code to get canonical urlRomain Derie
Before this commit, we would compare a lang `code` (used in context) and a lang `url_code`. For languages where those 2 are differents, the `if` condition would always be falsy, making the canonical URL impossible to be reached. Technically, this condition is used to get the translated name of records to later construct the canonical URL. Since the canonical URL will be incorrect and unreachable, the whole system to tell search engine/crawler about translation won't work since no `alternate/hreflang`[1] will be set in the DOM. [1] see https://developers.google.com/search/docs/advanced/crawling/localized-versions -------- Technical explanation: - italian language `code` = `it_IT`, `url_code` = `it` - belgian french language `code` = `fr_BE`, `url_code` = `fr_BE` Install those languages on website as secondary languages. Translate blog `Travel` to `Voyager` in french and `Viaggi` in italian. Visiting `/fr_BE/blog/travel-1/post/post-1` will redirect to `/fr_BE/blog/voyager-1/post/post-1` as it should, and the canonical URL will be set to that same URL. Visiting `/it/blog/travel-1/post/post-1` will redirect to `/it/blog/voyager-1/post/post-1` as it should, but the canonical URL will be set to `/it/blog/travel-1/post/post-1`. opw-2486918 closes odoo/odoo#69867 X-original-commit: 413357e0f4538ad441184d1d8b4c9a49fc18a5d9 Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
2021-01-25[IMP] test_website: add tests for controller slug matchingJeremy Kersten
Be sure that we have a beautiful error page and not a black/white error Be sure that slug_matching with 308 redirect works as expected and don't raise a RequestUID exception. closes odoo/odoo#64889 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-01-12[FIX] test_website: add tests for website.rewriteRomain Derie
Basic tests & tests of the 3 fixes of #64328
2020-12-09[FIX] web_editor, test_website: will fix the deletion of custom snippetsBenoit Socias
Before this commit the deletion of custom snippets failed because the button click event got intercepted by the drag'n'drop mechanism. The currentTarget of the event was used in an asynchronous call where it had already been replaced by the jQuery's event bubbling mechanism when invoking the other handler. After this commit the deletion of custom snippets works again and a test tour is introduced to make sure it does not get broken again task-2405854 closes odoo/odoo#62555 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-10-02[FIX] *: fix all the typosMartin Trigaux
And other reported English mistakes in source string Courtesy of Transifex translators And remove leftover from gengo closes odoo/odoo#59002 Related: odoo/enterprise#13776 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-09-22[IMP] web_editor, website, *: move text tools in snippets panelqsm-odoo
*: website_event, test_website This commit is a series of hacks. The goal is to move the summernote text tools to the editor panel for the website editor. All the code to use the text tools in a top bar is kept (mass mailing, etc) and the text tools are placed at the right place for website in an ugly way. This is obviously temporary, until we can implement those text tools more generically and in a better way thanks to the new editor. Part of https://github.com/odoo/odoo/pull/57975 task-2344227 closes odoo/odoo#57975 Related: odoo/design-themes#364 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-08-27[IMP] website, *: review existing navbar templates and templates systemCocographique
*: portal, website_sale, website_sale_wishlist Portal-without-website header is now more basic, without the need of a collapsed element. It is then entirely replaced when website is installed with header templates, t-calling all the main parts. Part of https://github.com/odoo/odoo/pull/56427 task-2264627 Co-authored-by: qsm-odoo <qsm@odoo.com>
2020-04-22[IMP] testing: forbid module operations during testingAdrian Torres
With this commit, module operations such as install, upgrades and uninstalls are henceforth forbidden inside unit tests and instead such tests must be performed with standalone Odoo scripts. This is done because module operations during tests are not transactional, this can leave the registry in an unclean state and further tests may be affected by this, it also creates a new registry which complicates registry cleanup if anything crashes, because the registry to be cleaned up is not the same one that crashed. Instead, what should be done is a script that imports odoo as a library, and loads the database necessary then performs whichever operations necessary. This script should contain a single function with a single parameter (env) and should be decorated with @odoo.tests.common.standalone in order to be executed properly, this decorator accepts any amount of positional parameters as tags that can be specified when calling the script in order to execute only a select subset of scripts. Special tags are: 'all' and <module_name>, these are generated automatically, the first will execute ALL scripts available whereas <module_name> will execute all scripts introduced by said module. When calling the test_module_operations script, only scripts found in *installed* modules will be executed, script discovery is only possible if the code is loaded therefore it is only possible if the module is installed. closes odoo/odoo#49669 Signed-off-by: Adrian Torres (adt) <adt@odoo.com>
2020-04-02[FIX] test_website: upgrading inside a test is really not a good ideaRaphael Collet
Because: (1) the upgrade starts by committing the current cursor; then (2) the upgrade instanciates a new registry to use for the database; and (3) the test cleanup involves setting up the old registry, which creates a new environment referring to the new registry! The points (2) and (3) makes the field setup crash when it relies on data stored on the registry itself: the field in the old registry tries to set up with data stored on the old registry. closes odoo/odoo#48920 X-original-commit: f5e5aba9e203b42b661cc3b503fd37051ec20f93 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-03-26[IMP] website: perf - add cache for website frequent fieldsJeremy Kersten
The dispatching layer of Odoo (common to any call) can avoid a query on website if those 3 values are cached. Note that for complex business flows, there won't be any gain since website infos will have to be fetched at some point. About user_id: In most cases, for a website page you will need to browse the website btw so we don't remove this request previously. But in case of a simple image, the controller /web/content need the public user just to set the request.uid in auth_public but no other info from website. With this commit, we don't do the 'select * from website where id in()' request on each controller declared in auth='public' but use the user_id from the cache. (Invalidated by the write on website_id) task-2211013 Co-authored-by: Jérémy Kersten <jke@odoo.com> Co-authored-by: Romain Derie <rde@odoo.com>
2020-03-26[IMP] website: clean and add perf testsRomain Derie
- Refactor for easier readability - Add a test to ensure menu hierarchy scale correctly. - Add tests for image controllers - Add test for assets controllers task-2211013
2020-01-21[FIX] website, test_website: problematic toursXavier Morel
Fix various tours which either have transient failures due to logging the entire browser lifecycle or don't deal well with the last step being suppressed if no explicit `run` is provided. * test_website: add a warning final step for the page reset as there's no way to actually run a tour step in the recovery page (because it's asset-less) * website: remove final step's action in reset password tour, it's relatively low-value and adding a proper followup is probably not worth the effort * website: add final check step in dashboard tour, as we want to check that the dashboard gets loaded, but we don't want that to be dangling
2019-11-26[FIX] website: match get/post in is_multilang_urlJeremy Kersten
Old heuristic is not more True: Force to check method to POST. Odoo uses methods : ['POST'] and ['GET', 'POST'] We have some controller that only allow 'GET' method, so we need to check GET also when we try to know if an url is multilang or not. This commit fix case where a controller '/test' only allow GET and you were in another language that the default, in this case, the rendered url in qweb was /get instead of /<lang>/get. Closes #37223 closes odoo/odoo#40519 X-original-commit: c7650106f8588083be12812600a6c94ba703fd6f Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-11-05[IMP] test_website: Adapt tests to work with/without demo dataYannick Tivisse
2019-10-22[FIX] website: clean sitemapJeremy Kersten
followup of 8a0fc6476c70a4126043de3b3efbd1096e41f968 task-2065018 closes odoo/odoo#39211 X-original-commit: bfa239b59c4d02c2b03ab8a84b52bc8f77704e41 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-10-18[FIX] website,*: remove useless route from sitemapJeremy Kersten
preparation for cleaning of v13 task-2065018 closes odoo/odoo#39051 X-original-commit: 8a0fc6476c70a4126043de3b3efbd1096e41f968 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-10-17[FIX] website: allow authenticate in json multidbJeremy Kersten
Before this commit launch a server with --db-filter that match at least 2 dbs name Try to authenticate You will have an error request is unbound when you try to access request.env Now we retrieve the user from self instead of the request. New test to ensure rpc authentication is tested. Related to commit 245ef4b1 closes odoo/odoo#38969 X-original-commit: 4b3400c430bec7539aada0619fd203978daca2d8 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-10-09[MERGE] forward port branch 13.0 up to f4105eb9c70Christophe Simonis
2019-10-02[IMP] http_routing, *: move error pages to http_routingfja-odoo
* = portal, website, test_website, account, sms Portal an Survey error pages were ugly default pages. Now the error pages will be the same as the website ones. Also fixing single module builds tests task-2059969 closes odoo/odoo#35535 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-09-12[IMP] gamification, *: remove KarmaErrorfja-odoo
* = stock, test_website, web, website_forum, website_slides, base Replace KarmaError with AccessError and remove the related override made on crash_manager and ir_http. task-2069890 closes odoo/odoo#36655 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-09-17[FIX] *: remove old deprecated modules/functionsJulien Castiaux
PEP-594 is deprecating a bunch of modules. As part of the cleanup, we are also dealing with long deprecated modules, functions and aliases. * `assert_` -> `assertTrue` * `assertEquals` -> `assertEqual` * `assertNotEquals` -> `assertNotEqual` * `assertAlmostEquals` -> `assertAlmostEqual` * `assertRaisesRegexp` -> `assertRaisesRegex` * `assertRegexpMatches` -> `assertRegex` * `base64.encodestring` -> `base64.encodebytes` * `base64.decodestring` -> `base64.decodebytes` * `inspect.getargspec` -> `inspect.signature` * `inspect.formatargspec` -> `inspect.signature` * `logging.warn` -> `logging.warning` closes odoo/odoo#36863 Task: 2003936 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-08-09[IMP] *: change title and subtitle of warningsfja-odoo
* = portal, test_website, web, website The title will now be "Someting went wrong." and we will no longer display the error type as it is not usefull info to the user. The message of the warning modal was not displayed right if too long. Now it will be displayed properly. Related to https://github.com/odoo/odoo/pull/32132 and https://github.com/odoo/odoo/pull/35209 Part of https://github.com/odoo/odoo/pull/35342 task-2047628
2019-08-03[IMP] *: correctly read/write website_publishedRomain Derie
The `website_published` field from the website's mixins is basically a readonly from `is_published` field. On read, this field will simply read `is_published` and check if the record's website_id is accessible (only for the multi mixin). On write, it will always write on `is_published`. This commit improves a few things: - A lot of code was writting on website_published which was just then writting on is_published. Writting directly on is_published makes more sense. - Some backend fields would still reference `website_published` instead of `is_published` which would just go through the related for no reason. Plus, using `is_published` will make the field tooltip more accurate as we are not in a website context ('Visible on current website' to 'Is Published') - Filter and search on tree view were still using the `website_published` related field, which is just a readonly when we are not in a frontend context. - Some create and write function would have security check on `website_published` value but that was wrong as the user could bypass that by simply writting on `is_published`. For the write method, check `is_published` is more accurate as it will cover both case since `website_published` will then call the write method on `is_published`
2019-06-28[IMP] web, *: display rpc warnings with toastsfja-odoo
* = test_website, partner_autocomplete - All the rpc warnings are now displayed using the notification system of https://github.com/odoo/odoo/commit/b94395b50175925fc7d1bd3655e5facb78a8ba2b - test_website is up to date Part of https://github.com/odoo/odoo/pull/32132 task-1894820
2019-06-28[IMP] base, web, *: make KarmaError an except_ormfja-odoo
* = gamification, test_website, stock - KarmaError is now handled as a 400 exception. - test_website has been updated. - NO_POSTMORTEM is now clean it was referencing duplicates as most the exceptions inherit from except_orm. - serialize_exception from http.py has been moved to ir_http to take advantage of the odoo inheritance system. We can then extend ir_http serialize_exception method to add the KarmaError logic if and only if gamification is installed. Places where serialize_exception was previously used are updated. Part of https://github.com/odoo/odoo/pull/32132 task-1894820
2019-06-28[IMP] test_website: add test tour for the website errorsfja-odoo
The purpose of these tests is to verify that errors informations are displayed correctly on the website. Part of https://github.com/odoo/odoo/pull/32132 task-1894820
2019-06-27[IMP] test_website: Add multi-company testlul-odoo
Purpose ======= This commit tests some behaviors with multi company mode after changes brought by f847a46. Specification ============= The website company should be automatically set in the context as 'allowed_company_ids'. That way, we can remove the switch company menu on the website, which doesn't make a lot of sense. This test enforce this behavior.
2019-06-08[IMP] odoo: ignore unsupported args from controllerJeremy Kersten
Before this commit, call a controller defined as: ``` @http.route('/route', type='http', auth='public') def controller_func(self, foo): do_it() ``` and called with url like /route?foo=1&bar=2 will crash with an exception: `TypeError: controller_func() got an unexpected keyword argument 'bar'` Now, we remove the extra parameters if the controller doesn't support it. This case is not uncommon, you can easily arrive in this case with utm or debug as extra parameter. closes odoo/odoo#33962 Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-06-05[IMP] *: move test and tour files to new folder hierarchy and assetRomain Derie
As we now have a new debug mode 'tests' which load a new asset bundle containing tour-test files, we moved those files to a new folder hierarchy. That will clean the .js files trees. Also, those files should be included in the new asset. Basically, the .js tour files (not test) should be inside /static/src/js/tours while .js tour test files (test=true) should be inside /static/tests/tours next to QUnit tests, inside a tours folder. + test_new_api: don't run the test in debug assets task-1934445 Comes with https://github.com/odoo/enterprise/pull/4281 Closes #33213
2019-04-04[IMP] tests, *: add start_tour helperSébastien Theys
Before this commit, the syntax to start a tour was extremely verbose. With this new method, it is possible to start a tour by just giving the essential parameter: the tour name. The full set of features from browser_js are kept by using **kwargs. closes odoo/odoo#32316 Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2019-03-29[IMP] website: adapt reset view code to single viewRomain Derie
Reset view feature code still had remains of initial release (Odoo 9.0). At that point all the view tree was returned, not only the broken view. Since it has been fixed in 12.0 and refactored in saas-12.3 with this PR, it now only takes the broken view as argument, handling multiple views has no sense anymore. Thus, this commit remove the (unused) multiple view compatibility. This commit also add a test to test the refactoring or this feature. Coming from #32009 (task-1943001)
2019-03-29[IMP] website: improve reset view featureRomain Derie
- Store previous arch to be able to reset it (soft reset) - Add the possibility to reset from file if possible (hard reset) - Adapt frontend reset page to these new fields - `arch_fs` hack to check if view was modified got moved to new field `arch_updated` as we now need to keep track of the `arch_fs` to reset a broken view. Closes #32009 (task-1943001)
2019-03-25[MERGE] forward port branch saas-12.2 up to 230ad8c381eChristophe Simonis
closes odoo/odoo#32088 Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-03-13[MERGE] forward port branch saas-12.2 up to c9f832d9f03Christophe Simonis
closes odoo/odoo#31790 Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-03-12[FIX] test_website: restore test now that fix has been forward-portedRomain Derie
Commit ef03db9ed added back the reset_templates functionality and some tests in Odoo 12.0. Commit fcb972db9 skipped one of the tests in Odoo saas-12.2 as there was a race condition (new editor). Commit 7c045dda0a fixed the race condition in Odoo 12.0 even if the error never showed, it was safer. Now that the fix got forward-ported to Odoo saas-12.2, we can add back the skipped test. closes odoo/odoo#31780 Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-03-11[MERGE] forward port branch saas-12.1 up to 2b3296bbf8bChristophe Simonis
2019-03-05[FIX] test_website: get rid of web_editor.baseAaron Bohy
Related to da1899af48902edec7ac6ed8dd5ae2f8b02ec689 closes odoo/odoo#31591 Signed-off-by: "Quentin Smetz (qsm)" <qsm@odoo.com>
2019-03-07[FIX] website: get the error view without parsing the view treeRomain Derie
Before this commit: The `if` condition doing a `View._views_get` was supposed to be a sort of 'hack' for when the error occured in a child view (as the template raised would be the parent, not the broken child). But since we refactored that part to use etree, it was actually going into that condition for every error even if the error was in the called template. Proof is, we only set `editable` in that if condition, meaning going in the else would actually prevent to show reset template. Indeed the following code would always be true: et = etree.fromstring(view.with_context(inherit_branding=False).read_combined(['arch'])['arch']) node = et.find(exception.path.replace('/templates/t/', './')) as read_combined returns all the view hierarchy DOM Note: We could not fix this by checking exception.path against `arch` as we could have false positive (eg the child view replace the <p> element by another <p> element which is broken, then the path would be found in the parent view even if the error was in the child view). closes odoo/odoo#31515 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-02-26[FIX] test_website: skip broken testChristophe Simonis
2019-03-07[FIX] website: fix install theme errorRomain Derie
Commit 5a81d8883 fixed the COW view deletion on module update but introduced an error when installing a theme. Indeed, when installing a theme, the first step is to remove the currently installed theme from the website (by unlinking its ir.ui.view). Commit 5a81d8883 introduced the fact that deleting an ir.ui.view during a module uninstall also search and delete the COW views, calling `_get_specific_views` (that expects a singleton). When installing a theme, it calls `_theme_cleanup` which search COW views and unlink them. If not cow view, unlink is called with an empty record set raising the singleton error. closes odoo/odoo#31662 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-03-05[FIX] website: delete cow view on module updateRomain Derie
Before this commit, when a view was removed during a module update (eg: the record was deleted from the file), its COW views would not be deleted. This could lead to unwanted behaviors including tracebacks(1). This commit is somehow related/an extension of b5fe23055d that handle COW view write during module update and 2e32cc5aa3 that remove COW views during module uninstall. task-1931683 Note: Some existing tests had to be run post install (1) A view doing a t-call is COW'd, then that view and its t-called view are removed. If the cow view is not removed, the t-call will crash (see tests in this commit for detailed case). closes odoo/odoo#31295 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-02-13[FIX] website: restore reset_templates functionalityRomain Derie
Since AST was introduced to compile Qweb templates, the reset templates functionality is not working anymore. Actually, it does not even appear anymore as the conditions to trigger and show the reset view behavior can't be True anymore. Indeed, the code is still importing the old QWebException from odoo.exceptions which is now just an empty class. The QWebException that should now be used is the one from odoo.base.models.qweb More than just a wrong import, the QWebException properties have completely changed. Since its last working version (Odoo 9.0), a lot of changes occured, mostly: - Odoo 11.0: new model website.page, which completely changed the pages behavior and changed the models. - Odoo 12.0: multi-website, which introduced the Copy On Write (COW) that redefined how we write on view in a website context. We now need to reset copied/specific views that have no model_data_id. This fix is for a stable version. There is some flows that can't be fixed without a refactoring or new fields (mainly because of the arch_fs being erased when writing on `arch`, plus we can't introduce a module reload in stable). The goal of this commit is to fix the basic and standard case of broken views, which is when non-technical users are breaking the views through HTML editor. To reset the views, we will read the original arch in the XML file, as the dev mode is doing. To be eligible for the reset, the broken view need an `arch_fs` set. If the view arch has been modified anywhere else than the frontend, the `arch_fs` will be erased and the view wont be able to be reset. As the broken views will be specific views, we will simply read the generic view in the XML file and write it on the specific. We can't simply remove the specific view as we might be on a specific tree. Specific case, in case of custom views create dropping a snippet in an oe_struc we just delete this inehrited view to allow end user to have their page back. In some case of bad compilation in sub template, we try to guess which inherited view, t-called view is broken by string matching based on 'last_path_node' xpath. Add new module test_website to add tests, it will be usefull for futur test of install/uninstall and ... Todo in master: - try to track on QWebException the real template that is broken and not only the last node from the main template. Co-authored-by: "Romain Derie <rde@odoo.com>" Co-authored-by: "Jérémy Kersten <jke@openerp.com>" closes odoo/odoo#29957
2019-02-27[FIX] test_website: remove race condition and restore testRomain Derie
Commit fcb972d skipped a test on saas-12.2 after forward port as it was not working on that version. This commit restore the test and fix it. It was actually a race condition on the save step on edit mode. Something similar was done already for another test, see 74a98ea. closes odoo/odoo#31465