예제 #1
0
def given_cloud(context, cloud):
    end_time = time() + 5
    while time() < end_time:
        try:
            clouds = context.browser.find_element_by_id("cloud-buttons")
            cloud_buttons = clouds.find_elements_by_class_name("ui-btn")
            for button in cloud_buttons:
                if cloud.lower() in safe_get_element_text(button).lower():
                    return
        except:
            pass

        sleep(2)

    creds = cloud_creds_dict.get(cloud.lower())
    assert creds, u'Could not find credentials for %s' % cloud

    context.execute_steps(u'''
        When I click the button "Add cloud"
        Then I expect for "new-cloud-provider" panel to appear within max 4 seconds
        And I click the button "%s"
        And I expect for "new-cloud-provider" panel to disappear within max 4 seconds
        Then I expect for "cloud-add-fields" to be visible within max 4 seconds
        When I use my "%s" credentials
        And I click the button "Add"
        Then the "%s" cloud should be added within 60 seconds
    ''' % (cloud, creds, cloud))
예제 #2
0
def given_cloud(context, cloud):
    end_time = time() + 5
    while time() < end_time:
        try:
            clouds = context.browser.find_element_by_id("cloud-buttons")
            cloud_buttons = clouds.find_elements_by_class_name("ui-btn")
            for button in cloud_buttons:
                if cloud.lower() in safe_get_element_text(button).lower():
                    return
        except:
            pass

        sleep(2)

    creds = cloud_creds_dict.get(cloud.lower())
    assert creds, u'Could not find credentials for %s' % cloud

    context.execute_steps(u'''
        When I click the button "Add cloud"
        Then I expect for "new-cloud-provider" panel to appear within max 4 seconds
        And I click the button "%s"
        And I expect for "new-cloud-provider" panel to disappear within max 4 seconds
        Then I expect for "cloud-add-fields" to be visible within max 4 seconds
        When I use my "%s" credentials
        And I click the button "Add"
        Then the "%s" cloud should be added within 60 seconds
    ''' % (cloud, creds, cloud))
예제 #3
0
def key_deleted(context, text):
    if context.mist_config.get(text):
        text = context.mist_config.get(text)

    keys = context.browser.find_elements_by_css_selector(".ui-listview li")
    for key in keys:
        if text in safe_get_element_text(key):
            assert False, u'%s Key is not deleted'
예제 #4
0
파일: keys.py 프로젝트: carlcdavid/mist.io
def key_deleted(context, text):
    if context.mist_config.get(text):
        text = context.mist_config.get(text)

    keys = context.browser.find_elements_by_css_selector(".ui-listview li")
    for key in keys:
        if text in safe_get_element_text(key):
            assert False, u'%s Key is not deleted'
예제 #5
0
def given_cloud(context, cloud):
    cloud_buttons = []
    end_time = time() + 5
    while time() < end_time:
        try:
            clouds = context.browser.find_element_by_id("cloud-buttons")
            cloud_buttons = clouds.find_elements_by_class_name("ui-btn")
            if cloud_buttons:
                break
        except:
            pass

        sleep(2)

    if cloud_buttons:
        for button in cloud_buttons:
            if cloud.lower() in safe_get_element_text(button).lower():
                return

    if "openstack" in cloud.lower():
        creds = "OPENSTACK"
    elif "rackspace" in cloud.lower():
        creds = "RACKSPACE"
    elif "softlayer" in cloud.lower():
        creds = "SOFTLAYER"
    elif "hp" in cloud.lower():
        creds = "HP"
    elif "ec2" in cloud.lower():
        creds = "EC2"
    elif "nepho" in cloud.lower():
        creds = "NEPHOSCALE"
    elif "linode" in cloud.lower():
        creds = "LINODE"
    elif "docker" in cloud.lower():
        creds = "DOCKER"
    elif "digitalocean" in cloud.lower():
        creds = "DIGITALOCEAN"
    elif "indonesian" in cloud.lower():
        creds = "INDONESIAN"
    elif "libvirt" in cloud.lower():
        creds = "LIBVIRT"
    elif "packet.net" in cloud.lower():
        creds = "PACKET"
    else:
        assert False, u'Could not find credentials for %s' % cloud

    context.execute_steps(u'''
        When I click the button "Add cloud"
        Then I expect for "new-cloud-provider" panel to appear within max 2 seconds
        And I click the button "%s"
        And I expect for "new-cloud-provider" panel to disappear within max 2 seconds
        Then I expect for "cloud-add-fields" to be visible within max 2 seconds
        When I use my "%s" credentials
        And I click the button "Add"
        Then the "%s" cloud should be added within 60 seconds
    ''' % (cloud, creds, cloud))
예제 #6
0
def given_cloud(context, cloud):
    cloud_buttons = []
    end_time = time() + 5
    while time() < end_time:
        try:
            clouds = context.browser.find_element_by_id("cloud-buttons")
            cloud_buttons = clouds.find_elements_by_class_name("ui-btn")
            if cloud_buttons:
                break
        except:
            pass

        sleep(2)

    if cloud_buttons:
        for button in cloud_buttons:
            if cloud.lower() in safe_get_element_text(button).lower():
                return

    if "openstack" in cloud.lower():
        creds = "OPENSTACK"
    elif "rackspace" in cloud.lower():
        creds = "RACKSPACE"
    elif "softlayer" in cloud.lower():
        creds = "SOFTLAYER"
    elif "hp" in cloud.lower():
        creds = "HP"
    elif "ec2" in cloud.lower():
        creds = "EC2"
    elif "nepho" in cloud.lower():
        creds = "NEPHOSCALE"
    elif "linode" in cloud.lower():
        creds = "LINODE"
    elif "docker" in cloud.lower():
        creds = "DOCKER"
    elif "digitalocean" in cloud.lower():
        creds = "DIGITALOCEAN"
    elif "indonesian" in cloud.lower():
        creds = "INDONESIAN"
    elif "libvirt" in cloud.lower():
        creds = "LIBVIRT"
    elif "packet.net" in cloud.lower():
        creds = "PACKET"
    else:
        assert False, u'Could not find credentials for %s' % cloud

    context.execute_steps(u'''
        When I click the button "Add cloud"
        Then I expect for "new-cloud-provider" panel to appear within max 2 seconds
        And I click the button "%s"
        And I expect for "new-cloud-provider" panel to disappear within max 2 seconds
        Then I expect for "cloud-add-fields" to be visible within max 2 seconds
        When I use my "%s" credentials
        And I click the button "Add"
        Then the "%s" cloud should be added within 60 seconds
    ''' % (cloud, creds, cloud))
예제 #7
0
def key_added(context, text, seconds):
    if context.mist_config.get(text):
        text = context.mist_config.get(text)

    end_time = time() + int(seconds)
    while time() < end_time:
        keys = context.browser.find_elements_by_css_selector(".ui-listview li")
        for key in keys:
            if text in safe_get_element_text(key):
                return
        sleep(2)

    assert False, u'%s Key is not found added within %s seconds' % (text, seconds)
예제 #8
0
파일: keys.py 프로젝트: carlcdavid/mist.io
def key_added(context, text, seconds):
    if context.mist_config.get(text):
        text = context.mist_config.get(text)

    end_time = time() + int(seconds)
    while time() < end_time:
        keys = context.browser.find_elements_by_css_selector(".ui-listview li")
        for key in keys:
            if text in safe_get_element_text(key):
                return
        sleep(2)

    assert False, u'%s Key is not found added within %s seconds' % (text,
                                                                    seconds)
예제 #9
0
def add_or_select_key(context, key_name):
    if context.mist_config.get(key_name):
        key_name = context.mist_config.get(key_name)

    keys = context.browser.find_element_by_id('key').find_elements_by_tag_name('li')
    for key in keys:
        if key_name == safe_get_element_text(key):
            key.click()
            return

    context.execute_steps(u'''
        When I click the "Add Key" button inside the "Create Machine" panel
        Then I expect for "key-add-popup" popup to appear within max 4 seconds
        When I fill "%s" as key name
        And I click the "Generate" button inside the "Add key" popup
        Then I expect for "key-generate-loader" loader to finish within max 10 seconds
        When I click the "Add" button inside the "Add key" popup
        Then I expect for "key-add-popup" popup to disappear within max 4 seconds
    ''' % key_name)