def test_cockpit_button_access(provider, soft_assert): """ The test verifies the existence of cockpit "Web Console" button on master node, then presses on the button and opens up the cockpit main page in a new window. Then we verify the title of the main cockpit page. The test will not work until the single sign-on bug is fixed """ collection = NodeCollection() nodes = collection.all() node = [node for node in nodes if 'master' in node.name][0] navigate_to(node, 'Details') soft_assert( tb.exists( 'Open a new browser window with Cockpit for this ' 'VM. This requires that Cockpit is pre-configured on the VM.'), 'No "Web Console" button found') tb.select('Open a new browser window with Cockpit for this ' 'VM. This requires that Cockpit is pre-configured on the VM.') port_num = ':9090/system' url_cockpit = provider.hostname + port_num sel.get(url_cockpit) title_pg = sel.title() soft_assert(title_pg == 'Cockpit', 'Cockpit main page failed to open')
def test_cockpit_button_access(provider, appliance, soft_assert): """ The test verifies the existence of cockpit "Web Console" button on master node, then presses on the button and opens up the cockpit main page in a new window. Then we verify the title of the main cockpit page. The test will not work until the single sign-on bug is fixed """ collection = appliance.collections.nodes nodes = collection.all() node = [node for node in nodes if 'master' in node.name][0] navigate_to(node, 'Details') soft_assert( tb.exists( 'Open a new browser window with Cockpit for this ' 'VM. This requires that Cockpit is pre-configured on the VM.'), 'No "Web Console" button found') tb.select('Open a new browser window with Cockpit for this ' 'VM. This requires that Cockpit is pre-configured on the VM.') port_num = ':9090/system' url_cockpit = provider.hostname + port_num sel.get(url_cockpit) title_pg = sel.title() soft_assert(title_pg == 'Cockpit', 'Cockpit main page failed to open')
def test_basic_metrics(provider): """ Basic Metrics availability test This test checks that the Metrics service is up Opens the hawkular status page and checks if it's up """ hostname = 'https://' + conf.cfme_data.get('management_systems', {})[provider.key]\ .get('hostname', []) + '/hawkular/metrics' ensure_browser_open() sel.get(hostname) element = sel.ByText('STARTED') assert element
def test_services_request_direct_url(generated_request): """Go to the request page, save the url and try to access it directly.""" assert requests.go_to_request(generated_request), "could not find the request!" request_url = sel.current_url() sel.get(sel.base_url()) # I need to flip it with something different here sel.get(request_url) # Ok, direct access now. wait_for( lambda: sel.is_displayed("//body[contains(@onload, 'miqOnLoad')]"), num_sec=20, message="wait for a CFME page appear", delay=0.5 )
def test_services_request_direct_url(generated_request): """Go to the request page, save the url and try to access it directly.""" assert requests.go_to_request( generated_request), "could not find the request!" request_url = sel.current_url() sel.get(sel.base_url()) # I need to flip it with something different here sel.get(request_url) # Ok, direct access now. wait_for( lambda: sel.is_displayed("//body[contains(@onload, 'miqOnLoad')]"), num_sec=20, message="wait for a CFME page appear", delay=0.5)
def test_services_request_direct_url(generated_request): """Go to the request page, save the url and try to access it directly.""" assert requests.go_to_request( generated_request), "could not find the request!" request_url = sel.current_url() sel.get(env["base_url"]) # I need to flip it with something different here sel.get(request_url) # Ok, direct access now. # This is a bit tricky. We have to wait IF the blank page appeared, because checking # if we are STILL IN CFME is unreliable as the transition is not guarded by JS or stuff. # btw. when the on_cfme_page returns true because of being on login screen, it will work. # After logging in, user is redirected for a correct link. Tested. try: wait_for(lambda: not sel.on_cfme_page(), num_sec=20, message="wait for blank page appear") pytest.fail("Blank screen appeared!") except TimedOutError: pass # Success!
def test_services_request_direct_url(generated_request): """Go to the request page, save the url and try to access it directly.""" assert requests.go_to_request(generated_request), "could not find the request!" request_url = sel.current_url() sel.get(env["base_url"]) # I need to flip it with something different here sel.get(request_url) # Ok, direct access now. # This is a bit tricky. We have to wait IF the blank page appeared, because checking # if we are STILL IN CFME is unreliable as the transition is not guarded by JS or stuff. # btw. when the on_cfme_page returns true because of being on login screen, it will work. # After logging in, user is redirected for a correct link. Tested. try: wait_for( lambda: not sel.on_cfme_page(), num_sec=20, message="wait for blank page appear" ) pytest.fail("Blank screen appeared!") except TimedOutError: pass # Success!
def test_page(browser, datafile): test_page_html = datafile( '/utils/tests/test_simple_locators/elements.html').read() sel.get('data:text/html;base64,{}'.format(test_page_html.encode('base64')))
def test_page(browser, datafile): test_page_html = datafile('/utils/tests/test_simple_locators/elements.html').read() sel.get('data:text/html;base64,{}'.format(test_page_html.encode('base64')))