Exemple #1
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
Exemple #2
0
def viewProjectTest(driver):
    tu.goHome(driver)
    if not tu.goProjects(driver):
        print "Failed setting up viewproject"
        return False
    try:
        proj = driver.find_element_by_xpath(
            "//div[@class='project-metadata']/header[text()='imported']")
        proj.click()
        wait = WebDriverWait(driver, timeout=5, poll_frequency=0.2)
        wait.until(lambda x: x.find_element_by_xpath(
            "//div[@class='model-name' and text()='regress']"))
    except:
        print "Failed to open models page after selecting a project"
        return False
    return True
Exemple #3
0
def main():
    failcount = 0
    d = tu.newtest()
    r = setup()

    if not writeumsTest(d, r):
        failcount += 1
    d.refresh()
    tu.goHome(d)
    if not createUserTest(d):
        failcount += 1
    if not createRoleTest(d):
        failcount += 1
    if not createRoleUserTest(d):
        failcount += 1

    tu.endtest(d)
    sys.exit(failcount)
Exemple #4
0
def cleanupTest(driver):
	wait = WebDriverWait(driver, timeout=5, poll_frequency=0.2)
	tu.goHome(driver)
	tu.goServices(driver)
	time.sleep(2)
	cnt = len(driver.find_elements_by_class_name("services-panel"))
	stopped = 0
	if tu.serviceExists(driver, "swell"):
		tu.stopService(driver, "swell")
		stopped += 1
	if tu.serviceExists(driver, "double"):
		tu.stopService(driver, "double")
		stopped += 1
	try:
		wait.until(lambda x: len(x.find_elements_by_class_name("services-panel")) <= (cnt - stopped))
	except:
		print "failed to stop running services"
		return False
	return True
Exemple #5
0
def conflictTagTest(driver):
	wait = WebDriverWait(driver, timeout=5, poll_frequency=0.2)
	tu.goHome(driver)
	tu.newProject(driver)
	driver.find_element_by_xpath("//div[@class='select-cluster']//button").click()
	tu.selectDataframe(driver, "bank_full.hex")
	tu.selectModelCategory(driver, "Regression")	
	try:
		models = ["regress", "gradi"]
		for mod in models:
			tu.selectModel(driver, mod)
		driver.find_element_by_xpath("//div[@class='name-project']//input").send_keys("tagtest")
		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:
		print "conflict tag test setup failed"
		return False	
	try:
		tag = tu.getModelTag(driver, "regress")
		tu.goProjectConfig(driver)
		tu.createTag(driver, "taggy", "the taggiest tag")
		tu.goModels(driver)
		for mod in ["regress", "gradi"]:
			wait.until(lambda x: x.find_element_by_xpath("//div[@class='model-name' and text()='{0}']".format(mod)))
		tu.applyTagToModel(driver, "taggy", "regress")
		tu.applyTagToModel(driver, "taggy", "gradi")
		tag = tu.getModelTag(driver, "regress")
		if len(tag) > 1:
			print "Model has multiple tags associated with it"
			return False
		if len(tag) == 1 and tag[0].text == "taggy":
			print "Tag stayed assicated with model after being applied to a different model"
			return False
	except Exception as e:
		print e
		print "Failed to create and apply a new tag to models"
		return False
	return True
Exemple #6
0
def deleteTagTest(driver):
	wait = WebDriverWait(driver, timeout=5, poll_frequency=0.2)
	tu.goHome(driver)
	tu.newProject(driver)
	driver.find_element_by_xpath("//div[@class='select-cluster']//button").click()
	tu.selectDataframe(driver, "bank_full.hex")
	tu.selectModelCategory(driver, "Regression")
	try:
		models = ["regress"]
		for mod in models:
			tu.selectModel(driver, mod)
		driver.find_element_by_xpath("//div[@class='name-project']//input").send_keys("deletetest")
		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:
		return False
	try:
		tu.goProjectConfig(driver)
		tu.createTag(driver, "delet", "to be deleted at once")
		tu.goModels(driver)
		wait.until(lambda x: x.find_element_by_xpath("//div[@class='model-name' and text()='regress']"))
		tu.applyTagToModel(driver, "delet", "regress")
		tu.goProjectConfig(driver)
		if not tu.deleteTag(driver, "delet"):
			print "failed to delete tag"
			return False
		tu.goModels(driver)
		wait.until(lambda x: x.find_element_by_xpath("//div[@class='model-name' and text()='regress']"))
		time.sleep(2)
		tag = tu.getModelTag(driver, "regress")
		if len(tag) > 0 and tag[0].text == "delet":
			print "Model attached to deleted tag"
			return False
	except:
		print "Failed to delete tag"
		return False
	return True
Exemple #7
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
Exemple #8
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
Exemple #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