Exemple #1
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
Exemple #2
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
Exemple #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
Exemple #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
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 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
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
Exemple #10
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
Exemple #11
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 #12
0
def superShareTest():
    res = [True, True]
    tu.cliLogin("superuser", "superuser")
    wg = tu.createWorkgroup("supertest", "testin super share")
    d = tu.newtest()
    wait = WebDriverWait(d, timeout=5, poll_frequency=0.2)
    tu.newProject(d)
    tu.addCluster(d, "localhost", "54535", "steamtest")
    d.find_element_by_xpath("//div[@class='select-cluster']//button").click()
    tu.selectDataframe(d, "bank_full.hex")
    tu.selectModelCategory(d, "Regression")
    try:
        tu.selectModel(d, "regress")
        d.find_element_by_xpath(
            "//div[@class='name-project']//input").send_keys("supertest")
        d.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']"))
        tu.goProjectConfig(d)
        d.find_element_by_xpath("//button[text()='Create New Label']").click()
        wait.until(lambda x: x.find_element_by_xpath("//input[@name='name']").
                   is_displayed())
        d.find_element_by_xpath("//input[@name='name']").send_keys("taggy")
        d.find_element_by_xpath("//textarea[@name='description']").send_keys(
            "the taggiest tag")
        d.find_element_by_xpath("//button[text()='Save']").click()
        wait.until(lambda x: x.find_element_by_xpath(
            "//div[@class='label-name' and text()='taggy']").is_displayed())
    except:
        print "Failed to setup super sharing test"
        return False
    finally:
        tu.endtest(d)

    tu.shareEntity(6, 1, wg, 'edit')
    tu.shareEntity(9, 1, wg, 'edit')

    uid = tu.createIdentity("noperm", "noperm")
    tu.assignWorkgroup(uid, wg)
    d = tu.testAs("noperm", "noperm")
    try:
        #permissionless test
        tu.goProjects(d)
        if tu.viewProject(d, "supertest"):
            res[0] = False
            print "User with no permissions is able to view entities shared by superuser"
    except:
        res[0] = True
    finally:
        tu.endtest(d)

    uid = tu.createIdentity("yaperm", "yaperm")
    rid = tu.createRole("permissed", "for testing supershare",
                        [9, 10, 11, 12, 17, 18, 19, 20])
    tu.assignWorkgroup(uid, wg)
    tu.assignRole(uid, rid)
    d = tu.testAs("yaperm", "yaperm")
    try:
        #permissable test
        tu.goProjects(d)
        time.sleep(2)
        if not tu.viewProject(d, "supertest"):
            res[0] = False
            print "User could not see project shared by superuser"
    except:
        res[1] = False
        print "User with appropriate permissions is not able to view entities shared by superuser"
    finally:
        tu.endtest(d)
    return res[0] and res[1]
Exemple #13
0
def userShareTest():
    res = [True, True]
    uid = tu.createIdentity("setup", "setup")
    rid = tu.createRole("userole", "comfy af", [x for x in range(23) if x > 0])
    tu.assignRole(uid, rid)
    tu.cliLogin("setup", "setup")
    wg = tu.createWorkgroup("clusterwg", "for sharing the cluster")
    tu.assignWorkgroup(uid, wg)
    tu.cliLogin("superuser", "superuser")
    tu.shareEntity(5, 1, wg, 'edit')
    tu.cliLogin("setup", "setup")
    wg = tu.createWorkgroup("usertest", "testin user share")
    d = tu.testAs("setup", "setup")
    try:
        wait = WebDriverWait(d, timeout=5, poll_frequency=0.2)
        tu.newProject(d)
        time.sleep(2)
        d.find_element_by_xpath(
            "//div[@class='select-cluster']//button").click()
        tu.selectDataframe(d, "bank_full.hex")
        tu.selectModelCategory(d, "Regression")
        tu.selectModel(d, "gradi")
        d.find_element_by_xpath(
            "//div[@class='name-project']//input").send_keys("averagetest")
        d.find_element_by_xpath("//button[text()='Create Project']").click()
        wait.until(lambda x: x.find_element_by_xpath(
            "//div[@class='model-name' and text()='gradi']"))
    except Exception as e:
        print "Failed to setup user share test"
        return False
    finally:
        tu.endtest(d)

    tu.shareEntity(6, 2, wg, 'edit')
    tu.shareEntity(9, 2, wg, 'edit')

    uid = tu.createIdentity("permless", "permless")
    tu.cliLogin("superuser", "superuser")
    tu.assignWorkgroup(uid, wg)
    d = tu.testAs("permless", "permless")
    try:
        #permissionless test
        tu.goProjects(d)
        if tu.viewProject(d, "averagetest"):
            res[0] = False
            print "User with no permissions is able to view entities shared by non-superuser"
    except:
        res[0] = True
    finally:
        tu.endtest(d)

    uid = tu.createIdentity("useperm", "useperm")
    rid = tu.createRole("collmissed", "for testing usershare",
                        [9, 10, 11, 12, 17, 18, 19, 20])
    tu.assignWorkgroup(uid, wg)
    tu.assignRole(uid, rid)
    d = tu.testAs("useperm", "useperm")
    try:
        #permissable test
        tu.goProjects(d)
        if not tu.viewProject(d, "averagetest"):
            res[0] = False
            print "User could not see project shared by non-superuser"
    except:
        res[1] = False
        print "User with appropriate permissions is not able to view entities shared by non-superuser"
    finally:
        tu.endtest(d)

    return res[0] and res[1]