summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2021-01-19 14:57:36 +0000
committerqsm-odoo <qsm@odoo.com>2021-01-19 15:16:12 +0000
commitfe19b48831df17352ea7dbb0b7fa2497ac2da38f (patch)
tree32d26e535da53e7a89d7782cf89e8b9ed33142a8 /addons
parentf29e9e5edbe08e1a356ceb7c2dbb2f60fb6d3ff5 (diff)
[IMP] website: test a website style can properly be edited
This test at least ensures that a SCSS edition through the editor can properly be done and indirectly tests that the assets order is correct (in prevision of a future asset refactoring). closes odoo/odoo#64754 Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/website/static/tests/tours/website_style_edition.js34
-rw-r--r--addons/website/tests/test_ui.py3
-rw-r--r--addons/website/views/assets.xml1
3 files changed, 38 insertions, 0 deletions
diff --git a/addons/website/static/tests/tours/website_style_edition.js b/addons/website/static/tests/tours/website_style_edition.js
new file mode 100644
index 00000000000..1f4033eb46d
--- /dev/null
+++ b/addons/website/static/tests/tours/website_style_edition.js
@@ -0,0 +1,34 @@
+odoo.define("website.tour.website_style_edition", function (require) {
+"use strict";
+
+const tour = require("web_tour.tour");
+
+const TARGET_FONT_SIZE = 30;
+
+tour.register("website_style_edition", {
+ test: true,
+ url: "/",
+}, [{
+ content: "Enter edit mode",
+ trigger: 'a[data-action=edit]',
+}, {
+ content: "Go to theme options",
+ trigger: '.o_we_customize_theme_btn',
+}, {
+ content: "Change font size",
+ trigger: '[data-variable="font-size-base"] input',
+ run: `text_blur ${TARGET_FONT_SIZE}`,
+}, {
+ content: "Save",
+ trigger: '[data-action="save"]',
+}, {
+ content: "Check the font size was properly adapted",
+ trigger: 'body:not(.editor_enable) #wrapwrap',
+ run: function (actions) {
+ const style = window.getComputedStyle(this.$anchor[0]);
+ if (style.fontSize !== `${TARGET_FONT_SIZE}px`) {
+ console.error(`Expected the font-size to be equal to ${TARGET_FONT_SIZE}px but found ${style.fontSize} instead`);
+ }
+ },
+}]);
+});
diff --git a/addons/website/tests/test_ui.py b/addons/website/tests/test_ui.py
index 07677e50252..d76bf22cf81 100644
--- a/addons/website/tests/test_ui.py
+++ b/addons/website/tests/test_ui.py
@@ -189,3 +189,6 @@ class TestUi(odoo.tests.HttpCase):
""",
}])
self.start_tour("/", 'snippet_version', login='admin')
+
+ def test_08_website_style_custo(self):
+ self.start_tour("/", "website_style_edition", login="admin")
diff --git a/addons/website/views/assets.xml b/addons/website/views/assets.xml
index e6a65bc7afd..3b2dacefe5c 100644
--- a/addons/website/views/assets.xml
+++ b/addons/website/views/assets.xml
@@ -28,6 +28,7 @@
<script type="text/javascript" src="/website/static/tests/tours/public_user_editor.js"/>
<script type="text/javascript" src="/website/static/tests/tours/website_navbar_menu.js"/>
<script type="text/javascript" src="/website/static/tests/tours/snippet_version.js"/>
+ <script type="text/javascript" src="/website/static/tests/tours/website_style_edition.js"/>
</xpath>
</template>