Skip to content

Commit

Permalink
Merge pull request #4019 from plone/port-robot-tests
Browse files Browse the repository at this point in the history
Port robot tests
  • Loading branch information
petschki authored Oct 18, 2024
2 parents 4d49209 + 0c23372 commit a840a70
Show file tree
Hide file tree
Showing 42 changed files with 2,156 additions and 3,430 deletions.
28 changes: 28 additions & 0 deletions Products/CMFPlone/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
from Products.MailHost.interfaces import IMailHost
from zope.component import getSiteManager
from zope.configuration import xmlconfig
from plone.autoform.form import AutoExtensibleForm
from plone.app.z3cform.widget import SelectWidget
from plone.autoform import directives
from z3c.form import form
from zope.schema import Choice
from zope.schema import List
from zope.interface import Interface

import doctest

Expand Down Expand Up @@ -115,3 +122,24 @@ def setUpPloneSite(self, portal):
)

optionflags = doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE


class ITestSelectWidgetSchema(Interface):

directives.widget('select_field', SelectWidget)
select_field = Choice(
title=u'Select Widget',
values=['one', 'two', 'three', ]
)

directives.widget('list_field', SelectWidget)
list_field = List(
title=u'Select Multiple Widget',
value_type=Choice(values=['four', 'five', 'six', ]),
)


class TestSelectWidgetForm(AutoExtensibleForm, form.EditForm):

schema = ITestSelectWidgetSchema
ignoreContext = True
7 changes: 7 additions & 0 deletions Products/CMFPlone/tests/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,11 @@
permission="zope2.View"
/>

<browser:page
for="*"
name="select-widget-view"
class="..testing.TestSelectWidgetForm"
permission="zope2.View"
/>

</configure>
69 changes: 0 additions & 69 deletions Products/CMFPlone/tests/robot/common.robot

This file was deleted.

88 changes: 71 additions & 17 deletions Products/CMFPlone/tests/robot/keywords.robot
Original file line number Diff line number Diff line change
@@ -1,39 +1,93 @@
*** Keywords *****************************************************************
*** Keywords ***

# --- SETUP ------------------------------------------------------------------
# SETUP

Refresh JS/CSS resources
# Not needed anymore, and it is breaking the Plone Zope 4 tests.
# Keep the keyword for backwards compatibility purposes.
Sleep 0.0000001

# --- GIVEN ------------------------------------------------------------------
# GIVEN

a logged-in manager
Enable autologin as
... Manager

a logged-in member
Enable autologin as
... Member

a logged-in site administrator
Enable autologin as Site Administrator Contributor Reviewer
Enable autologin as
... Site Administrator
... Contributor
... Reviewer


a document '${title}'
Create content type=Document id=doc title=${title}
Create content
... type=Document
... id=doc
... title=${title}

a file '${title}'
Create content type=File id=file title=${title}
Create content
... type=File
... id=file
... title=${title}

a news item '${title}'
Create content type=News Item id=doc title=${title}
Create content
... type=News Item
... id=doc
... title=${title}

an image '${title}'
Create content type=Image id=doc title=${title}
Create content
... type=Image
... id=doc
... title=${title}

a folder '${title}'
Create content type=Folder title=${title}

patterns are loaded
Wait For Condition return !!document.querySelector('body.patterns-loaded')
Create content
... type=Folder
... title=${title}

a folder with a document '${title}'
${folder_uid}= Create content type=Folder title=folder
Create content type=Document container=${folder_uid} title=${title}
${folder_uid}= Create content type=Folder title=folder
Create content
... type=Document
... container=${folder_uid}
... title=${title}

Remove line from textarea
[Arguments] ${fieldName} ${value}

Import library String
${lines}= Get Text //textarea[@name="${fieldName}"]
${lines}= Remove String ${lines} ${value}\n
Type Text //textarea[@name="${fieldName}"] ${lines}


Fill text to tinymce editor
[Arguments] ${attr_name} ${input}

Wait For Condition Attribute //body class contains patterns-loaded

Sleep 1

${check}= Evaluate JavaScript //textarea[@name="${attr_name}"]
... (elem, text) => {
... const tiny = window.tinymce.get(elem.getAttribute("id"));
... let input_text = "";
... tiny.setContent('${input}');
... return tiny.getContent();
... }
... all_elements=False

Should not be empty ${check}


folder contents pattern loaded
Page should contain element css=.pat-structure
Wait For Condition return !!document.querySelector('.pat-structure div.navbar')
Pause
Import library Dialogs
Pause execution
85 changes: 0 additions & 85 deletions Products/CMFPlone/tests/robot/robodoc/README.rst

This file was deleted.

10 changes: 0 additions & 10 deletions Products/CMFPlone/tests/robot/robodoc/TODO.rst

This file was deleted.

Loading

0 comments on commit a840a70

Please sign in to comment.