Commit Graph
8 Commits
Author SHA1 Message Date
Christophe Monniez 442c776cb6 [FIX] test_website: remove base_url from assertions
Since Werkzeug 2.1.0, the Response.autocorrect_location_header is
disabled by default.

As it's RFC compliant and supported by browsers, the base_url is simply
removed from the assertions.

Part-of: odoo/odoo#112298
2023-02-10 14:37:30 +01:00
Xavier-Do 503ed05029 [IMP] tests: add generic Basecase.start for patch
Using patcher.start() can easily lead to incorrect cleanup.
-> after a copy paste, patcher is working, but stop is forgotten
-> stop is present, but won't be called if something fails during the
test

This commit add an utility `start(patcher)` to always have the add
cleanup.

Using a standard way to start the patcher with an automated addCleanup
should prevent this kind of mistake. This is why this commit also
replaces all valid patch.start() (followed immediately by a addCleanup)

closes odoo/odoo#102873

X-original-commit: 7d5a193d86316965a0908c65cfacfb607dc3f3ad
Related: odoo/enterprise#32618
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2022-10-10 16:11:01 +02:00
Julien Castiaux 4174b330f7 [FIX] http_routing: /r russian vs /r link tracker
Install website_links, create a link e.g. to http://example.com, install
the russian language and translate the default website. Access the short
link you created before-hand, 404 website page not found.

Accessing a website starting with /r is ambiguous, is /r the
link-tracker controller or is /r a russian lang alias (nearest lang
algorithm)? The controller should be prioritary to the lang alias.

This restore the behavior as it was before the httpocalyse.

closes odoo/odoo#99555

X-original-commit: e8a1b4c0cdffb38e48ca980205a61c75c564dee8
Signed-off-by: Jérémy Kersten <jke@odoo.com>
Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-09-05 20:13:17 +02:00
std-odoo b7e5eb639a [FIX] link_tracker: clean code and fix add a constraint
Purpose
=======
Add a unicity constraint (on the url, UTM campaign, medium and source).
As we must care about null values, we can not implement it in SQL
(possible in pure SQL, but we will need to create an index on the
columns, which is not possible in Odoo if we want to customize the
error message).

Clean the code, before the "search or create" behavior was implemented
in the create, causing strange behavior (creating a link tracker with
the same values as an existing one didn't raise an error, but open
the form view of the existing link tracker).

Task-2090344

closes odoo/odoo#48845

Related: odoo/enterprise#9608
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-17 13:28:43 +00:00
Benoit Socias 90a7072f93 [FIX] website_links: not perform a request during automated test
This commit fixes the step trigger:
'#o_website_links_link_tracker_form
 #generated_tracked_link:contains("/r/")' that was taking too long
because of a call to _get_title_from_url happening during the creation
of a 'link.tracker'.

Before this commit the automated tests of website_links did trigger an
http request on the 'contactus' page which sometimes took too long to
respond and reached the test failure timeout.

After this commit the information obtained from this request is
hard-coded to avoid the unpredictable timing of the test.

This commit is a manual port of #62479.

task-2397724

closes odoo/odoo#62582

X-original-commit: db3296c034fe4c82d19580418fd5cdecdf578395
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-11-30 09:28:17 +00:00
Sébastien Theys df7326f0be [IMP] tests, *: add start_tour helper
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-04-04 08:44:59 +00:00
Romain Derie d0cd971afb [FIX] website_links: fix remaining bugs and restore skipped test
This commit is following c78da8a80 that fixed website_links module.

We had to merge it with a skipped test as there was an error only appearing
with Docker (on runbot or on local with Docker).

This commit fix that test error and some other remaining bugs not found during
the first fix:
1. Fix the test error by adding a step to show recently used links. Indeed the
   bug was that newest links would return inconsistent order as both 2 links
   created during the steps have the same creation date.
   On runbot it would click on the wrong link, the one which has 0 clicks.
   Then JS would crash (see error bellow).
2. `websiteLinksCharts` JS animation class would execute all the `start`
   method code even if there was no `_totalClicks`. JS would then crash as
   `beginDate` would not be set correctly. Before the refactoring all that code
   would be skipped as surrounded by an if/else condition.
3. BS3 to BS4 broke the nav-tabs layout to switch between 'Newest, Most Clicked
   and Recently Used. `mt16` needed to be removed.

Closes #31829
2019-03-18 13:54:11 +00:00
Romain Derie c78da8a80d [FIX] website_links: fix multiple bugs + add tests
Commit 6d67ce5b7c refactored the JS from multiple website modules including
`website_links`.
A few error needed to be fixed:
  - recent links would not appear anymore
  - graphs would not be displayed anymore
  - graph resize on tab change would not be fired

This commit fixes it and also add some tests to be sure this module is now
strongly tested.

Note: tests are skipped for now as there is a race condition happening only
      with docker and this fix is getting urgent for Odoo.com

closes odoo/odoo#31507

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2019-03-11 12:40:32 +00:00