Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Domain eap operations #138

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions tests/test_domain_mode_eap_operations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import pytest
from common.session import session
from views.domain_mode_eap_operations import domain_mode_eap_operations

@pytest.fixture (scope='session')
def web_session(request):
web_session = session(add_provider=True)
web_session.logger.info("OPR010, OPR011, OPR012, OPR013, OPR014, OPR015: Operations on Single JBoss EAP in a server group")

def closeSession():
web_session.logger.info("Close browser session")
web_session.close_web_driver()

request.addfinalizer(closeSession)

return web_session


def test_domain_mode_eap_stop(web_session):
web_session.logger.info("Begin eap Stop Test")
assert domain_mode_eap_operations(web_session).stop_eap()

def test_eap_start(web_session):
web_session.logger.info("Begin eap Start Test")
assert domain_mode_eap_operations(web_session).start_eap()

def test_eap_restart(web_session):
web_session.logger.info("Begin eap Restart Test")
assert domain_mode_eap_operations(web_session).restart_eap()

def test_eap_kill(web_session):
web_session.logger.info("Begin eap Kill Test")
assert domain_mode_eap_operations(web_session).kill_eap()

def test_eap_suspend(web_session):
web_session.logger.info("Begin eap Suspend Test")
assert domain_mode_eap_operations(web_session).suspend_eap()

def test_eap_resume(web_session):
web_session.logger.info("Begin eap Resume Test")
assert domain_mode_eap_operations(web_session).resume_eap()

def test_eap_reload(web_session):
web_session.logger.info("Begin eap Reload Test")
assert domain_mode_eap_operations(web_session).reload_eap()









98 changes: 98 additions & 0 deletions views/domain_mode_eap_operations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
from common.ui_utils import ui_utils
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from time import sleep
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
'''

Created on December 15, 2016

@author: pyadav

'''

class domain_mode_eap_operations():

web_session = None

def __init__(self, web_session):

self.web_session = web_session
self.web_driver = web_session.web_driver

def find_domain_mode_eap_power(self):
self.web_session.web_driver.get("{}/middleware_domain/show_list".format(self.web_session.MIQ_URL))
assert ui_utils(self.web_session).waitForTextOnPage("Middleware Domains", 15)
self.web_session.web_driver.find_element_by_xpath("//td[contains(.,'master')]").click()
assert ui_utils(self.web_session).waitForTextOnPage("master (Summary)", 15)
self.web_session.web_driver.find_element_by_xpath("//td[contains(.,'Middleware Server Groups')]").click()
assert ui_utils(self.web_session).waitForTextOnPage("Server Group Name", 15)
self.web_session.web_driver.find_element_by_xpath("//td[contains(.,'main-server-group')]").click()
assert ui_utils(self.web_session).waitForTextOnPage("main-server-group (Summary)", 15)
self.web_session.web_driver.find_element_by_xpath("//td[contains(.,'Middleware Servers')]").click()
assert ui_utils(self.web_session).waitForTextOnPage("Server Name", 15)
self.web_session.web_driver.find_element_by_xpath("//td[contains(.,'server-one')]").click()
assert ui_utils(self.web_session).waitForTextOnPage("Properties", 15)
self.web_session.web_driver.find_element_by_xpath("//button[@title='Power']").click()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could domains.nav_to_all_middleware_server_groups be used to navigate to Server Groups?

Seems that each caller should find a server which is in a specific state.
For example, suspending an EAP that is already in suspend state would not be a valid test since the EAP is already in the state for which the poser operation is requesting.

If there are no Domain EAPs in desire state, the test case should gracefully handle such. We may want to start using features such as pytest.skip() to indicate that a test case was not run, in this case due to a Domain server not being available.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working on this



def stop_eap(self):
self.find_domain_mode_eap_power()
self.web_session.web_driver.find_element_by_xpath("//a[@title='Stop this server']").click()
ui_utils(self.web_session).accept_alert(20)
assert ui_utils(self.web_session).waitForTextOnPage("Stop initiated for selected server(s)", 30)
return True

def restart_eap(self):
self.find_domain_mode_eap_power()
self.web_session.web_driver.find_element_by_xpath("//a[@title='Restart this server']").click()
ui_utils(self.web_session).accept_alert(20)
assert ui_utils(self.web_session).waitForTextOnPage("Restart initiated for selected server(s)", 15)
return True

def kill_eap(self):
self.find_domain_mode_eap_power()
self.web_session.web_driver.find_element_by_xpath("//a[@title='Kill this server']").click()
ui_utils(self.web_session).accept_alert(20)
assert ui_utils(self.web_session).waitForTextOnPage("Kill initiated for selected server(s)", 15)
self.start_eap() #Start EAP to perform other operation Tests
return True

def reload_eap(self):
self.find_domain_mode_eap_power()
self.web_session.web_driver.find_element_by_xpath("//a[contains(@id,'reload')]").click()
ui_utils(self.web_session).accept_alert(20)
assert ui_utils(self.web_session).waitForTextOnPage("Reload initiated for selected server(s)", 15)
return True

def suspend_eap(self):
self.find_domain_mode_eap_power()
self.web_session.web_driver.find_element_by_xpath("//a[contains(@id,'suspend')]").click()
ui_utils(self.web_session).sleep(10)
self.web_session.web_driver.find_element_by_xpath("//button[@alt='Suspend']").click()
assert ui_utils(self.web_session).waitForTextOnPage("Suspend initiated for selected server(s)", 15)
return True

def resume_eap(self):
self.find_domain_mode_eap_power()
self.web_session.web_driver.find_element_by_xpath("//a[contains(@id,'resume')]").click()
ui_utils(self.web_session).accept_alert(20)
ui_utils(self.web_session).sleep(10)
assert ui_utils(self.web_session).waitForTextOnPage("Resume initiated for selected server(s)", 15)
return True

def start_eap(self):
self.find_domain_mode_eap_power()
self.web_session.web_driver.find_element_by_xpath("//a[contains(@title,'Start this server')]").click()
ui_utils(self.web_session).accept_alert(20)
assert ui_utils(self.web_session).waitForTextOnPage("Start initiated for selected server(s)", 20)
return True