From e4a8ab4a11b4efcfb25c4c9f36209ecf42db464a Mon Sep 17 00:00:00 2001 From: Ivan Kolodyazhny Date: Mon, 4 Feb 2019 12:03:04 -0800 Subject: [PATCH] Add heat-dashboard integration tests This patch adds basic tests to verify that heat-dashboard is installed and could be opened. heat-dashboard-integration-tests job is added in a non-voting mode. Depends-On: https://review.openstack.org/634712 Change-Id: I2550d6fcd1ce4e05502f247e227aaec05e762fcb --- .zuul.yaml | 25 +++++++++++ bindep.txt | 5 +++ heat_dashboard/test/integration/__init__.py | 0 heat_dashboard/test/integration/horizon.conf | 5 +++ .../test/integration/pages/__init__.py | 0 .../integration/pages/project/__init__.py | 0 .../pages/project/orchestration/__init__.py | 0 .../orchestration/resourcetypespage.py | 21 ++++++++++ .../pages/project/orchestration/stackspage.py | 21 ++++++++++ .../orchestration/templategeneratorpage.py | 21 ++++++++++ .../orchestration/templateversionspage.py | 21 ++++++++++ heat_dashboard/test/integration/test_basic.py | 41 +++++++++++++++++++ lower-constraints.txt | 2 + test-requirements.txt | 4 ++ tox.ini | 13 +++++- 15 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 bindep.txt create mode 100644 heat_dashboard/test/integration/__init__.py create mode 100644 heat_dashboard/test/integration/horizon.conf create mode 100644 heat_dashboard/test/integration/pages/__init__.py create mode 100644 heat_dashboard/test/integration/pages/project/__init__.py create mode 100644 heat_dashboard/test/integration/pages/project/orchestration/__init__.py create mode 100644 heat_dashboard/test/integration/pages/project/orchestration/resourcetypespage.py create mode 100644 heat_dashboard/test/integration/pages/project/orchestration/stackspage.py create mode 100644 heat_dashboard/test/integration/pages/project/orchestration/templategeneratorpage.py create mode 100644 heat_dashboard/test/integration/pages/project/orchestration/templateversionspage.py create mode 100644 heat_dashboard/test/integration/test_basic.py diff --git a/.zuul.yaml b/.zuul.yaml index 2dafee4..a61d864 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,3 +1,26 @@ +- job: + name: heat-dashboard-integration-tests + parent: horizon-integration-tests + required-projects: + - name: openstack/horizon + - name: openstack/heat + - name: openstack/python-heatclient + - name: openstack/heat-dashboard + roles: + - zuul: openstack-infra/devstack + - zuul: openstack/horizon + irrelevant-files: + - ^.*\.rst$ + - ^doc/.*$ + - ^releasenotes/.*$ + vars: + devstack_plugins: + heat: https://git.openstack.org/openstack/heat + heat-dashboard: https://git.openstack.org/openstack/heat-dashboard + devstack_services: + horizon: true + tox_envlist: integration + - project: templates: - check-requirements @@ -10,6 +33,8 @@ check: jobs: - horizon-openstack-tox-python3-django111 + - heat-dashboard-integration-tests: + voting: false gate: jobs: - horizon-openstack-tox-python3-django111 diff --git a/bindep.txt b/bindep.txt new file mode 100644 index 0000000..da92738 --- /dev/null +++ b/bindep.txt @@ -0,0 +1,5 @@ +# selenium tests +firefox [selenium] +xvfb [selenium platform:dpkg] +# already part of xorg-x11-server on openSUSE +xorg-x11-server-Xvfb [selenium platform:redhat] diff --git a/heat_dashboard/test/integration/__init__.py b/heat_dashboard/test/integration/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/heat_dashboard/test/integration/horizon.conf b/heat_dashboard/test/integration/horizon.conf new file mode 100644 index 0000000..1daf8bb --- /dev/null +++ b/heat_dashboard/test/integration/horizon.conf @@ -0,0 +1,5 @@ +[plugin] +is_plugin=True +plugin_page_path=heat_dashboard.test.integration.pages +plugin_page_structure='{"Project": {"Orchestration": {"_": ["Stacks", "Resource Types", "Template Versions", "Template Generator"]}}}' + diff --git a/heat_dashboard/test/integration/pages/__init__.py b/heat_dashboard/test/integration/pages/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/heat_dashboard/test/integration/pages/project/__init__.py b/heat_dashboard/test/integration/pages/project/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/heat_dashboard/test/integration/pages/project/orchestration/__init__.py b/heat_dashboard/test/integration/pages/project/orchestration/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/heat_dashboard/test/integration/pages/project/orchestration/resourcetypespage.py b/heat_dashboard/test/integration/pages/project/orchestration/resourcetypespage.py new file mode 100644 index 0000000..1c7ac9c --- /dev/null +++ b/heat_dashboard/test/integration/pages/project/orchestration/resourcetypespage.py @@ -0,0 +1,21 @@ +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +from openstack_dashboard.test.integration_tests.pages import basepage + + +class ResourcetypesPage(basepage.BaseNavigationPage): + def __init__(self, driver, conf): + super(ResourcetypesPage, self).__init__(driver, conf) + self._page_title = "Resource Types" diff --git a/heat_dashboard/test/integration/pages/project/orchestration/stackspage.py b/heat_dashboard/test/integration/pages/project/orchestration/stackspage.py new file mode 100644 index 0000000..e907594 --- /dev/null +++ b/heat_dashboard/test/integration/pages/project/orchestration/stackspage.py @@ -0,0 +1,21 @@ +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +from openstack_dashboard.test.integration_tests.pages import basepage + + +class StacksPage(basepage.BaseNavigationPage): + def __init__(self, driver, conf): + super(StacksPage, self).__init__(driver, conf) + self._page_title = "Stacks" diff --git a/heat_dashboard/test/integration/pages/project/orchestration/templategeneratorpage.py b/heat_dashboard/test/integration/pages/project/orchestration/templategeneratorpage.py new file mode 100644 index 0000000..e3fb555 --- /dev/null +++ b/heat_dashboard/test/integration/pages/project/orchestration/templategeneratorpage.py @@ -0,0 +1,21 @@ +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +from openstack_dashboard.test.integration_tests.pages import basepage + + +class TemplategeneratorPage(basepage.BaseNavigationPage): + def __init__(self, driver, conf): + super(TemplategeneratorPage, self).__init__(driver, conf) + self._page_title = "Template Generator" diff --git a/heat_dashboard/test/integration/pages/project/orchestration/templateversionspage.py b/heat_dashboard/test/integration/pages/project/orchestration/templateversionspage.py new file mode 100644 index 0000000..7c58ff5 --- /dev/null +++ b/heat_dashboard/test/integration/pages/project/orchestration/templateversionspage.py @@ -0,0 +1,21 @@ +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +from openstack_dashboard.test.integration_tests.pages import basepage + + +class TemplateversionsPage(basepage.BaseNavigationPage): + def __init__(self, driver, conf): + super(TemplateversionsPage, self).__init__(driver, conf) + self._page_title = "Template Versions" diff --git a/heat_dashboard/test/integration/test_basic.py b/heat_dashboard/test/integration/test_basic.py new file mode 100644 index 0000000..b3b4388 --- /dev/null +++ b/heat_dashboard/test/integration/test_basic.py @@ -0,0 +1,41 @@ +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +from openstack_dashboard.test.integration_tests import helpers + + +class TestHeatDashboardInstalled(helpers.TestCase): + def test_alarms_page_opened(self): + stacks_page = self.home_pg.go_to_project_orchestration_stackspage() + self.assertEqual(stacks_page.page_title, + 'Stacks - OpenStack Dashboard') + + def test_resource_types_page_opened(self): + resource_types_page = ( + self.home_pg.go_to_project_orchestration_resourcetypespage()) + self.assertEqual(resource_types_page.page_title, + 'Resource Types - OpenStack Dashboard') + + def test_template_versions_page_opened(self): + template_versions_page = ( + self.home_pg.go_to_project_orchestration_templateversionspage()) + self.assertEqual(template_versions_page.page_title, + 'Template Versions - OpenStack Dashboard') + + def test_template_generator_page_opened(self): + template_generator_page = ( + self.home_pg.go_to_project_orchestration_templategeneratorpage()) + # TODO(e0ne): fix page title once Heat dashaboard will be updated + self.assertEqual(template_generator_page.page_title, + 'Horizon - OpenStack Dashboard') diff --git a/lower-constraints.txt b/lower-constraints.txt index 034ed6e..b1e095e 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -104,6 +104,7 @@ restructuredtext-lint==1.1.1 rfc3986==0.3.1 rjsmin==1.0.12 Routes==2.3.1 +selenium==2.50.1 semantic-version==2.3.1 simplejson==3.5.1 six==1.10.0 @@ -151,3 +152,4 @@ xstatic-angular-vis===4.16.0.0 xstatic-filesaver===1.3.2.0 xstatic-js-yaml===3.8.1.0 xstatic-json2yaml===0.1.1.0 +xvfbwrapper==0.1.3 diff --git a/test-requirements.txt b/test-requirements.txt index 4d9cf46..6b198da 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -15,3 +15,7 @@ flake8-import-order==0.12 # LGPLv3 mock>=2.0.0 # BSD nodeenv>=0.9.4 # BSD testtools>=2.2.0 # MIT + +# integration tests requirements +selenium>=2.50.1 # Apache-2.0 +xvfbwrapper>=0.1.3 #license: MIT diff --git a/tox.ini b/tox.ini index 530cd86..ea5f33e 100644 --- a/tox.ini +++ b/tox.ini @@ -24,7 +24,18 @@ commands = [unit_tests] commands = pip install -r requirements.txt - python manage.py test heat_dashboard.test --settings=heat_dashboard.test.settings + python manage.py test heat_dashboard.test --settings=heat_dashboard.test.settings --exclude-tag integration + +[testenv:integration] +# Run integration tests only +passenv = AVCONV_INSTALLED +setenv = + PYTHONHASHSEED=0 + INTEGRATION_TESTS=1 + SELENIUM_HEADLESS=1 + HORIZON_INTEGRATION_TESTS_CONFIG_FILE=heat_dashboard/test/integration/horizon.conf +basepython = python2.7 +commands = python manage.py test heat_dashboard.test.integration --settings=heat_dashboard.test.settings --tag integration [testenv:pep8] commands = flake8 {posargs}