Skip to content

Instantly share code, notes, and snippets.

View weissjeffm's full-sized avatar

Jeff Weiss weissjeffm

View GitHub Profile
@weissjeffm
weissjeffm / anonymous-gist.
Created March 28, 2014 19:47
first trace
is_displayed('//div[@id="page_header_div"]//li[contains(@class, "dropdown")]')
element('//div[@id="page_header_div"]//li[contains(@class, "dropdown")]')
cfme.fixtures.pytest_selenium.elements('//div[@id="page_header_div"]//li[contains(@class, "dropdown")]')
browser()
-> <selenium.webdriver.chrome.webdriver.WebDriver object at 0x36e7ed0>
-> []
-> Message: 'Element //div[@id="page_header_div"]//li[contains(@class, "dropdown")] not found on page.'
-> False
sleep(1.0)
-> None
@weissjeffm
weissjeffm / anonymous-gist.
Created March 28, 2014 19:50
trace-login
login('admin', 'smartvm')
logged_in()
is_displayed('//div[@id="page_header_div"]//li[contains(@class, "dropdown")]')
element('//div[@id="page_header_div"]//li[contains(@class, "dropdown")]')
cfme.fixtures.pytest_selenium.elements('//div[@id="page_header_div"]//li[contains(@class, "dropdown")]')
browser()
-> <selenium.webdriver.chrome.webdriver.WebDriver object at 0x36e7ed0>
-> []
-> Message: 'Element //div[@id="page_header_div"]//li[contains(@class, "dropdown")] not found on page.'
-> False
@weissjeffm
weissjeffm / anonymous-gist.
Created March 31, 2014 14:13
format trace
- cfme.login.login('admin', 'smartvm')
| - cfme.login.logged_in()
| | - cfme.fixtures.pytest_selenium.is_displayed('//div[@id="page_header_div"]//li[contains(@class, "dropdown")]')
| | | - cfme.fixtures.pytest_selenium.element('//div[@id="page_header_div"]//li[contains(@class, "dropdown")]')
| | | | - utils.browser.browser()
| | | | -> <selenium.webdriver.chrome.webdriver.WebDriver object at 0x32f4a50>
| | | -> Message: 'Element //div[@id="page_header_div"]//li[contains(@class, "dropdown")] not found on page.'
| | -> False
| -> None
| - time.sleep(1.0)
import pytest
from cfme.automate.explorer import Namespace, Class
from utils.randomness import generate_random_string
pytestmark = [pytest.mark.usefixtures("logged_in")]
@pytest.fixture(scope='module')
def gen_namespace():
name = generate_random_string(8)
import selenium.webdriver.common.keys as ks
sel.send_keys("//div[@class='CodeMirror CodeMirror-focused']/div/textarea", ks.Keys.LEFT_CONTROL + "a")
sel.send_keys("//div[@class='CodeMirror CodeMirror-focused']/div/textarea", "foo")
@staticmethod
def make_path(*names):
'''Make a set of nested Namespace objects with the given path.
eg.
n = Namespace.make_path("foo", "bar")
is equivalent to:
n = Namespace(name="bar", parent=Namespace(name="foo"))
'''
if names:
import cfme.fixtures.pytest_selenium as sel
reload(sel)
sel.ensure_browser_open()
import cfme.login as login
login.login_admin()
@weissjeffm
weissjeffm / anonymous-gist.py
Last active August 29, 2015 13:59
path_nav.py
# Tree path navigation
def expand_path(self, *path):
""" Clicks through a series of elements in a path.
Clicks through a tree, by expanding the levels in a single straight path and
returns the final element without clicking it.
Args:
*path: The path as multiple positional string arguments denoting the course to take.
@weissjeffm
weissjeffm / anonymous-gist.py
Created April 14, 2014 15:46
handle_nav.py
def exists(self):
with error.handler(tree_item_not_found_is_leaf):
nav.go_to('automate_explorer_edit', context={'namespace': self})
return True
return False
fill(dialog_form, {...})
for tab in tabs:
click(plus_button)
fill(tab_form, tab)
click(add_button)