Skip to content

Commit

Permalink
[fc] Repository: Products.CMFPlone
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2018-12-18T09:21:23+01:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: plone/Products.CMFPlone@06f9676

Fixes #2669 robot test test_edit_user_schema

Files changed:
A news/2669.bugfix
M Products/CMFPlone/tests/robot/test_edit_user_schema.robot
Repository: Products.CMFPlone

Branch: refs/heads/master
Date: 2018-12-18T10:41:18+01:00
Author: agitator (agitator) <agitator@users.noreply.github.com>
Commit: plone/Products.CMFPlone@b9e8a59

Merge pull request #2670 from plone/jensens/fix-test_edit_user_schema-robot

Fixes #2669 robot test test_edit_user_schema

Files changed:
A news/2669.bugfix
M Products/CMFPlone/tests/robot/test_edit_user_schema.robot
  • Loading branch information
agitator committed Dec 18, 2018
1 parent 23c79b0 commit 65c16e6
Showing 1 changed file with 15 additions and 22 deletions.
37 changes: 15 additions & 22 deletions last_commit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,33 @@ Repository: Products.CMFPlone


Branch: refs/heads/master
Date: 2018-12-11T17:55:23+01:00
Author: Johannes Raggam (thet) <thetetet@gmail.com>
Commit: https://github.com/plone/Products.CMFPlone/commit/448c438094af580f95faa078882b1150ed9bf9c4
Date: 2018-12-18T09:21:23+01:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: https://github.com/plone/Products.CMFPlone/commit/06f9676673e9164c8fd3c57abe00e9d19f004338

Do not load the production bundles with async or defer
Hotfix: default.js and logged-in.js are not loaded asynchronously.
You also need to empty the ``merge_with`` property of your bundle, because production bundles (``default.js`` and ``logged-in.js``) are never loaded with async or defer.
The default.js includes jQuery and requirejs and those are needed at many places and therefore cannot be loaded asynchronously.
Fixes #2669 robot test test_edit_user_schema

Files changed:
M Products/CMFPlone/resources/browser/scripts.py
M Products/CMFPlone/static/plone.js
M Products/CMFPlone/tests/testResourceRegistries.py
M news/2649.feature
A news/2669.bugfix
M Products/CMFPlone/tests/robot/test_edit_user_schema.robot

b'diff --git a/Products/CMFPlone/resources/browser/scripts.py b/Products/CMFPlone/resources/browser/scripts.py\nindex 8cbf18107..38ecacbba 100644\n--- a/Products/CMFPlone/resources/browser/scripts.py\n+++ b/Products/CMFPlone/resources/browser/scripts.py\n@@ -154,11 +154,6 @@ def scripts(self):\n result = self.default_resources()\n result.extend(self.ordered_bundles_result())\n else:\n- # Acquire load_async and load_defer bundle options from the plone\n- # bundle and use it for the ``default`` meta bundle.\n- bundles = self.get_bundles()\n- load_async = getattr(bundles.get(\'plone\'), \'load_async\', False)\n- load_defer = getattr(bundles.get(\'plone\'), \'load_defer\', False)\n result = [{\n \'src\': \'{0}/++plone++{1}\'.format(\n self.site_url,\n@@ -166,15 +161,10 @@ def scripts(self):\n ),\n \'conditionalcomment\': None,\n \'bundle\': \'production\',\n- \'async\': \'async\' if load_async else None,\n- \'defer\': \'defer\' if load_defer else None\n- }, ]\n+ \'async\': None, # Do not load ``async`` or\n+ \'defer\': None # ``defer`` for production bundles.\n+ }]\n if not self.anonymous:\n- # Acquire load_async and load_defer bundle options from the\n- # plone-logged-in bundle and use it for the ``logged-in`` meta\n- # bundle.\n- load_async = getattr(bundles.get(\'plone-logged-in\'), \'load_async\', False) # noqa\n- load_defer = getattr(bundles.get(\'plone-logged-in\'), \'load_defer\', False) # noqa\n result.append({\n \'src\': \'{0}/++plone++{1}\'.format(\n self.site_url,\n@@ -182,8 +172,8 @@ def scripts(self):\n ),\n \'conditionalcomment\': None,\n \'bundle\': \'production\',\n- \'async\': \'async\' if load_async else None,\n- \'defer\': \'defer\' if load_defer else None\n+ \'async\': None, # Do not load ``async`` or\n+ \'defer\': None # ``defer`` for production bundles.\n })\n result.extend(self.ordered_bundles_result(production=True))\n \ndiff --git a/Products/CMFPlone/static/plone.js b/Products/CMFPlone/static/plone.js\nindex f89a02a65..f79f1fe81 100644\n--- a/Products/CMFPlone/static/plone.js\n+++ b/Products/CMFPlone/static/plone.js\n@@ -94,6 +94,6 @@ require([\n var select = $(\'#form-widgets-highpixeldensity_scales\');\n select.change(autohide_quality_fields);\n }\n-});\n+ });\n \n });\ndiff --git a/Products/CMFPlone/tests/testResourceRegistries.py b/Products/CMFPlone/tests/testResourceRegistries.py\nindex aef54fb37..393d24b60 100644\n--- a/Products/CMFPlone/tests/testResourceRegistries.py\n+++ b/Products/CMFPlone/tests/testResourceRegistries.py\n@@ -255,6 +255,10 @@ def test_bundle_defer_async(self):\n self.assertTrue(\'defer="defer"\' not in view.index(view))\n \n def test_bundle_defer_async_production(self):\n+ """The default and logged-in production bundles should never be loaded\n+ async or defered.\n+ For bundles to be loaded async or defered, you need to empty merge_with\n+ """\n registry = getUtility(IRegistry)\n \n bundles = registry.collectionOfInterface(\n@@ -277,17 +281,20 @@ def test_bundle_defer_async_production(self):\n self.assertTrue(\'defer="defer"\' not in view.index(view))\n \n bundles[\'plone\'].load_async = True\n- bundles[\'plone\'].load_defer = False\n- self.assertEqual(view.index(view).count(\'async="async"\'), 1)\n+ bundles[\'plone\'].load_defer = True\n+ self.assertEqual(view.index(view).count(\'async="async"\'), 0)\n self.assertEqual(view.index(view).count(\'defer="defer"\'), 0)\n \n- bundles[\'plone\'].load_async = False\n+ bundles[\'plone\'].merge_with = \'\'\n+ bundles[\'plone\'].load_async = True\n bundles[\'plone\'].load_defer = True\n- self.assertEqual(view.index(view).count(\'async="async"\'), 0)\n+ self.assertEqual(view.index(view).count(\'async="async"\'), 1)\n self.assertEqual(view.index(view).count(\'defer="defer"\'), 1)\n \n+ bundles[\'plone\'].merge_with = \'\'\n bundles[\'plone\'].load_async = True\n bundles[\'plone\'].load_defer = True\n+ bundles[\'plone-logged-in\'].merge_with = \'\'\n bundles[\'plone-logged-in\'].load_async = True\n bundles[\'plone-logged-in\'].load_defer = True\n self.assertEqual(view.index(view).count(\'async="async"\'), 2)\ndiff --git a/news/2649.feature b/news/2649.feature\nindex e3ac68ed8..fd1e5d455 100644\n--- a/news/2649.feature\n+++ b/news/2649.feature\n@@ -1,4 +1,6 @@\n - Add ``load_async`` and ``load_defer`` attributes to resource registries bundle settings.\n When set, ``<script>`` tags are rendered with ``async="async"`` resp. ``defer="defer"`` attributes.\n- In production mode, the setting from the ``plone`` resp. ``plone-logged-in`` bundles are used for the ``default`` resp. ``logged-in`` meta bundles (``merge_with`` setting). \n+ You also need to empty the ``merge_with`` property of your bundle, because production bundles (``default.js`` and ``logged-in.js``) are never loaded with async or defer.\n+ The default.js includes jQuery and requirejs and those are needed at many places and therefore cannot be loaded asynchronously.\n+ Refs: #2649, #2657.\n [thet]\n'
b'diff --git a/Products/CMFPlone/tests/robot/test_edit_user_schema.robot b/Products/CMFPlone/tests/robot/test_edit_user_schema.robot\nindex 7cde18701..8b2f83210 100644\n--- a/Products/CMFPlone/tests/robot/test_edit_user_schema.robot\n+++ b/Products/CMFPlone/tests/robot/test_edit_user_schema.robot\n@@ -93,9 +93,9 @@ I add a new text field to the member fields\n Wait until page contains element css=#add-field\n Click Button Add new field\xe2\x80\xa6\n Wait Until Element Is visible css=#add-field-form #form-widgets-title\n- Input Text css=#add-field-form #form-widgets-title test_field\n- Input Text css=#add-field-form #form-widgets-__name__ test_field\n- Select From List css=#form-widgets-factory Text line (String)\n+ Input Text css=#add-field-form #form-widgets-title Test Field\n+ Press Key css=#add-field-form #form-widgets-title \\\\09\n+ Select From List By Label css=#form-widgets-factory Text line (String)\n Click button css=.pattern-modal-buttons input#form-buttons-add\n # XXX: This is really really bad! We need a UI notification like:\n # Wait until page contains Field created.\n@@ -106,9 +106,9 @@ I add a new required text field to the member fields\n Wait until page contains element css=#add-field\n Click Button Add new field\xe2\x80\xa6\n Wait Until Element Is visible css=#add-field-form #form-widgets-title\n- Input Text css=#add-field-form #form-widgets-title test_field\n- Input Text css=#add-field-form #form-widgets-__name__ test_field\n- Select From List css=#form-widgets-factory Text line (String)\n+ Input Text css=#add-field-form #form-widgets-title Test Field\n+ Press Key css=#add-field-form #form-widgets-title \\\\09\n+ Select From List By Label css=#form-widgets-factory Text line (String)\n Select Checkbox form.widgets.required:list\n Click button css=.pattern-modal-buttons input#form-buttons-add\n # XXX: This is really really bad! We need a UI notification like:\ndiff --git a/news/2669.bugfix b/news/2669.bugfix\nnew file mode 100644\nindex 000000000..5e40df9ce\n--- /dev/null\n+++ b/news/2669.bugfix\n@@ -0,0 +1,3 @@\n+Fix robot test test_edit_user_schema:\n+Fieldname was set duplicate (first by JS, then by robot).\n+[jensens]\n'

Repository: Products.CMFPlone


Branch: refs/heads/master
Date: 2018-12-13T16:56:21+01:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: https://github.com/plone/Products.CMFPlone/commit/fdfbb7132aafb6118e17c26ad1c0043ce3aeb1df
Date: 2018-12-18T10:41:18+01:00
Author: agitator (agitator) <agitator@users.noreply.github.com>
Commit: https://github.com/plone/Products.CMFPlone/commit/b9e8a59baae55e60e53f8a8b7f88b000d24bbc8a

Merge pull request #2657 from plone/thet-async-defer-hotfix-52
Merge pull request #2670 from plone/jensens/fix-test_edit_user_schema-robot

Do not load the production bundles with async or defer (Plone 5.2)
Fixes #2669 robot test test_edit_user_schema

Files changed:
M Products/CMFPlone/resources/browser/scripts.py
M Products/CMFPlone/static/plone.js
M Products/CMFPlone/tests/testResourceRegistries.py
M news/2649.feature
A news/2669.bugfix
M Products/CMFPlone/tests/robot/test_edit_user_schema.robot

b'diff --git a/Products/CMFPlone/resources/browser/scripts.py b/Products/CMFPlone/resources/browser/scripts.py\nindex 8cbf18107..38ecacbba 100644\n--- a/Products/CMFPlone/resources/browser/scripts.py\n+++ b/Products/CMFPlone/resources/browser/scripts.py\n@@ -154,11 +154,6 @@ def scripts(self):\n result = self.default_resources()\n result.extend(self.ordered_bundles_result())\n else:\n- # Acquire load_async and load_defer bundle options from the plone\n- # bundle and use it for the ``default`` meta bundle.\n- bundles = self.get_bundles()\n- load_async = getattr(bundles.get(\'plone\'), \'load_async\', False)\n- load_defer = getattr(bundles.get(\'plone\'), \'load_defer\', False)\n result = [{\n \'src\': \'{0}/++plone++{1}\'.format(\n self.site_url,\n@@ -166,15 +161,10 @@ def scripts(self):\n ),\n \'conditionalcomment\': None,\n \'bundle\': \'production\',\n- \'async\': \'async\' if load_async else None,\n- \'defer\': \'defer\' if load_defer else None\n- }, ]\n+ \'async\': None, # Do not load ``async`` or\n+ \'defer\': None # ``defer`` for production bundles.\n+ }]\n if not self.anonymous:\n- # Acquire load_async and load_defer bundle options from the\n- # plone-logged-in bundle and use it for the ``logged-in`` meta\n- # bundle.\n- load_async = getattr(bundles.get(\'plone-logged-in\'), \'load_async\', False) # noqa\n- load_defer = getattr(bundles.get(\'plone-logged-in\'), \'load_defer\', False) # noqa\n result.append({\n \'src\': \'{0}/++plone++{1}\'.format(\n self.site_url,\n@@ -182,8 +172,8 @@ def scripts(self):\n ),\n \'conditionalcomment\': None,\n \'bundle\': \'production\',\n- \'async\': \'async\' if load_async else None,\n- \'defer\': \'defer\' if load_defer else None\n+ \'async\': None, # Do not load ``async`` or\n+ \'defer\': None # ``defer`` for production bundles.\n })\n result.extend(self.ordered_bundles_result(production=True))\n \ndiff --git a/Products/CMFPlone/static/plone.js b/Products/CMFPlone/static/plone.js\nindex f89a02a65..f79f1fe81 100644\n--- a/Products/CMFPlone/static/plone.js\n+++ b/Products/CMFPlone/static/plone.js\n@@ -94,6 +94,6 @@ require([\n var select = $(\'#form-widgets-highpixeldensity_scales\');\n select.change(autohide_quality_fields);\n }\n-});\n+ });\n \n });\ndiff --git a/Products/CMFPlone/tests/testResourceRegistries.py b/Products/CMFPlone/tests/testResourceRegistries.py\nindex aef54fb37..393d24b60 100644\n--- a/Products/CMFPlone/tests/testResourceRegistries.py\n+++ b/Products/CMFPlone/tests/testResourceRegistries.py\n@@ -255,6 +255,10 @@ def test_bundle_defer_async(self):\n self.assertTrue(\'defer="defer"\' not in view.index(view))\n \n def test_bundle_defer_async_production(self):\n+ """The default and logged-in production bundles should never be loaded\n+ async or defered.\n+ For bundles to be loaded async or defered, you need to empty merge_with\n+ """\n registry = getUtility(IRegistry)\n \n bundles = registry.collectionOfInterface(\n@@ -277,17 +281,20 @@ def test_bundle_defer_async_production(self):\n self.assertTrue(\'defer="defer"\' not in view.index(view))\n \n bundles[\'plone\'].load_async = True\n- bundles[\'plone\'].load_defer = False\n- self.assertEqual(view.index(view).count(\'async="async"\'), 1)\n+ bundles[\'plone\'].load_defer = True\n+ self.assertEqual(view.index(view).count(\'async="async"\'), 0)\n self.assertEqual(view.index(view).count(\'defer="defer"\'), 0)\n \n- bundles[\'plone\'].load_async = False\n+ bundles[\'plone\'].merge_with = \'\'\n+ bundles[\'plone\'].load_async = True\n bundles[\'plone\'].load_defer = True\n- self.assertEqual(view.index(view).count(\'async="async"\'), 0)\n+ self.assertEqual(view.index(view).count(\'async="async"\'), 1)\n self.assertEqual(view.index(view).count(\'defer="defer"\'), 1)\n \n+ bundles[\'plone\'].merge_with = \'\'\n bundles[\'plone\'].load_async = True\n bundles[\'plone\'].load_defer = True\n+ bundles[\'plone-logged-in\'].merge_with = \'\'\n bundles[\'plone-logged-in\'].load_async = True\n bundles[\'plone-logged-in\'].load_defer = True\n self.assertEqual(view.index(view).count(\'async="async"\'), 2)\ndiff --git a/news/2649.feature b/news/2649.feature\nindex e3ac68ed8..fd1e5d455 100644\n--- a/news/2649.feature\n+++ b/news/2649.feature\n@@ -1,4 +1,6 @@\n - Add ``load_async`` and ``load_defer`` attributes to resource registries bundle settings.\n When set, ``<script>`` tags are rendered with ``async="async"`` resp. ``defer="defer"`` attributes.\n- In production mode, the setting from the ``plone`` resp. ``plone-logged-in`` bundles are used for the ``default`` resp. ``logged-in`` meta bundles (``merge_with`` setting). \n+ You also need to empty the ``merge_with`` property of your bundle, because production bundles (``default.js`` and ``logged-in.js``) are never loaded with async or defer.\n+ The default.js includes jQuery and requirejs and those are needed at many places and therefore cannot be loaded asynchronously.\n+ Refs: #2649, #2657.\n [thet]\n'
b'diff --git a/Products/CMFPlone/tests/robot/test_edit_user_schema.robot b/Products/CMFPlone/tests/robot/test_edit_user_schema.robot\nindex 7cde18701..8b2f83210 100644\n--- a/Products/CMFPlone/tests/robot/test_edit_user_schema.robot\n+++ b/Products/CMFPlone/tests/robot/test_edit_user_schema.robot\n@@ -93,9 +93,9 @@ I add a new text field to the member fields\n Wait until page contains element css=#add-field\n Click Button Add new field\xe2\x80\xa6\n Wait Until Element Is visible css=#add-field-form #form-widgets-title\n- Input Text css=#add-field-form #form-widgets-title test_field\n- Input Text css=#add-field-form #form-widgets-__name__ test_field\n- Select From List css=#form-widgets-factory Text line (String)\n+ Input Text css=#add-field-form #form-widgets-title Test Field\n+ Press Key css=#add-field-form #form-widgets-title \\\\09\n+ Select From List By Label css=#form-widgets-factory Text line (String)\n Click button css=.pattern-modal-buttons input#form-buttons-add\n # XXX: This is really really bad! We need a UI notification like:\n # Wait until page contains Field created.\n@@ -106,9 +106,9 @@ I add a new required text field to the member fields\n Wait until page contains element css=#add-field\n Click Button Add new field\xe2\x80\xa6\n Wait Until Element Is visible css=#add-field-form #form-widgets-title\n- Input Text css=#add-field-form #form-widgets-title test_field\n- Input Text css=#add-field-form #form-widgets-__name__ test_field\n- Select From List css=#form-widgets-factory Text line (String)\n+ Input Text css=#add-field-form #form-widgets-title Test Field\n+ Press Key css=#add-field-form #form-widgets-title \\\\09\n+ Select From List By Label css=#form-widgets-factory Text line (String)\n Select Checkbox form.widgets.required:list\n Click button css=.pattern-modal-buttons input#form-buttons-add\n # XXX: This is really really bad! We need a UI notification like:\ndiff --git a/news/2669.bugfix b/news/2669.bugfix\nnew file mode 100644\nindex 000000000..5e40df9ce\n--- /dev/null\n+++ b/news/2669.bugfix\n@@ -0,0 +1,3 @@\n+Fix robot test test_edit_user_schema:\n+Fieldname was set duplicate (first by JS, then by robot).\n+[jensens]\n'

0 comments on commit 65c16e6

Please sign in to comment.