Merge "Refactoring of UI tests"

This commit is contained in:
Jenkins 2014-03-14 12:45:54 +00:00 committed by Gerrit Code Review
commit b8cf27d520
2 changed files with 514 additions and 211 deletions

View File

@ -1,34 +1,34 @@
import testtools
import ConfigParser
import random
import time
import json
import datetime
import os
import random
import ConfigParser
import json
import logging
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
log.addHandler(logging.StreamHandler())
from selenium import webdriver
import selenium.webdriver.common.by as by
import config.config as cfg
from selenium.common.exceptions import NoSuchElementException
import selenium.webdriver.common.by as by
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.support.ui import WebDriverWait
import testtools
import time
from keystoneclient.v2_0 import client as ksclient
from muranoclient.client import Client as mclient
from glanceclient import Client as gclient
import config.config as cfg
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
log.addHandler(logging.StreamHandler())
class ImageException(Exception):
message = "Image doesn't exist"
def __init__(self, type):
self._error_string = self.message + '\nDetails: %s' \
' image is not found,' % str(type)
self._error_string = (self.message + '\nDetails: %s image is '
'not found,' % str(type))
def __str__(self):
return self._error_string
@ -77,6 +77,7 @@ class UITestCase(testtools.TestCase):
self.driver.get(cfg.common.horizon_url + '/')
self.driver.implicitly_wait(30)
self.log_in()
def tearDown(self):
super(UITestCase, self).tearDown()
@ -234,17 +235,13 @@ class UITestCase(testtools.TestCase):
next_button = self.elements.get('button', 'Next')
self.driver.find_element_by_xpath(next_button).click()
self.fill_field(
by.By.ID, 'id_activeDirectory-0-name', service_name)
self.fill_field(
by.By.ID, 'id_activeDirectory-0-adminPassword', 'P@ssw0rd')
self.fill_field(
by.By.ID, 'id_activeDirectory-0-adminPassword-clone', 'P@ssw0rd')
self.fill_field(
by.By.ID, 'id_activeDirectory-0-recoveryPassword', 'P@ssw0rd')
self.fill_field(
by.By.ID,
'id_activeDirectory-0-recoveryPassword-clone', 'P@ssw0rd')
ad = 'id_activeDirectory-0'
self.fill_field(by.By.ID, '%s-name' % ad, service_name)
self.fill_field(by.By.ID, '%s-adminPassword' % ad, 'P@ssw0rd')
self.fill_field(by.By.ID, '%s-adminPassword-clone' % ad, 'P@ssw0rd')
self.fill_field(by.By.ID, '%s-recoveryPassword' % ad, 'P@ssw0rd')
self.fill_field(by.By.ID, '%s-recoveryPassword-clone' % ad, 'P@ssw0rd')
next_button = self.elements.get('button', 'Next2')
self.driver.find_element_by_xpath(next_button).click()
@ -261,11 +258,11 @@ class UITestCase(testtools.TestCase):
next_button = self.elements.get('button', 'Next')
self.driver.find_element_by_xpath(next_button).click()
self.fill_field(by.By.ID, 'id_webServer-0-name', service_name)
self.fill_field(
by.By.ID, 'id_webServer-0-adminPassword', 'P@ssw0rd')
self.fill_field(
by.By.ID, 'id_webServer-0-adminPassword-clone', 'P@ssw0rd')
iis = 'id_webServer-0'
self.fill_field(by.By.ID, '%s-name' % iis, service_name)
self.fill_field(by.By.ID, '%s-adminPassword' % iis, 'P@ssw0rd')
self.fill_field(by.By.ID, '%s-adminPassword-clone' % iis, 'P@ssw0rd')
next_button = self.elements.get('button', 'Next2')
self.driver.find_element_by_xpath(next_button).click()
@ -281,13 +278,15 @@ class UITestCase(testtools.TestCase):
next_button = self.elements.get('button', 'Next')
self.driver.find_element_by_xpath(next_button).click()
self.fill_field(by.By.ID, 'id_aspNetApp-0-name', service_name)
self.fill_field(
by.By.ID, 'id_aspNetApp-0-adminPassword', 'P@ssw0rd')
self.fill_field(
by.By.ID, 'id_aspNetApp-0-adminPassword-clone', 'P@ssw0rd')
self.fill_field(
by.By.ID, 'id_aspNetApp-0-repository', self.asp_git_repository)
asp = 'id_aspNetApp-0'
self.fill_field(by.By.ID, '%s-name' % asp, service_name)
self.fill_field(by.By.ID, '%s-adminPassword' % asp, 'P@ssw0rd')
self.fill_field(by.By.ID, '%s-adminPassword-clone' % asp, 'P@ssw0rd')
self.fill_field(by.By.ID,
'%s-repository' % asp,
self.asp_git_repository)
next_button = self.elements.get('button', 'Next2')
self.driver.find_element_by_xpath(next_button).click()
@ -299,16 +298,19 @@ class UITestCase(testtools.TestCase):
self.driver.find_element_by_id(
'services__action_CreateService').click()
self.select_from_list(
'service_choice-service', 'Internet Information Services Web Farm')
self.select_from_list('service_choice-service',
'Internet Information Services Web Farm')
next_button = self.elements.get('button', 'Next')
self.driver.find_element_by_xpath(next_button).click()
self.fill_field(by.By.ID, 'id_webServerFarm-0-name', service_name)
self.fill_field(
by.By.ID, 'id_webServerFarm-0-adminPassword', 'P@ssw0rd')
self.fill_field(
by.By.ID, 'id_webServerFarm-0-adminPassword-clone', 'P@ssw0rd')
iis_farm = 'id_webServerFarm-0'
self.fill_field(by.By.ID, '%s-name' % iis_farm, service_name)
self.fill_field(by.By.ID, '%s-adminPassword' % iis_farm, 'P@ssw0rd')
self.fill_field(by.By.ID,
'%s-adminPassword-clone' % iis_farm,
'P@ssw0rd')
next_button = self.elements.get('button', 'Next2')
self.driver.find_element_by_xpath(next_button).click()
@ -325,13 +327,17 @@ class UITestCase(testtools.TestCase):
next_button = self.elements.get('button', 'Next')
self.driver.find_element_by_xpath(next_button).click()
self.fill_field(by.By.ID, 'id_aspNetAppFarm-0-name', service_name)
self.fill_field(
by.By.ID, 'id_aspNetAppFarm-0-adminPassword', 'P@ssw0rd')
self.fill_field(
by.By.ID, 'id_aspNetAppFarm-0-adminPassword-clone', 'P@ssw0rd')
self.fill_field(
by.By.ID, 'id_aspNetAppFarm-0-repository', self.asp_git_repository)
asp_farm = 'id_aspNetAppFarm-0'
self.fill_field(by.By.ID, '%s-name' % asp_farm, service_name)
self.fill_field(by.By.ID, '%s-adminPassword' % asp_farm, 'P@ssw0rd')
self.fill_field(by.By.ID,
'%s-adminPassword-clone' % asp_farm,
'P@ssw0rd')
self.fill_field(by.By.ID,
'%s-repository' % asp_farm,
self.asp_git_repository)
next_button = self.elements.get('button', 'Next2')
self.driver.find_element_by_xpath(next_button).click()
@ -347,15 +353,13 @@ class UITestCase(testtools.TestCase):
next_button = self.elements.get('button', 'Next')
self.driver.find_element_by_xpath(next_button).click()
self.fill_field(by.By.ID, 'id_msSqlServer-0-name', service_name)
self.fill_field(
by.By.ID, 'id_msSqlServer-0-adminPassword', 'P@ssw0rd')
self.fill_field(
by.By.ID, 'id_msSqlServer-0-adminPassword-clone', 'P@ssw0rd')
self.fill_field(
by.By.ID, 'id_msSqlServer-0-saPassword', 'P@ssw0rd')
self.fill_field(
by.By.ID, 'id_msSqlServer-0-saPassword-clone', 'P@ssw0rd')
mssql = 'id_msSqlServer-0'
self.fill_field(by.By.ID, '%s-name' % mssql, service_name)
self.fill_field(by.By.ID, '%s-adminPassword' % mssql, 'P@ssw0rd')
self.fill_field(by.By.ID, '%s-adminPassword-clone' % mssql, 'P@ssw0rd')
self.fill_field(by.By.ID, '%s-saPassword' % mssql, 'P@ssw0rd')
self.fill_field(by.By.ID, '%s-saPassword-clone' % mssql, 'P@ssw0rd')
next_button = self.elements.get('button', 'Next2')
self.driver.find_element_by_xpath(next_button).click()
@ -367,63 +371,66 @@ class UITestCase(testtools.TestCase):
self.driver.find_element_by_id(
'services__action_CreateService').click()
self.select_from_list(
'service_choice-service', 'MS SQL Server Cluster')
self.select_from_list('service_choice-service',
'MS SQL Server Cluster')
next_button = self.elements.get('button', 'Next')
self.driver.find_element_by_xpath(next_button).click()
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-0-name', service_name)
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-0-adminPassword', 'P@ssw0rd')
self.fill_field(
by.By.ID,
'id_msSqlClusterServer-0-adminPassword-clone', 'P@ssw0rd')
sql_cluster = 'id_msSqlClusterServer'
self.fill_field(by.By.ID, '%s-0-name' % sql_cluster, service_name)
self.fill_field(by.By.ID,
'%s-0-adminPassword' % sql_cluster,
'P@ssw0rd')
self.fill_field(by.By.ID,
'%s-0-adminPassword-clone' % sql_cluster,
'P@ssw0rd')
self.select_from_list('msSqlClusterServer-0-domain', domain_name)
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-0-saPassword', 'P@ssw0rd')
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-0-saPassword-clone', 'P@ssw0rd')
self.fill_field(by.By.ID,
'%s-0-saPassword' % sql_cluster,
'P@ssw0rd')
self.fill_field(by.By.ID,
'%s-0-saPassword-clone' % sql_cluster,
'P@ssw0rd')
next_button = self.elements.get('button', 'Next2')
self.driver.find_element_by_xpath(next_button).click()
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-1-clusterIp', '1.1.1.1')
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-1-clusterName', 'cluster')
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-1-agGroupName', 'ag-name')
self.fill_field(
by.By.ID,
'id_msSqlClusterServer-1-agListenerName', 'listener_name')
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-1-agListenerIP', 'listener_name')
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-1-sqlServiceUserName', 'admin')
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-1-sqlServicePassword', 'P@ssw0rd')
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-1-sqlServicePassword-clone',
'P@ssw0rd')
self.fill_field(by.By.ID, '%s-1-clusterIp' % sql_cluster, '1.1.1.1')
self.fill_field(by.By.ID, '%s-1-clusterName' % sql_cluster, 'cluster')
self.fill_field(by.By.ID, '%s-1-agGroupName' % sql_cluster, 'ag-name')
self.fill_field(by.By.ID,
'%s-1-agListenerName' % sql_cluster,
'listener_name')
self.fill_field(by.By.ID,
'%s-1-agListenerIP' % sql_cluster,
'listener_name')
self.fill_field(by.By.ID,
'%s-1-sqlServiceUserName' % sql_cluster,
'admin')
self.fill_field(by.By.ID,
'%s-1-sqlServicePassword' % sql_cluster,
'P@ssw0rd')
self.fill_field(by.By.ID,
'%s-1-sqlServicePassword-clone' % sql_cluster,
'P@ssw0rd')
next_button = self.elements.get('button', 'Next2')
self.driver.find_element_by_xpath(next_button).click()
cluster_ip = self.get_env_subnet()
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-1-clusterIp', cluster_ip)
self.fill_field(by.By.ID, '%s-1-clusterIp' % sql_cluster, cluster_ip)
listener_ip = self.get_env_subnet()
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-1-agListenerIP', listener_ip)
self.fill_field(by.By.ID,
'%s-1-agListenerIP' % sql_cluster,
listener_ip)
next_button = self.elements.get('button', 'Next2')
self.driver.find_element_by_xpath(next_button).click()
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-2-databases', 'testbase')
self.fill_field(by.By.ID, '%s-2-databases' % sql_cluster, 'testbase')
next_button = self.elements.get('button', 'Next2')
self.driver.find_element_by_xpath(next_button).click()
self.select_from_list(
'msSqlClusterServer-3-osImage', self.windows_image)
self.select_from_list('msSqlClusterServer-3-osImage',
self.windows_image)
next_button = self.elements.get('button', 'Create')
self.driver.find_element_by_xpath(next_button).click()

View File

@ -1,35 +1,56 @@
import sys
import os
sys.path.append(os.getcwd())
from base import UITestCase
import selenium.webdriver.common.by as by
from selenium.webdriver.support.ui import WebDriverWait
import testtools
from base import UITestCase
class UISanityTests(UITestCase):
def test_001_create_delete_environment(self):
self.log_in()
"""Test check ability to create and delete environment.
Scenario:
1. Create environment
2. Navigate to this environment
3. Go back to environment list and delete created environment
"""
self.navigate_to('Environments')
self.create_environment('test_create_del_env')
self.driver.find_element_by_link_text('test_create_del_env').click()
self.delete_environment('test_create_del_env')
self.delete_environment('test_create_del_env')
self.assertFalse(self.check_element_on_page(by.By.LINK_TEXT,
'test_create_del_env'))
def test_002_edit_environment(self):
self.log_in()
"""
Test check ability to change environment name
Scenario:
1. Create environment
2. Change environment's name
3. Check that there is renamed environment is in environment list
"""
self.navigate_to('Environments')
self.create_environment('test_edit_env')
self.driver.find_element_by_link_text('test_edit_env')
self.edit_environment(old_name='test_edit_env', new_name='edited_env')
self.edit_environment(old_name='test_edit_env', new_name='edited_env')
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT,
'edited_env'))
self.assertFalse(self.check_element_on_page(by.By.LINK_TEXT,
'test_edit_env'))
def test_003_rename_image(self):
self.log_in()
"""
Test check ability to mark murano image
Scenario:
1. Navigate to Images page
2. Click on button "Mark Image"
3. Fill the form and submit it
"""
self.navigate_to('Images')
self.driver.find_element_by_id(
'marked_images__action_mark_image').click()
@ -41,7 +62,14 @@ class UISanityTests(UITestCase):
self.select_and_click_element('Mark')
def test_004_delete_image(self):
self.log_in()
"""
Test check ability to delete image
Scenario:
1. Navigate to Images page
2. Create test image
3. Select created image and click on "Delete Metadata"
"""
self.navigate_to('Images')
self.driver.find_element_by_id(
'marked_images__action_mark_image').click()
@ -59,8 +87,18 @@ class UISanityTests(UITestCase):
self.assertFalse(self.check_element_on_page(by.By.LINK_TEXT,
'TestImageForDeletion'))
@testtools.skip("New UI in progress")
def test_005_create_and_delete_demo_service(self):
self.log_in()
"""
Test check ability to create and delete demo service
Scenario:
1. Navigate to Environments page
2. Create environment
3. Create demo service in this environment by filling
the creation form
4. Delete demo service from environment
"""
self.navigate_to('Environments')
self.create_environment('test')
self.env_to_service('test')
@ -73,8 +111,18 @@ class UISanityTests(UITestCase):
self.assertFalse(self.check_element_on_page(by.By.LINK_TEXT,
'DemoService'))
@testtools.skip("New UI in progress")
def test_006_create_and_delete_linux_telnet(self):
self.log_in()
"""
Test check ability to create and delete linux telnet service
Scenario:
1. Navigate to Environments page
2. Create environment
3. Create linux telnet service in this environment by filling
the creation form
4. Delete linux telnet service from environment
"""
self.navigate_to('Environments')
self.create_environment('test')
self.env_to_service('test')
@ -87,8 +135,18 @@ class UISanityTests(UITestCase):
self.assertFalse(self.check_element_on_page(by.By.LINK_TEXT,
'linuxtelnet'))
@testtools.skip("New UI in progress")
def test_007_create_and_delete_linux_apache(self):
self.log_in()
"""
Test check ability to create and delete linux apache service
Scenario:
1. Navigate to Environments page
2. Create environment
3. Create linux apache service in this environment by filling
the creation form
4. Delete linux apache service from environment
"""
self.navigate_to('Environments')
self.create_environment('test')
self.env_to_service('test')
@ -101,8 +159,18 @@ class UISanityTests(UITestCase):
self.assertFalse(self.check_element_on_page(by.By.LINK_TEXT,
'linuxapache'))
@testtools.skip("New UI in progress")
def test_008_create_and_delete_ad_service(self):
self.log_in()
"""
Test check ability to create and delete active directory service
Scenario:
1. Navigate to Environments page
2. Create environment
3. Create active directory service in this environment by filling
the creation form
4. Delete active directory service from environment
"""
self.navigate_to('Environments')
self.create_environment('test')
self.env_to_service('test')
@ -115,8 +183,18 @@ class UISanityTests(UITestCase):
self.assertFalse(self.check_element_on_page(by.By.LINK_TEXT,
'muranotest.domain'))
@testtools.skip("New UI in progress")
def test_009_create_and_delete_iis_service(self):
self.log_in()
"""
Test check ability to create and delete IIS service
Scenario:
1. Navigate to Environments page
2. Create environment
3. Create IIS service in this environment by filling
the creation form
4. Delete IIS service from environment
"""
self.navigate_to('Environments')
self.create_environment('test')
self.env_to_service('test')
@ -128,7 +206,18 @@ class UISanityTests(UITestCase):
self.assertFalse(self.check_element_on_page(by.By.LINK_TEXT,
'IISService'))
@testtools.skip("New UI in progress")
def test_010_create_and_delete_asp_service(self):
"""
Test check ability to create and delete ASP.Net service
Scenario:
1. Navigate to Environments page
2. Create environment
3. Create ASP.Net service in this environment by filling
the creation form
4. Delete ASP.Net service from environment
"""
self.log_in()
self.navigate_to('Environments')
self.create_environment('test')
@ -142,8 +231,18 @@ class UISanityTests(UITestCase):
self.assertFalse(self.check_element_on_page(by.By.LINK_TEXT,
'ASPService'))
@testtools.skip("New UI in progress")
def test_011_create_and_delete_iisfarm_service(self):
self.log_in()
"""
Test check ability to create and delete IIS Farm service
Scenario:
1. Navigate to Environments page
2. Create environment
3. Create IIS Farm service in this environment by filling
the creation form
4. Delete IIS Farm service from environment
"""
self.navigate_to('Environments')
self.create_environment('test')
self.env_to_service('test')
@ -156,8 +255,18 @@ class UISanityTests(UITestCase):
self.assertFalse(self.check_element_on_page(by.By.LINK_TEXT,
'IISFarmService'))
@testtools.skip("New UI in progress")
def test_012_create_and_delete_aspfarm_service(self):
self.log_in()
"""
Test check ability to create and delete ASP.Net Farm service
Scenario:
1. Navigate to Environments page
2. Create environment
3. Create ASP.Net Farm service in this environment by filling
the creation form
4. Delete ASP.Net Farm service from environment
"""
self.navigate_to('Environments')
self.create_environment('test')
self.env_to_service('test')
@ -170,8 +279,18 @@ class UISanityTests(UITestCase):
self.assertFalse(self.check_element_on_page(by.By.LINK_TEXT,
'ASPFarmService'))
@testtools.skip("New UI in progress")
def test_013_create_and_delete_mssql_service(self):
self.log_in()
"""
Test check ability to create and delete MSSQL service
Scenario:
1. Navigate to Environments page
2. Create environment
3. Create MSSQL service in this environment by filling
the creation form
4. Delete MSSQL service from environment
"""
self.navigate_to('Environments')
self.create_environment('test')
self.env_to_service('test')
@ -184,8 +303,18 @@ class UISanityTests(UITestCase):
self.assertFalse(self.check_element_on_page(by.By.LINK_TEXT,
'MSSQLService'))
@testtools.skip("New UI in progress")
def test_014_create_and_delete_sql_cluster_service(self):
self.log_in()
"""
Test check ability to create and delete MSSQL cluster service
Scenario:
1. Navigate to Environments page
2. Create environment
3. Create MSSQL cluster service in this environment by filling
the creation form
4. Delete MSSQL cluster service from environment
"""
self.navigate_to('Environments')
self.create_environment('test')
self.env_to_service('test')
@ -203,8 +332,33 @@ class UISanityTests(UITestCase):
self.assertFalse(self.check_element_on_page(by.By.LINK_TEXT,
'SQLCluster'))
@testtools.skip("New UI in progress")
def test_015_check_regex_expression_for_ad_name(self):
self.log_in()
"""
Test check that validation of domain name field work and appropriate
error message is appeared after entering incorrect domain name
Scenario:
1. Navigate to Environments page
2. Create environment and start to create AD service
3. Set "a" as a domain name and verify error message
4. Set "aa" as a domain name and check that error message
didn't appear
5. Set "@ct!v3" as a domain name and verify error message
6. Set "active.com" as a domain name and check that error message
didn't appear
7. Set "domain" as a domain name and verify error message
8. Set "domain.com" as a domain name and check that error message
didn't appear
9. Set "morethan15symbols.beforedot" as a domain name and
verify error message
10. Set "lessthan15.beforedot" as a domain name and check that
error message didn't appear
11. Set ".domain.local" as a domain name and
verify error message
12. Set "domain.local" as a domain name and check that
error message didn't appear
"""
self.navigate_to('Environments')
self.create_environment('test')
self.env_to_service('test')
@ -263,8 +417,22 @@ class UISanityTests(UITestCase):
'Period characters are allowed only when '
'they are used to delimit the components of domain style names', 1))
@testtools.skip("New UI in progress")
def test_016_check_regex_expression_for_iis_name(self):
self.log_in()
"""
Test check that validation of iis name field work and appropriate
error message is appeared after entering incorrect name
Scenario:
1. Navigate to Environments page
2. Create environment and start to create IIS service
3. Set "a" as a iis name and verify error message
4. Set "aa" as a iis name and check that error message
didn't appear
5. Set "S3rv!$" as a iis name and verify error message
6. Set "Service" as a iis name and check that error message
didn't appear
"""
self.navigate_to('Environments')
self.create_environment('test')
self.env_to_service('test')
@ -294,8 +462,18 @@ class UISanityTests(UITestCase):
self.assertFalse(self.check_that_error_message_is_correct(
'Just letters, numbers, underscores and hyphens are allowed.', 1))
@testtools.skip("New UI in progress")
def test_017_check_regex_expression_for_git_repo_field(self):
self.log_in()
"""
Test check that validation of git repository field work and appropriate
error message is appeared after entering incorrect url
Scenario:
1. Navigate to Environments page
2. Create environment and start to create ASP.Net service
3. Set "a" as a git repository url and verify error message
4. Set "://@:" as a git repository url and verify error message
"""
self.navigate_to('Environments')
self.create_environment('test')
self.env_to_service('test')
@ -316,8 +494,19 @@ class UISanityTests(UITestCase):
self.assertTrue(self.check_that_error_message_is_correct(
'Enter correct git repository url', 4))
@testtools.skip("New UI in progress")
def test_018_check_validation_for_hostname_template_field(self):
self.log_in()
"""
Test check that validation of hostname template field work and
appropriate error message is appeared after entering incorrect name
Scenario:
1. Navigate to Environments page
2. Create environment and start to create demo service
3. Set "demo" as a hostname template name a and verify error message
4. Set "demo" as a hostname template name and change number of
instances from 2 to 1 and check that there is no error message
"""
self.navigate_to('Environments')
self.create_environment('test')
self.env_to_service('test')
@ -328,8 +517,10 @@ class UISanityTests(UITestCase):
next_button = self.elements.get('button', 'Next')
self.driver.find_element_by_xpath(next_button).click()
self.fill_field(by.By.ID, field='id_demoService-0-name', value='demo')
self.fill_field(by.By.ID, field='id_demoService-0-unitNamingPattern',
service = ''
self.fill_field(by.By.ID, field='%s-name' % service, value='demo')
self.fill_field(by.By.ID, field='%s-unitNamingPattern' % service,
value='demo')
xpath = ".//*[@id='create_service_form']/div[1]/div[1]/fieldset/div[1]"
@ -338,17 +529,25 @@ class UISanityTests(UITestCase):
self.driver.find_element_by_xpath(next_button).click()
self.assertTrue(self.check_element_on_page(by.By.XPATH, xpath))
self.fill_field(by.By.ID, field='id_demoService-0-dcInstances',
value='1')
self.fill_field(by.By.ID, field='%s-dcInstances' % service, value='1')
next_button = self.elements.get('button', 'Next2')
self.driver.find_element_by_xpath(next_button).click()
id_ = 'id_demoService-1-osImage'
WebDriverWait(self.driver, 10).until(lambda s: s.find_element(
by.By.ID, id_).is_displayed())
by.By.ID, 'demoService-1-osImage').is_displayed())
@testtools.skip("New UI in progress")
def test_019_check_bool_field_validation(self):
self.log_in()
"""
Test check that validation of bool field work
Scenario:
1. Navigate to Environments page
2. Create environment and start to create mssql cluster service
3. Select externalAD and fill fields with incorrect values
4. Unselect externalAD and click on Next, second step of wizard
should appears
"""
self.navigate_to('Environments')
self.create_environment('test')
self.env_to_service('test')
@ -359,43 +558,45 @@ class UISanityTests(UITestCase):
next_button = self.elements.get('button', 'Next')
self.driver.find_element_by_xpath(next_button).click()
self.fill_field(by.By.ID, 'id_msSqlClusterServer-0-name', 'ms-sql')
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-0-adminPassword', 'P@ssw0rd')
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-0-adminPassword-clone', 'P@ssw0rd')
sql_cluster = 'id_msSqlClusterServer-0'
self.driver.find_element_by_id(
'id_msSqlClusterServer-0-externalAD').click()
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-0-domainAdminUserName', 'user')
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-0-domainAdminPassword', 'P@ssw0rd')
self.fill_field(by.By.ID,
'id_msSqlClusterServer-0-domainAdminPassword-clone',
self.fill_field(by.By.ID, '%s-name' % sql_cluster, 'ms-sql')
self.fill_field(by.By.ID, '%s-adminPassword' % sql_cluster, 'P@ssw0rd')
self.fill_field(by.By.ID, '%s-adminPassword-clone' % sql_cluster,
'P@ssw0rd')
self.driver.find_element_by_id('%s-externalAD' % sql_cluster).click()
self.fill_field(by.By.ID, '%s-domainAdminUserName' % sql_cluster,
'user')
self.fill_field(by.By.ID, '%s-domainAdminPassword' % sql_cluster,
'P@ssw0rd')
self.fill_field(by.By.ID, '%s-domainAdminPassword-clone' % sql_cluster,
'anotherP@ssw0rd')
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-0-saPassword', 'P@ssw0rd')
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-0-saPassword-clone', 'P@ssw0rd')
self.fill_field(by.By.ID, '%s-saPassword' % sql_cluster, 'P@ssw0rd')
self.fill_field(by.By.ID, '%s-saPassword-clone' % sql_cluster,
'P@ssw0rd')
next_button = self.elements.get('button', 'Next2')
self.driver.find_element_by_xpath(next_button).click()
self.assertTrue(self.check_that_alert_message_is_appeared(
'Active Directory Passwords don\'t match'))
self.driver.find_element_by_id(
'id_msSqlClusterServer-0-externalAD').click()
self.driver.find_element_by_id('%sexternalAD' % sql_cluster).click()
self.assertTrue(self.check_that_error_message_is_correct(
'This field is required.', 1))
@testtools.skip("New UI in progress")
def test_020_positive_scenario_1_for_the_MS_SQL_Cluster_Form(self):
"""
Scenario 1: External AD and Mixed-Mode Auth checkboxes
Test check one possible scenario of creation mssql cluster
Scenario:
1. Navigate to Environments page
2. Create environment and start to create mssql cluster service
3. External AD and Mixed-Mode Auth checkboxes
are not selected. User select created earlier domain.
"""
self.log_in()
self.navigate_to('Environments')
self.create_environment('scenario_1')
self.env_to_service('scenario_1')
@ -410,31 +611,35 @@ class UISanityTests(UITestCase):
next_button = self.elements.get('button', 'Next')
self.driver.find_element_by_xpath(next_button).click()
self.fill_field(by.By.ID, 'id_msSqlClusterServer-0-name', 'ms-sql')
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-0-adminPassword', 'P@ssw0rd')
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-0-adminPassword-clone', 'P@ssw0rd')
sql_cluster = 'id_msSqlClusterServer-0'
self.fill_field(by.By.ID, '%s-name' % sql_cluster, 'ms-sql')
self.fill_field(by.By.ID, '%s-adminPassword' % sql_cluster, 'P@ssw0rd')
self.fill_field(by.By.ID, '%s-adminPassword-clone' % sql_cluster,
'P@ssw0rd')
self.select_from_list('msSqlClusterServer-0-domain',
'activeDirectory.mssql')
self.driver.find_element_by_id(
'id_msSqlClusterServer-0-mixedModeAuth').click()
self.driver.find_element_by_id('%s-mixedModeAuth' % sql_cluster).click()
next_button = self.elements.get('button', 'Next2')
self.driver.find_element_by_xpath(next_button).click()
self.assertTrue(self.check_element_on_page(
by.By.ID, 'id_msSqlClusterServer-1-clusterIp'))
@testtools.skip("New UI in progress")
def test_021_positive_scenario_2_for_the_MS_SQL_Cluster_Form(self):
"""
Scenario 2: External AD field is selected (and user fill
Test check one possible scenario of creation mssql cluster
Scenario:
1. Navigate to Environments page
2. Create environment and start to create mssql cluster service
3. External AD field is selected (and user fill
all required fields here) and Mixed-Mode Auth checkbox
is not selected.
"""
self.log_in()
self.navigate_to('Environments')
self.create_environment('scenario_2')
self.env_to_service('scenario_2')
@ -445,37 +650,39 @@ class UISanityTests(UITestCase):
next_button = self.elements.get('button', 'Next')
self.driver.find_element_by_xpath(next_button).click()
self.fill_field(by.By.ID, 'id_msSqlClusterServer-0-name', 'ms-sql')
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-0-adminPassword', 'P@ssw0rd')
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-0-adminPassword-clone', 'P@ssw0rd')
sql_cluster = 'id_msSqlClusterServer-0'
self.driver.find_element_by_id(
'id_msSqlClusterServer-0-externalAD').click()
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-0-domainAdminUserName', 'user')
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-0-domainAdminPassword', 'P@ssw0rd')
self.fill_field(by.By.ID,
'id_msSqlClusterServer-0-domainAdminPassword-clone',
self.fill_field(by.By.ID, '%s-name' % sql_cluster, 'ms-sql')
self.fill_field(by.By.ID, '%s-adminPassword' % sql_cluster, 'P@ssw0rd')
self.fill_field(by.By.ID, '%s-adminPassword-clone' % sql_cluster,
'P@ssw0rd')
self.driver.find_element_by_id(
'id_msSqlClusterServer-0-mixedModeAuth').click()
self.driver.find_element_by_id('%s-externalAD' % sql_cluster).click()
self.fill_field(by.By.ID, '%s-domainAdminUserName' % sql_cluster,
'user')
self.fill_field(by.By.ID, '%s-domainAdminPassword' % sql_cluster,
'P@ssw0rd')
self.fill_field(by.By.ID, '%s-domainAdminPassword-clone' % sql_cluster,
'P@ssw0rd')
self.driver.find_element_by_id('%s-mixedModeAuth' % sql_cluster).click()
next_button = self.elements.get('button', 'Next2')
self.driver.find_element_by_xpath(next_button).click()
self.assertTrue(self.check_element_on_page(
by.By.ID, 'id_msSqlClusterServer-1-clusterIp'))
@testtools.skip("New UI in progress")
def test_022_positive_scenario_3_for_the_MS_SQL_Cluster_Form(self):
"""
Scenario 3: External AD and Mixed-Mode Auth checkboxes are selected.
Test check one possible scenario of creation mssql cluster
Scenario:
1. Navigate to Environments page
2. Create environment and start to create mssql cluster service
3. External AD and Mixed-Mode Auth checkboxes are selected.
User have to fill all required fields.
"""
self.log_in()
self.navigate_to('Environments')
self.create_environment('scenario_3')
self.env_to_service('scenario_3')
@ -486,26 +693,24 @@ class UISanityTests(UITestCase):
next_button = self.elements.get('button', 'Next')
self.driver.find_element_by_xpath(next_button).click()
self.fill_field(by.By.ID, 'id_msSqlClusterServer-0-name', 'ms-sql')
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-0-adminPassword', 'P@ssw0rd')
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-0-adminPassword-clone', 'P@ssw0rd')
sql_cluster = 'id_msSqlClusterServer-0'
self.driver.find_element_by_id(
'id_msSqlClusterServer-0-externalAD').click()
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-0-domainAdminUserName', 'user')
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-0-domainAdminPassword', 'P@ssw0rd')
self.fill_field(by.By.ID,
'id_msSqlClusterServer-0-domainAdminPassword-clone',
self.fill_field(by.By.ID, '%s-name' % sql_cluster, 'ms-sql')
self.fill_field(by.By.ID, '%s-adminPassword' % sql_cluster, 'P@ssw0rd')
self.fill_field(by.By.ID, '%s-adminPassword-clone' % sql_cluster,
'P@ssw0rd')
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-0-saPassword', 'P@ssw0rd')
self.fill_field(
by.By.ID, 'id_msSqlClusterServer-0-saPassword-clone', 'P@ssw0rd')
self.driver.find_element_by_id('%s-externalAD').click()
self.fill_field(by.By.ID, '%s-domainAdminUserName' % sql_cluster,
'user')
self.fill_field(by.By.ID, '%s-domainAdminPassword' % sql_cluster,
'P@ssw0rd')
self.fill_field(by.By.ID, '%s-domainAdminPassword-clone' % sql_cluster,
'P@ssw0rd')
self.fill_field(by.By.ID, '%s-saPassword' % sql_cluster, 'P@ssw0rd')
self.fill_field(by.By.ID, '%s-saPassword-clone' % sql_cluster,
'P@ssw0rd')
next_button = self.elements.get('button', 'Next2')
self.driver.find_element_by_xpath(next_button).click()
@ -513,14 +718,27 @@ class UISanityTests(UITestCase):
by.By.ID, 'id_msSqlClusterServer-1-clusterIp'))
def test_023_check_opportunity_to_compose_a_new_service(self):
self.log_in()
"""
Test check ability to compose new service via Murano Repository
Scenario:
1. Navigate to Service Definitions page
2. Click on "Compose Service" and create new service
"""
self.navigate_to('Service Definitions')
self.compose_trivial_service('composedService')
self.assertTrue(self.check_element_on_page(
by.By.XPATH, './/*[@data-display="composedService"]'))
def test_024_modify_service_name(self):
self.log_in()
"""
Test check ability to change name of the composed service
Scenario:
1. Navigate to Service Definitions page
2. Click on "Compose Service" and create new service
3. Rename composed service
"""
self.navigate_to('Service Definitions')
self.compose_trivial_service('forModification')
self.assertTrue(self.check_element_on_page(
@ -536,7 +754,14 @@ class UISanityTests(UITestCase):
by.By.XPATH, './/*[@data-display="modifiedService"]'))
def test_025_modify_description(self):
self.log_in()
"""
Test check ability to change description of the composed service
Scenario:
1. Navigate to Service Definitions page
2. Click on "Compose Service" and create new service
3. Change description of composed service
"""
self.navigate_to('Service Definitions')
self.compose_trivial_service('forModification')
self.assertTrue(self.check_element_on_page(
@ -555,8 +780,17 @@ class UISanityTests(UITestCase):
".//*[@id='main_content']/div[3]/dl/dd[4]",
'New Description')
@testtools.skip("New UI in progress")
def test_026_check_opportunity_to_select_composed_service(self):
self.log_in()
"""
Test check ability to add composed service in the environment
Scenario:
1. Navigate to Service Definitions page
2. Click on "Compose Service" and create new service
3. Navigate to Environments page
4. Create environment and add in this env created service
"""
self.navigate_to('Service Definitions')
self.compose_trivial_service('TEST')
self.assertTrue(self.check_element_on_page(
@ -575,7 +809,14 @@ class UISanityTests(UITestCase):
self.assertTrue(self.check_element_on_page(by.By.XPATH, next_))
def test_027_modify_service_add_file(self):
self.log_in()
"""
Test check ability to add file in composed service
Scenario:
1. Navigate to Service Definitions page
2. Click on "Compose Service" and create new service
3. Manage composed service: add file
"""
self.navigate_to('Service Definitions')
self.compose_trivial_service('TEST')
@ -596,14 +837,27 @@ class UISanityTests(UITestCase):
"Get-DnsListeningIpAddress.ps1']"))
def test_028_download_service(self):
self.log_in()
"""
Test check ability to download service from repository
Scenario:
1. Navigate to Service Definitions page
2. Select Demo service and click on "More>Download"
"""
self.navigate_to('Service Definitions')
self.select_action_for_service('demoService', 'more')
self.select_action_for_service('demoService', 'download_service')
def test_029_upload_service_to_repository(self):
self.log_in()
"""
Test check ability to upload service from repository
Scenario:
1. Navigate to Service Definitions page
2. Click on "Upload Service"
3. Select tar.gz archive with service and submit form
"""
self.driver.find_element_by_link_text('Service Definitions').click()
self.click_on_service_catalog_action('upload_service')
@ -613,7 +867,14 @@ class UISanityTests(UITestCase):
by.By.XPATH, './/*[@data-display="My Service"]'))
def test_030_manage_service_upload_file(self):
self.log_in()
"""
Test check ability to upload service from repository
Scenario:
1. Navigate to Service Definitions page
2. Compose new service
3. Manage composed service: upload new file to this service
"""
self.navigate_to('Service Definitions')
self.compose_trivial_service('TEST')
@ -627,7 +888,16 @@ class UISanityTests(UITestCase):
by.By.XPATH, ".//*[@id='scripts__row__scripts##myScript.ps1']"))
def test_031_manage_files_upload_delete_file(self):
self.log_in()
"""
Test check ability to upload file to repository and delete this file
Scenario:
1. Navigate to Service Definitions page
2. Click on "Manage Files"
3. Upload file to repository
4. Find uploaded file in appropriate category and delete it
from repository
"""
self.navigate_to('Service Definitions')
self.click_on_service_catalog_action('manage_files')
@ -652,14 +922,23 @@ class UISanityTests(UITestCase):
"myHeatTemplate.template']"))
def test_032_check_opportunity_to_toggle_service(self):
self.log_in()
"""
Test check ability to make service active or inactive
Scenario:
1. Navigate to Service Definitions page
2. Select Demo service and make it inactive ("More>Toggle Service")
3. Check that service became inactive
4. Select Demo service and make it active ("More>Toggle Service")
5. Check that service became active
"""
self.navigate_to('Service Definitions')
self.select_action_for_service('demoService', 'more')
self.select_action_for_service('demoService', 'toggle_enabled')
self.assertTrue(
self.check_service_parameter('demoService', '3', 'False'))
self.assertTrue(self.check_service_parameter('demoService',
'3', 'False'))
self.select_action_for_service('demoService', 'more')
self.select_action_for_service('demoService', 'toggle_enabled')
@ -668,7 +947,16 @@ class UISanityTests(UITestCase):
self.check_service_parameter('demoService', '3', 'True'))
def test_033_delete_component_from_existing_service(self):
self.log_in()
"""
Test check ability to delete component from existing service
Scenario:
1. Navigate to Service Definitions page
2. Select Demo service and navigate to service info page
("More>Manage Service")
3. Select one of service's file
4. Delete this file
"""
self.navigate_to('Service Definitions')
self.select_action_for_service('demoService', 'more')
@ -687,7 +975,15 @@ class UISanityTests(UITestCase):
by.By.XPATH, ".//*[@id='agent__row__agent##Demo.template']"))
def test_034_check_opportunity_to_delete_composed_service(self):
self.log_in()
"""
Test check ability to delete composed service
Scenario:
1. Navigate to Service Definitions page
2. Compose new service
3. Select composed service
4. Delete this service
"""
self.navigate_to('Service Definitions')
self.compose_trivial_service('ForDeletion')
self.assertTrue(self.check_element_on_page(