From d73528db1d0d137de045cb73691896c3f63aacc9 Mon Sep 17 00:00:00 2001 From: Ivan Kolodyazhny Date: Thu, 7 Feb 2019 04:15:21 -0800 Subject: [PATCH] Add ironic-ui integration tests This patch adds basic tests to verify that ironic-ui is installed and could be opened. ironic-ui-integration-tests job is added in a non-voting mode. Depends-On: https://review.openstack.org/634712 Change-Id: Ie77be522679c9076ccbfb133eadaae7228adb03c --- .zuul.yaml | 27 +++++++++++++++++++ bindep.txt | 6 +++++ ironic_ui/test/integration/__init__.py | 0 ironic_ui/test/integration/horizon.conf | 5 ++++ ironic_ui/test/integration/pages/__init__.py | 0 .../test/integration/pages/admin/__init__.py | 0 .../pages/admin/system/__init__.py | 0 .../system/ironicbaremetalprovisioningpage.py | 21 +++++++++++++++ ironic_ui/test/integration/test_basic.py | 23 ++++++++++++++++ lower-constraints.txt | 2 ++ test-requirements.txt | 4 +++ tox.ini | 14 +++++++++- 12 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 bindep.txt create mode 100644 ironic_ui/test/integration/__init__.py create mode 100644 ironic_ui/test/integration/horizon.conf create mode 100644 ironic_ui/test/integration/pages/__init__.py create mode 100644 ironic_ui/test/integration/pages/admin/__init__.py create mode 100644 ironic_ui/test/integration/pages/admin/system/__init__.py create mode 100644 ironic_ui/test/integration/pages/admin/system/ironicbaremetalprovisioningpage.py create mode 100644 ironic_ui/test/integration/test_basic.py diff --git a/.zuul.yaml b/.zuul.yaml index 8e4ccb1e..e1dde2b2 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,3 +1,26 @@ +- job: + name: ironic-ui-integration-tests + parent: horizon-integration-tests + required-projects: + - name: openstack/horizon + - name: openstack/ironic + - name: openstack/python-ironicclient + - name: openstack/ironic-ui + roles: + - zuul: openstack-infra/devstack + - zuul: openstack/horizon + irrelevant-files: + - ^.*\.rst$ + - ^doc/.*$ + - ^releasenotes/.*$ + vars: + devstack_plugins: + ironic: https://git.openstack.org/openstack/ironic + ironic-ui: https://git.openstack.org/openstack/ironic-ui + devstack_services: + horizon: true + tox_envlist: integration + - project: templates: - check-requirements @@ -8,3 +31,7 @@ - openstack-python36-jobs - publish-openstack-docs-pti - release-notes-jobs-python3 + check: + jobs: + - ironic-ui-integration-tests: + voting: false diff --git a/bindep.txt b/bindep.txt new file mode 100644 index 00000000..144e285f --- /dev/null +++ b/bindep.txt @@ -0,0 +1,6 @@ +# 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/ironic_ui/test/integration/__init__.py b/ironic_ui/test/integration/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/ironic_ui/test/integration/horizon.conf b/ironic_ui/test/integration/horizon.conf new file mode 100644 index 00000000..417256a3 --- /dev/null +++ b/ironic_ui/test/integration/horizon.conf @@ -0,0 +1,5 @@ +[plugin] +is_plugin=True +plugin_page_path=ironic_ui.test.integration.pages +plugin_page_structure='{"Admin": {"System": {"_": ["Ironic Bare Metal Provisioning"]}}}' + diff --git a/ironic_ui/test/integration/pages/__init__.py b/ironic_ui/test/integration/pages/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/ironic_ui/test/integration/pages/admin/__init__.py b/ironic_ui/test/integration/pages/admin/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/ironic_ui/test/integration/pages/admin/system/__init__.py b/ironic_ui/test/integration/pages/admin/system/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/ironic_ui/test/integration/pages/admin/system/ironicbaremetalprovisioningpage.py b/ironic_ui/test/integration/pages/admin/system/ironicbaremetalprovisioningpage.py new file mode 100644 index 00000000..18e68105 --- /dev/null +++ b/ironic_ui/test/integration/pages/admin/system/ironicbaremetalprovisioningpage.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 IronicbaremetalprovisioningPage(basepage.BaseNavigationPage): + def __init__(self, driver, conf): + super(IronicbaremetalprovisioningPage, self).__init__(driver, conf) + self._page_title = "Ironic Bare Metal Provisioning" diff --git a/ironic_ui/test/integration/test_basic.py b/ironic_ui/test/integration/test_basic.py new file mode 100644 index 00000000..0eca92d8 --- /dev/null +++ b/ironic_ui/test/integration/test_basic.py @@ -0,0 +1,23 @@ +# +# 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 TestIronicDashboardInstalled(helpers.AdminTestCase): + def test_ironic_bare_metal_provisioning_page_opened(self): + ironic_page = ( + self.home_pg.go_to_admin_system_ironicbaremetalprovisioningpage()) + title = 'Ironic Bare Metal Provisioning - OpenStack Dashboard' + self.assertEqual(ironic_page.page_title, title) diff --git a/lower-constraints.txt b/lower-constraints.txt index ca87ad56..d715bd02 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -89,6 +89,7 @@ requests==2.18.4 requestsexceptions==1.4.0 rfc3986==1.1.0 rjsmin==1.0.12 +selenium==2.50.1 semantic-version==2.6.0 simplejson==3.13.2 six==1.11.0 @@ -133,3 +134,4 @@ XStatic-Spin==1.2.5.2 XStatic-term.js==0.0.7.0 XStatic-tv4==1.2.7.0 XStatic==1.0.1 +xvfbwrapper==0.1.3 diff --git a/test-requirements.txt b/test-requirements.txt index 020dc452..37dded9c 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -17,3 +17,7 @@ openstackdocstheme>=1.18.1 # Apache-2.0 reno>=2.5.0 # Apache-2.0 # Include horizon as test requirement http://tarballs.openstack.org/horizon/horizon-master.tar.gz#egg=horizon + +# 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 57bcd788..525e572b 100644 --- a/tox.ini +++ b/tox.ini @@ -15,7 +15,19 @@ setenv = VIRTUAL_ENV={envdir} DJANGO_SETTINGS_MODULE=ironic_ui.test.settings deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -commands = {toxinidir}/manage.py test ironic_ui --settings=ironic_ui.test.settings +commands = {toxinidir}/manage.py test ironic_ui --settings=ironic_ui.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=ironic_ui/test/integration/horizon.conf +basepython = python2.7 +commands = python manage.py test ironic_ui.test.integration --settings=ironic_ui.test.settings --tag integration + [testenv:pep8] basepython = python3