Beispiel #1
0
def createTagTest(driver):
	wait = WebDriverWait(driver, timeout=5, poll_frequency=0.2)
	tu.newProject(driver)
	tu.selectCluster(driver, "steamtest")
	tu.selectDataframe(driver, "bank_full.hex")
	tu.selectModelCategory(driver, "Regression")
	try:
		models = ["missin"]
		for mod in models:
			tu.selectModel(driver, mod)
		driver.find_element_by_xpath("//div[@class='name-project']//input").send_keys("taggytest")
		driver.find_element_by_xpath("//button[text()='Create Project']").click()
		for mod in models:
			wait.until(lambda x: x.find_element_by_xpath("//div[@class='model-name' and text()='{0}']".format(mod)))
	except:
		print "tag test setup failed"
		return False	
	try:
		tu.goProjectConfig(driver)
		driver.find_element_by_xpath("//button[text()='Create New Label']").click()
		wait.until(lambda x: x.find_element_by_xpath("//input[@name='name']").is_displayed())
		driver.find_element_by_xpath("//input[@name='name']").send_keys("prime")
		driver.find_element_by_xpath("//textarea[@name='description']").send_keys("A cool tag to use")
		driver.find_element_by_xpath("//button[text()='Save']").click()
		wait.until(lambda x: x.find_element_by_xpath("//div[@class='label-name' and text()='prime']").is_displayed())
	except Exception as e:
		print e
		print "failed to create a new label"
		return False
	
	return True
Beispiel #2
0
def deployOneTest(driver):
	wait = WebDriverWait(driver, timeout=5, poll_frequency=0.2)
	tu.newProject(driver)
	tu.selectCluster(driver, "steamtest")
	tu.selectDataframe(driver, "bank_full.hex")
	tu.selectModelCategory(driver, "Regression")
	try:
		tu.selectModel(driver, "regress")
		driver.find_element_by_xpath("//div[@class='name-project']//input").send_keys("deptest")
		driver.find_element_by_xpath("//button[text()='Create Project']").click()
		wait.until(lambda x: x.find_element_by_xpath("//div[@class='model-name' and text()='regress']"))
	except:
		print "failed to set up test"
		return False
	try:
		tu.deployModel(driver, "regress", "happy")
		text = driver.find_element_by_xpath("//div[@class='panel-title']/span").text
		if not "happy" in text:
			print "Failed to create a named service"
			return False

	except Exception as e:
		print "Failed to deploy a model"
		return False
	return True
Beispiel #3
0
def binomSortTest(driver):
    passed = True
    wait = WebDriverWait(driver, timeout=5, poll_frequency=0.2)
    try:
        tu.goHome(driver)
        tu.newProject(driver)
        tu.selectCluster(driver, "steamtest")
        tu.selectDataframe(driver, "bank_full.hex")
        tu.selectModelCategory(driver, "Binomial")
        models = ["first", "second", "third", "fourth"]
        for mod in models:
            tu.selectModel(driver, mod)
        driver.find_element_by_xpath(
            "//div[@class='name-project']//input").send_keys("binsort")
        driver.find_element_by_xpath(
            "//button[text()='Create Project']").click()
        wait.until(
            lambda x: x.find_element_by_xpath("//li[@id='projectIdCrumb']"))
        driver.refresh()
        for mod in models:
            wait.until(lambda x: x.find_element_by_xpath(
                "//div[@class='model-name' and text()='{0}']".format(mod)))
    except Exception as e:
        print e
        print "failed to create project"
        return False

    try:
        passed = passed and checkSorting(driver, "MSE", "mse")
        passed = passed and checkSorting(driver, "AUC", "auc")
        passed = passed and checkSorting(driver, "Gini", "gini")
        passed = passed and checkSorting(driver, "LogLoss", "logloss")
    except:
        return False
    return passed
Beispiel #4
0
def nameFilterTest(driver):
    wait = WebDriverWait(driver, timeout=5, poll_frequency=0.2)
    try:
        tu.newProject(driver)
        tu.selectCluster(driver, "steamtest")
        tu.selectDataframe(driver, "bank_full.hex")
        tu.selectModelCategory(driver, "Regression")
        models = ["regress", "gradi", "missin", "linmiss"]
        for mod in models:
            tu.selectModel(driver, mod)
        driver.find_element_by_xpath(
            "//div[@class='name-project']//input").send_keys("namefilt")
        driver.find_element_by_xpath(
            "//button[text()='Create Project']").click()
        wait.until(lambda x: x.find_element_by_xpath("//div[@class='filter']"))
        driver.refresh()
        time.sleep(2)
        for mod in models:
            wait.until(lambda x: x.find_element_by_xpath(
                "//div[@class='model-name' and text()='{0}']".format(mod)))
    except Exception as e:
        print e
        print "Failed to setup name filter test"
        return False
    try:
        f = driver.find_element_by_xpath("//div[@class='filter']/input")
        f.send_keys("linmiss")
        wait.until(lambda x: len(
            x.find_elements_by_xpath("//div[@class='model-name']")) == 1)
        if not driver.find_element_by_xpath(
                "//div[@class='model-name']").text == "linmiss":
            print "Name filter did not apply correctly"
            return False
        driver.refresh()
        wait.until(lambda x: len(
            x.find_elements_by_xpath("//div[@class='model-name']")) == 4)
        f = driver.find_element_by_xpath("//div[@class='filter']/input")
        f.send_keys("r")
        wait.until(lambda x: len(
            x.find_elements_by_xpath("//div[@class='model-name']")) == 2)
        for mod in driver.find_elements_by_xpath("//div[@class='model-name']"):
            if not (mod.text == "regress" or mod.text == "gradi"):
                print "Name filter did not apply correctly"
                return False

    except:
        print "Failed to filter models"
        return False

    return True
Beispiel #5
0
def createProjectTest(driver):
    try:
        tu.newProject(driver)
        wait = WebDriverWait(driver, timeout=5, poll_frequency=0.2)
        wait.until(lambda x: x.find_element_by_class_name("select-cluster").
                   is_displayed())
        tu.selectCluster(driver, "steamtest")
    except:
        print "Failed to connect to cluster"
        return False
    try:
        wait = WebDriverWait(driver, timeout=5, poll_frequency=0.2)
        wait.until(lambda x: x.find_element_by_xpath(
            "//option[@value='bank_full.hex']"))
        if not tu.selectDataframe(driver, "bank_full.hex"):
            print "Failed to access expected dataframe"
            return False
        wait.until(lambda x: x.find_element_by_xpath(
            "//option[@value='Regression']").is_displayed())
        if not tu.selectModelCategory(driver, "Regression"):
            print "Failed to find regression models"
            return False
        wait.until(lambda x: x.find_element_by_name("regress").is_displayed())
        if not tu.selectModel(driver, "regress"):
            print "Failed to select an expected model for importing"
            return False
        pnam = driver.find_element_by_xpath(
            "//div[@class='name-project']//input")
        pnam.send_keys("imported")
        driver.find_element_by_xpath(
            "//button[text()='Create Project']").click()
    except:
        print "Failed to create a project with a selected model"
        return False
    try:
        wait.until(lambda x: x.find_element_by_xpath(
            "//div[@class='model-name' and text()='regress']"))
    except Exception as e:
        print "Failed to locate imported model on project page"
        return False
    return True
Beispiel #6
0
def projectDeployTest(driver):
	wait = WebDriverWait(driver, timeout=5, poll_frequency=0.2)
	try:
		tu.goHome(driver)
		tu.newProject(driver)
		tu.selectCluster(driver, "steamtest")
		tu.selectDataframe(driver, "bank_full.hex")
		tu.selectModelCategory(driver, "Regression")
		tu.selectModel(driver, "regress")
		tu.selectModel(driver, "gradi")
		tu.selectModel(driver, "missin")
		driver.find_element_by_xpath("//div[@class='name-project']//input").send_keys("projtest")
		#driver.find_element_by_xpath("//div").send_keys(Keys.F12)
		driver.find_element_by_xpath("//button[text()='Create Project']").click()
		time.sleep(2)
		driver.refresh()
		for m in ["regress", "gradi", "missin"]:
			wait.until(lambda x: x.find_element_by_xpath("//div[@class='model-name' and text()='{0}']".format(m)))
		tu.deployModel(driver, "gradi", "swell")
		tu.goHome(driver)
		tu.goProjects(driver)
		time.sleep(1)
		tu.viewProject(driver, "deptest")
		tu.goProjectDeployment(driver)
	except:
		print "Failed to deploy gradi"
		return False
	try:
		time.sleep(1)
		driver.refresh()
		time.sleep(1)
		wait.until(lambda x: x.find_element_by_class_name("services-panel"))
		print "Deployed service is displayed in unassociated project"
		return False
	except:
		return True

	return False
Beispiel #7
0
def importMultiTest(driver):
    tu.goHome(driver)
    if not tu.newProject(driver):
        print "Failed to navigate to new project page after creating a project"
        return False
    tu.selectCluster(driver, "steamtest")
    wait = WebDriverWait(driver, timeout=5, poll_frequency=0.2)
    try:
        wait.until(lambda x: x.find_element_by_xpath(
            "//option[@value='bank_full.hex']"))
        if not tu.selectDataframe(driver, "bank_full.hex"):
            print "Failed to access expected dataframe"
            return False
        wait.until(
            lambda x: x.find_element_by_xpath("//option[@value='Regression']"))
        if not tu.selectModelCategory(driver, "Regression"):
            print "Failed to find regression models"
            return False
        models = ["regress", "gradi", "missin", "linmiss"]
        for mod in models:
            if not tu.selectModel(driver, mod):
                print "Failed to select expected model for importing"
                return False
        driver.find_element_by_xpath(
            "//div[@class='name-project']//input").send_keys("multimod")
        driver.find_element_by_xpath(
            "//button[text()='Create Project']").click()
        time.sleep(2)
        driver.refresh()
        time.sleep(2)
        for mod in models:
            wait.until(lambda x: x.find_element_by_xpath(
                "//div[@class='model-name' and text()='{0}']".format(mod)))
    except Exception as e:
        print e
        print "new project failed to include all imported models"
        return False
    return True
Beispiel #8
0
def regressSortTest(driver):
    passed = True
    wait = WebDriverWait(driver, timeout=5, poll_frequency=0.2)
    try:
        tu.newProject(driver)
        tu.selectCluster(driver, "steamtest")
        tu.selectDataframe(driver, "bank_full.hex")
        tu.selectModelCategory(driver, "Regression")
        models = ["regress", "gradi", "missin", "linmiss"]
        for mod in models:
            tu.selectModel(driver, mod)
        driver.find_element_by_xpath(
            "//div[@class='name-project']//input").send_keys("regsort")
        driver.find_element_by_xpath(
            "//button[text()='Create Project']").click()
        wait.until(
            lambda x: x.find_element_by_xpath("//li[@id='projectIdCrumb']"))
        driver.refresh()
        for mod in models:
            wait.until(lambda x: x.find_element_by_xpath(
                "//div[@class='model-name' and text()='{0}']".format(mod)))
    except Exception as e:
        print e
        print "failed to create project"
        return False

    try:
        passed = passed and checkSorting(driver, "MSE", "mse")
        passed = passed and checkSorting(driver, "R2", "r2")
        passed = passed and checkSorting(driver, "MRD", "mrd")
    except Exception as e:
        print e
        print "models failed to sort"
        return False

    return passed
Beispiel #9
0
def multiDeployTest(driver):
	wait = WebDriverWait(driver, timeout=5, poll_frequency=0.2)
	try:
		tu.goHome(driver)
		tu.newProject(driver)
		tu.selectCluster(driver, "steamtest")
		tu.selectDataframe(driver, "bank_full.hex")
		tu.selectModelCategory(driver, "Regression")
		tu.selectModel(driver, "linmiss")
		driver.find_element_by_xpath("//div[@class='name-project']//input").send_keys("multidep")
		driver.find_element_by_xpath("//button[text()='Create Project']").click()
		wait.until(lambda x: x.find_element_by_xpath("//div[@class='model-name' and text()='linmiss']"))
		tu.deployModel(driver, "linmiss", "double")
		tu.goHome(driver)
		tu.goServices(driver)
	except Exception as e:
		print "failed to setup multi deploy test"
		return False
	try:
		time.sleep(3)
		wait.until(lambda x: x.find_element_by_class_name("panel-title"))
		deps = driver.find_elements_by_xpath("//div[@class='panel-title']/span")
		names = ["double", "swell"]
		for name in names:
			good = False
			for dep in deps:
				if name in dep.text:
					good = True
			if not good:
				print "Service '{0}' failed to deploy".format(name)
				return False

	except Exception as e:
		print "Failed to find deployments on services page"
		return False	
	return True