Skip to content

Commit

Permalink
Add example acceptance tests for IFTTT control panel
Browse files Browse the repository at this point in the history
  • Loading branch information
datakurre committed Jun 1, 2018
1 parent 5cc1c93 commit a185085
Show file tree
Hide file tree
Showing 18 changed files with 245 additions and 39 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ report.html
Pipfile
.DS_Store
docs/_build/
selenium-screenshot*.png
1 change: 1 addition & 0 deletions buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ requests-toolbelt = 0.7.1
robotframework = 3.0
robotframework-ride = 1.5.2.1
robotframework-selenium2library = 1.7.4
robotframework-debuglibrary = 1.1.2
robotsuite = 1.7.0
selenium = 3.12.0
testfixtures = 4.13.4
Expand Down
38 changes: 38 additions & 0 deletions docs/_screenshots/__init__.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# ============================================================================
# ROBOT SCREENSHOTS
# ============================================================================
#
# Update screenshots from the project root directory by running
#
# $ ./bin/pybot -v SCREENSHOTS:true docs/_screenshots
#
# Add and commit the updated screenshots into git repository and use them
# in the package Sphinx documentation as any other image files.
#
# Add new screenshots by writing new acceptance tests / test suites into
# ./src/collective/ifttt/tests/robot, follow the existing examples and
# symlink the .robot files into this directory to include their screenshots.
#
# ============================================================================

*** Settings ***

Library plone.app.robotframework.Zope2Server

Suite Setup Suite Setup
Suite Teardown Suite Teardown

Test Setup Test Setup
Test Teardown Test Teardown

*** Variables ***

${FIXTURE} collective.ifttt.testing.COLLECTIVE_IFTTT_ACCEPTANCE_TESTING

*** Keywords ***

Suite Setup
Start Zope server ${FIXTURE}

Suite Teardown
Stop Zope server
1 change: 1 addition & 0 deletions docs/_screenshots/keywords.robot
1 change: 1 addition & 0 deletions docs/_screenshots/test_controlpanel.robot
1 change: 1 addition & 0 deletions docs/_screenshots/test_example.robot
36 changes: 16 additions & 20 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# import sys
# sys.path.insert(0, os.path.abspath('.'))


# -- Project information -----------------------------------------------------

project = u'collective.ifttt'
Expand All @@ -28,7 +27,6 @@
# The full version, including alpha/beta/rc tags
release = u''


# -- General configuration ---------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
Expand All @@ -38,8 +36,7 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
]
extensions = []

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand All @@ -63,12 +60,11 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path .
exclude_patterns = [u'_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = [u'_screenshots', u'_build', 'Thumbs.db', '.DS_Store']

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
Expand Down Expand Up @@ -97,13 +93,11 @@
#
# html_sidebars = {}


# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'collectiveiftttdoc'


# -- Options for LaTeX output ------------------------------------------------

latex_elements = {
Expand All @@ -128,28 +122,30 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'collectiveifttt.tex', u'collective.ifttt Documentation',
u'Shriyanshagro', 'manual'),
(
master_doc, 'collectiveifttt.tex', u'collective.ifttt Documentation',
u'Shriyanshagro', 'manual'
),
]


# -- Options for manual page output ------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'collectiveifttt', u'collective.ifttt Documentation',
[author], 1)
]

man_pages = [(
master_doc, 'collectiveifttt', u'collective.ifttt Documentation',
[author], 1
)]

# -- Options for Texinfo output ----------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'collectiveifttt', u'collective.ifttt Documentation',
author, 'collectiveifttt', 'One line description of project.',
'Miscellaneous'),
]
(
master_doc, 'collectiveifttt', u'collective.ifttt Documentation',
author, 'collectiveifttt', 'One line description of project.',
'Miscellaneous'
),
]
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@
from setuptools import find_packages
from setuptools import setup


long_description = '\n\n'.join([
open('README.rst').read(),
open('CONTRIBUTORS.rst').read(),
open('CHANGES.rst').read(),
])


setup(
name='collective.ifttt',
version='1.0a1',
description="This addon is developed to make use of IFTTT webhook with Plone",
description=
"This addon is developed to make use of IFTTT webhook with Plone",
long_description=long_description,
# Get more from https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
Expand Down Expand Up @@ -54,6 +53,7 @@
'plone.testing>=5.0.0',
'plone.app.contenttypes',
'plone.app.robotframework[debug]',
'robotframework-selenium2screenshots[Pillow]',
],
},
entry_points="""
Expand Down
2 changes: 1 addition & 1 deletion src/collective/ifttt/browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
name="collectiveifttt-controlpanel"
class=".controlpanel.IftttControlPanelView"
permission="cmf.ManagePortal"
permission="collective.ifttt.manageSettings"
/>

</configure>
Expand Down
4 changes: 2 additions & 2 deletions src/collective/ifttt/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
-->
<!--<includeDependencies package="." />-->

<include package=".browser" />

<include file="permissions.zcml" />

<include package=".browser" />

<include file="upgrades.zcml" />

<genericsetup:registerProfile
Expand Down
5 changes: 4 additions & 1 deletion src/collective/ifttt/permissions.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
i18n_domain="plone">

<configure zcml:condition="installed AccessControl.security">
<!-- -*- extra stuff goes here -*- -->

<permission
id="collective.ifttt.manageSettings"
title="Plone Site Setup: IFTTT"
/>

</configure>

Expand Down
2 changes: 1 addition & 1 deletion src/collective/ifttt/profiles/default/controlpanel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
url_expr="string:${portal_url}/@@collectiveifttt-controlpanel"
visible="True"
i18n:translate="title">
<permission>Manage portal</permission>
<permission>Plone Site Setup: IFTTT</permission>
</configlet>
</object>
2 changes: 1 addition & 1 deletion src/collective/ifttt/profiles/default/metadata.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<version>1001</version>
<version>1002</version>
<dependencies>
<!--<dependency>profile-plone.app.dexterity:default</dependency></dependencies>-->
</dependencies>
Expand Down
6 changes: 4 additions & 2 deletions src/collective/ifttt/profiles/default/rolemap.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?xml version="1.0"?>
<rolemap>
<permissions>
<!-- -*- extra stuff goes here -*- -->

<permission name="Plone Site Setup: IFTTT" acquire="False">
<role name="Manager"/>
<role name="Site Administrator"/>
</permission>
</permissions>
</rolemap>
30 changes: 30 additions & 0 deletions src/collective/ifttt/tests/robot/keywords.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
*** Settings ***

Library SeleniumLibrary timeout=30 implicit_wait=0

*** Variables ***

${FIXTURE} collective.ifttt.testing.COLLECTIVE_IFTTT_ACCEPTANCE_TESTING
${BROWSER} firefox

*** Keywords ***

### Test Setup and Test Teardown are only called when robot tests are run for
### the whole directory (see: ./__init__.robot). These keyword import
### Zope2Server library to make it possible to run individual test case
### files without Zope2Server in PYTHONPATH of pybot test runner.

Test Setup
Import library plone.app.robotframework.Zope2Server
Set Zope layer ${FIXTURE}
ZODB Setup
Open default browser
Set window size 1200 900

Test Teardown
Import library plone.app.robotframework.Zope2Server
Set Zope layer ${FIXTURE}
ZODB TearDown
Close all browsers

###
Loading

0 comments on commit a185085

Please sign in to comment.