本文整理汇总了Python中helpers.WebdriverUtilities.WebdriverUtilities类的典型用法代码示例。如果您正苦于以下问题:Python WebdriverUtilities类的具体用法?Python WebdriverUtilities怎么用?Python WebdriverUtilities使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WebdriverUtilities类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testWorkflowSmokeTest
def testWorkflowSmokeTest(self):
self.testname="TestWorkflowSmokeTest"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = WorkFlowHelper(self)
do.setUtils(util)
do.login()
print "TEST THAT YOU CAN CREATE WORKFLOW"
myWorkflow_1 = do.createWorkflow("", "[email protected]") #wf is not blank after created successfully
self.assertNotEqual(myWorkflow_1, "", "Failed creating a work flow 1 .")
print "myWorkflow_1: " + myWorkflow_1
myWorkflow_2 = do.createWorkflow("", "[email protected]") #wf is not blank after created successfully
self.assertNotEqual(myWorkflow_2, "", "Failed creating a work flow 2.")
print "myWorkflow_2: " + myWorkflow_2
# expand Workflow
do.ensureLHNSectionExpanded("Workflow")
print "TEST THAT YOU CAN SELECT WORKFLOW"
do.selectAWorkflowWF(myWorkflow_1, False, "Draft")
do.selectInnerNavMenuItemWF("People")
do.selectInnerNavMenuItemWF("Setup")
do.selectInnerNavMenuItemWF("History")
do.selectInnerNavMenuItemWF("Active Cycles")
do.selectInnerNavMenuItemWF("Workflow Info")
示例2: testAllTabsIntegrity
def testAllTabsIntegrity(self):
self.testname="TestAllTabsIntegrity"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
directive_xpath = '//a[(@class="governance list-toggle" and @data-object-singular="OBJECT")]'
self.assertEqual("PROGRAMS", self._returnStringUpToFirstSpace(do.util.getTextFromXpathString(element.left_nav_expand_object_section_link.replace("OBJECT", "Program"))))
self.assertEqual("AUDITS", self._returnStringUpToFirstSpace(do.util.getTextFromXpathString(element.left_nav_expand_object_section_link.replace("OBJECT", "Audit"))))
temp = do.util.getTextFromXpathString('//a[(@class="governance list-toggle" and @data-object-singular="Regulation")]')
self.assertEqual("REGULATIONS", self._returnStringUpToFirstSpace(do.util.getTextFromXpathString(self.directive_xpath.replace("OBJECT", "Regulation"))))
self.assertEqual("POLICIES", self._returnStringUpToFirstSpace(directive_xpath.replace("OBJECT", "Policy")))
self.assertEqual("STANDARDS", self._returnStringUpToFirstSpace(directive_xpath.replace("OBJECT", "Standard")))
self.assertEqual("CONTRACTS", self._returnStringUpToFirstSpace(directive_xpath.replace("OBJECT", "Contract")))
self.assertEqual("CLAUSES", self._returnStringUpToFirstSpace(directive_xpath.replace("OBJECT", "Clause")))
self.assertEqual("Sections", self._returnStringUpToFirstSpace(directive_xpath.replace("OBJECT", "Section")))
self.assertEqual("Objectives", self._returnStringUpToFirstSpace(do.util.getTextFromXpathString(element.left_nav_expand_object_section_link.replace("OBJECT", "Objective"))))
self.assertEqual("Controls", self._returnStringUpToFirstSpace(do.util.getTextFromXpathString(element.left_nav_expand_object_section_link.replace("OBJECT", "Control"))))
self.assertEqual("People", self._returnStringUpToFirstSpace(do.util.getTextFromXpathString(element.left_nav_expand_object_section_link.replace("OBJECT", "Person"))))
self.assertEqual("Org Groups", do.util.getTextFromXpathString(element.left_nav_org_group_link)[0:10])
self.assertEqual("Systems", self._returnStringUpToFirstSpace(do.util.getTextFromXpathString(element.left_nav_expand_object_section_link.replace("OBJECT", "System"))))
self.assertEqual("Processes", self._returnStringUpToFirstSpace(do.util.getTextFromXpathString(element.left_nav_expand_object_section_link.replace("OBJECT", "Process"))))
self.assertEqual("Data Assets", do.util.getTextFromXpathString(element.left_nav_data_asset_link)[0:11])
self.assertEqual("Products", self._returnStringUpToFirstSpace(do.util.getTextFromXpathString(element.left_nav_expand_object_section_link.replace("OBJECT", "Product"))))
self.assertEqual("Projects", self._returnStringUpToFirstSpace(do.util.getTextFromXpathString(element.left_nav_expand_object_section_link.replace("OBJECT", "Project"))))
self.assertEqual("Facilities", self._returnStringUpToFirstSpace(do.util.getTextFromXpathString(element.left_nav_expand_object_section_link.replace("OBJECT", "Facility"))))
self.assertEqual("Markets", do.util.getTextFromXpathString(element.left_nav_market_link)[0:7])
示例3: testFourLevelsMapping
def testFourLevelsMapping(self):
self.testname="TestFourLevelsMapping"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
# mapping and un-mapping up to 3 levels:
# Program->Regulation->Section->Object
titlePol = do.getUniqueString("policy")
titlePrgm = do.getUniqueString("program")
titleSec = do.getUniqueString("section")
titleMkt = do.getUniqueString("policy")
do.createObject("Policy", titlePol)
do.createObject("Program", titlePrgm)
do.mapAObjectWidget("Policy", titlePol)
do.createObject("Market", titleMkt)
do.createObject("Section", titleSec)
do.mapAObjectWidget("Market", titleMkt)
do.mapAObjectWidget("Section", titleSec)
示例4: testNoAccessRole
def testNoAccessRole(self):
self.testname="TestNoAccessRole"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
email = config.reader1
reader = config.reader2
password = config.same_password
title = "Auto_Private_" + do.getTimeId() + str(do.getRandomNumber())
do.createObject("Program", title, "checked")
do.verifyObjectIsCreatedinLHN("Program", title)
do.assertEqual(1, do.countOfAnyObjectLHS("Program"), "Expect count to be 1 but don't see it.")
# now log out and then log in with the new account and try to create a program
do.selectMenuInTopRight("Logout")
# Refresh the page
do.refresh()
# Log in with new user
do.login(reader, password)
print "Log in as : " + do.whoAmI()
do.uncheckMyWorkBox()
try:
do.verifyObjectIsCreatedinLHN("Program", title)
except:
do.assertEqual(0, do.countOfAnyObjectLHS("Program"), "Expect count to be 0 but don't see it.")
print "Good...private program should not be visible to reader role unless permitted."
示例5: testHideOnProgramModal
def testHideOnProgramModal(self):
self.testname="TestHideOnProgramModal"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
list_all = "all"
list_items = "description, private, note, owner, contact, url, reference_url, code, effective_date, end_date, state"
a_few_items = "owner, note"
print "TEST THAT YOU CAN SHOW OR HIDE FIELDS/ELEMENTS ON PROGRAM MODAL."
# fill in mandatory fields only
do.openCreateNewObjectWindowFromLhn("Program")
# hide_all, show_all, then hide individual
do.hideInProgramNewModal(True, list_all)
do.hideInProgramNewModal(False, list_all)
do.hideInProgramNewModal(True, list_items)
# show all again, hide a few will cause show_all to display, now reshow_all
do.hideInProgramNewModal(False, list_all)
do.hideInProgramNewModal(True, a_few_items)
do.hideInProgramNewModal(False, list_all)
# hide all again
do.hideInProgramNewModal(True, list_all)
示例6: testSaveAndAddAnotherProject
def testSaveAndAddAnotherProject(self):
self.testname="TestSaveAndAddAnotherProject"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
object_1_name = do.generateNameForTheObject("Project")
do.delay(10) # count number does not appear right away, weird
object_2_name = "Project_" + str(do.getRandomNumber())
do.ensureLHNSectionExpanded("Project")
count_before = do.countOfAnyObjectLHS("Project")
do.createObjectSaveAddAnother("Project", object_1_name, "unchecked", True, "", False)
do.createObjectSaveAddAnother("Project", object_2_name, "unchecked", False, "", True)
do.clearSearchBoxOnLHS() #clear any text so total count displays
do.ensureLHNSectionExpanded("Project")
count_after = do.countOfAnyObjectLHS("Project")
do.assertEqual(count_after, count_before+2, "Count has not incremented by 1 as expected.")
print "Object 1: "
object_1_link = do.verifyObjectIsCreatedinLHN("Project", object_1_name)
do.navigateToObjectAndOpenObjectEditWindow("Project",object_1_link)
do.deleteObject()
print "Object 2: "
object_2_link = do.verifyObjectIsCreatedinLHN("Project", object_2_name)
do.navigateToObjectAndOpenObjectEditWindow("Project",object_2_link)
do.deleteObject()
示例7: testHideShowNewModalPeople
def testHideShowNewModalPeople(self):
self.testname="TestHideShowNewModalPeople"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
list_all = "all"
list_items = "enabled_user, company"
a_few_items = "company"
print "TEST THAT YOU CAN SHOW OR HIDE FIELDS/ELEMENTS IN CREATE NEW OBJECT MODAL."
# fill in mandatory fields only
do.openCreateNewObjectWindowFromLhn("Person")
# hide_all, show_all, then hide individual
do.hideInNewModal(list_all, True, "person")
do.hideInNewModal(list_all, False, "person")
# hide individually
do.hideInNewModal(list_items, True, "person")
# show all again, hide a few will cause show_all to display, now reshow_all
do.hideInNewModal(list_all, False, "person")
do.hideInNewModal(a_few_items, True, "person")
do.hideInNewModal(list_all, False, "person")
do.populateNewObjectData(do.generateNameForTheObject("person"))
do.saveNewObjectAndWait()
示例8: testCreatePrivateProgramOwner
def testCreatePrivateProgramOwner(self):
self.testname="TestCreatePrivateProgramOwner"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
grcobject = GRCObject()
do.setUtils(util)
do.login()
email = config.creator1
password = config.same_password
private_prgm_1 = do.createPrivateProgramPermission(email, "", "ProgramOwner")
print private_prgm_1
# map any object so that we can check that reader can see
do.mapAObjectLHN("Contract")
# now log out and then log in with the ProgramEditor user
do.selectMenuInTopRight("Logout")
do.refresh()
# Log in with new user
do.login(email, password)
print "Log in as : " + do.whoAmI()
do.assertEquals("ProgramCreator", do.getRoleLabelInTopRight(), "Label does not says 'ProgramCreator'.")
do.selectMenuInTopRight("My Work")
# verify that user can see program tab and some programs; by seeing counts
do.selectInnerNavTab("program")
count = do.countOfAnyObjectInWidget("Program")
do.assertGreater(count, 0, "Fail because count is expected to be non-zero if programs indeed exist.")
# and being able to navigate to the expanded program row
index = do.expandItemWidget("program", private_prgm_1)
do.clickViewProgram("program", index)
# can see mapped objects
do.selectInnerNavTab("contract")
count = do.countOfAnyObjectInWidget("Contract")
do.assertGreater(count, 0, "Fail because count is expected to be non-zero if programs indeed exist.")
# can map an object to program
do.mapAObjectWidget("Product", "", True, ("Control", "Objective", "System"))
# map link and edit authorization link should not exist
do.selectInnerNavTab("person")
do.assertTrue(do.isMapLinkPresent("Person"), "Expect map link present since it's a ProgramOwner role.")
do.expandItemWidget("Person", email)
do.assertTrue(do.isEditAuthorizationPresent(), "Expect Edit Authorization link present since it's a ProgramOwner role.")
# can edit info page
do.selectInnerNavTab("info")
do.assertTrue(do.isSubmitForReviewPresent(), "Expect Submit For Review link not present since it's a ProgramOwner role.")
do.clickOnInfoPageEditLink()
do.populateObjectInEditWindow(private_prgm_1 , grcobject.program_elements, grcobject.program_values)
do.openObjectEditWindow()
do.verifyObjectValues(grcobject.program_elements, grcobject.program_values)
do.deleteObject()
示例9: testRelevantStress
def testRelevantStress(self):
self.testname="TestRelevantStress"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
titleContract = do.getUniqueString("contract")
titleClause = do.getUniqueString("clause")
print "Contract: " + titleContract
print "Clause: " + titleClause
# SETUP
do.checkMyWorkBox() # show my objects only
# Make sure we have at least 20 data assets already if not create them
count = do.countOfAnyObjectLHS("Data")
diff = 20 - count
while diff > 0:
id = do.getRandomNumber()
do.createObject("Data", "data_" + str(id))
diff = diff - 1
do.delay(5)
# Map 20 data assets to Clause
do.createObject("Clause", titleClause)
expandables = []
do.mapAObjectWidget("Data_Asset", "data_", False, expandables, 20)
# Map a clause to contract
do.createObject("Contract", titleContract)
do.mapAObjectWidget("Clause", titleClause, False, ("Clause"), 1)
# expand it
do.expandItemWidget("Clause", titleClause)
# check the MakeAllRelevant checkbox
do.makeAllRelevant(True)
do.delay(120)
# switch to Data Asset tab
do.selectInnerNavTab("data_asset")
do.assertEqual(20, do.countOfAnyObjectInWidget("data_asset"), "Count is not 20 in Data Asset Widget.")
# just select because it will maintain its expanded mode
do.selectInnerNavTab("clause")
do.makeAllRelevant(False)
do.delay(120) # takes time for the unmapping to complete
# switch to Data Asset tab again
do.selectInnerNavTab("data_asset")
# if MAKE ALL RELEVANT checkbox is deselected, no data asset tab is shown and thus no count is shown either
print "Continue to fail until CORE-890 is fixed."
do.assertEqual(0, do.countOfAnyObjectInWidget("data_asset"), "Count is not 0 in Data Asset Widget.")
示例10: testCreatePersonProgramCreatorLogInOut
def testCreatePersonProgramCreatorLogInOut(self):
self.testname="TestCreatePersonProgramCreatorLogInOut"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
aEmail = "auto_email_" + str(do.getRandomNumber(65535)) + "@gmail.com"
aName = do.getUniqueString("name")
aCompany = do.getUniqueString("company")
do.selectMenuInTopRight("Admin Dashboard")
do.selectMenuItemInnerNavDashBoard("People")
do.addPersonInAdminDB(aName, aEmail, aCompany)
self.assertTrue(do.searchPersonInAdminDB(aName), "Fail searching for newly created person in Admin Dashboard.")
# edit person authorization
do.selectMenuItemInnerNavDashBoard("People") # on the roles selection
do.clickOnEditAuthorization(aName)
do.assignUserRole("ProgramCreator")
# now log out and then log in with the new account and try to create a program
oldEmail = "[email protected]"
oldName = "Example User"
absFilePath = expanduser("~") + "/ggrc-core/src/ggrc/login/noop.py"
do.changeUsernameEmail(oldName, aName, oldEmail, aEmail, absFilePath)
do.selectMenuInTopRight("Logout")
# Refresh the page
do.refresh()
# Log in with new user
do.login()
print "Log in as : " + do.whoAmI()
object_list = ["Program", "Workflow", "Audit", "Regulation", "Policy", "Standard", "Contract", "Clause",
"Section", "Objective", "Control", "Person", "OrgGroup", "System","Process", "DataAsset",
"Product", "Project", "Facility", "Market"]
for object in object_list:
# cannot create audit; it requires other non-system wide role
if object == "Audit":
do.assertFalse(do.doesCreateNewExist(object), "Create New button exists for " + str(object))
else:
do.assertTrue(do.doesCreateNewExist(object), "Create New button does not exist for " + str(object))
# should be able to create a program object
last_created_object_link = do.createObject("Program")
object_name = str(do.util.getTextFromXpathString(last_created_object_link)).strip()
self.assertTrue(do.partialMatch("program-auto-test", object_name), "Fail to match program name.")
# Restore old login information
do.changeUsernameEmail(aName, oldName, aEmail, oldEmail, absFilePath)
do.selectMenuInTopRight("Logout")
示例11: testImportExportSystem
def testImportExportSystem(self):
self.testname="TestImportExportSystem"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
do = Helpers(self)
do.setUtils(util)
do.login()
# create a system
systemObject =do.createObject("System")
systemObject = str(util.getTextFromXpathString(systemObject)) #it's name, not xpath
print ""
print "On screen."
print "System object is displayed as : " + systemObject
# export system
filePath = config.test_db + "SYSTEMS.csv"
do.selectMenuInTopRight("Admin Dashboard")
do.exportFile("systems", filePath)
# verify that information in file matched
self.assertTrue(do.verifyDataInExportFile(systemObject, filePath), "System object not found in exported file.")
# import system
# create some data, add it to the import file and upload
number = str(do.getRandomNumber())
systemObject = "systemImport" + number
print ""
print "Add this new system object to the import file and upload."
print "System object: " + systemObject
# proof: verify that this user never exist in the database
do.navigateToObjectWithSearchWithNoAssertion(systemObject, "System")
count = do.countOfAnyObjectLHS("System")
self.assertEqual(0, count, "System " + systemObject + " is verified not existed.")
# make it complete
conformingText = "SYSTEM-" + number + "," + systemObject + ",,,,,,[email protected],,,,,,2014-7-16,2014-7-16,,Draft"
do.appendToFile(conformingText, filePath)
do.importFile("Systems", filePath)
do.refresh()
# after import, verify that user has been added to the database
do.navigateToObjectWithSearch(systemObject, "System")
count = do.countOfAnyObjectLHS("System")
self.assertEqual(1, count, "System " + systemObject + " is not added successfully.")
self.assertEqual(systemObject, do.getObjectNavWidgetInfo("username"), "System object " + systemObject + " is not found in the database.")
print ""
print "System object is imported successfully and found in the database."
print systemObject
示例12: testReindex
def testReindex(self):
self.testname="deleteObject"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
do = Helpers(self)
do.setUtils(util)
do.login()
util.driver.execute_script(REINDEX_SCRIPT)
time.sleep(90)
示例13: testLogin
def testLogin(self):
self.testname="TestLogin"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
self.assertTrue(util.isElementPresent(element.dashboard_title), "no dashboard page found")
示例14: testDeleteObject
def testDeleteObject(self):
self.testname="TestDeleteObject"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
do.clickActiveTab()
示例15: testSystemCreate
def testSystemCreate(self):
self.testname="TestSystemCreate"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
do = Helpers(self)
do.setUtils(util)
do.login()
last_created_object_link =do.createObject("System")
#object_name = str(util.getTextFromXpathString(last_created_object_link)).strip()
do.navigateToObjectAndOpenObjectEditWindow("System",last_created_object_link)
do.deleteObject()