本文整理汇总了Python中helpers.Helpers.Helpers.selectMenuInTopRight方法的典型用法代码示例。如果您正苦于以下问题:Python Helpers.selectMenuInTopRight方法的具体用法?Python Helpers.selectMenuInTopRight怎么用?Python Helpers.selectMenuInTopRight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helpers.Helpers.Helpers
的用法示例。
在下文中一共展示了Helpers.selectMenuInTopRight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testNoAccessRole
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import selectMenuInTopRight [as 别名]
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."
示例2: testCreatePrivateProgramOwner
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import selectMenuInTopRight [as 别名]
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()
示例3: testImportExportSystem
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import selectMenuInTopRight [as 别名]
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
示例4: testEventLog
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import selectMenuInTopRight [as 别名]
def testEventLog(self):
self.testname="TestEventLog"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
grcobject = GRCObject()
do = Helpers(self)
do.setUtils(util)
do.login()
# CREATE PROGRAM
program_name = "Program_created_from_LHN" + do.getTimeId()
object_list = ["Regulation", "Contract", "Policy", "Standard"]
last_created_object_link = do.createObject("Program", program_name)
# MAP SOME OBJECTS
for obj in object_list:
do.mapAObjectLHN(obj, program_name)
#do.selectInnerTabWhichAlreadyPresent("info")
do.selectInnerNavTab("info")
do.openObjectEditWindow()
do.deleteObject()
do.selectMenuInTopRight("Admin Dashboard")
do.selectMenuItemInnerNavDashBoard("Events")
# when delete an object that has mapping, it automatically unmap and then delete
self.assertTrue(do.verifyInfoInEventLogTable("unmapped from", 1), "Cannot find 'unmapped from Program' in the Event Log table.")
# 4 times
# 4 lines of "mapped to" because there are 4 mappings from the top
self.assertTrue(do.verifyInfoInEventLogTable("mapped to", 2), "Cannot find 'map to:row2' in the Event Log table.")
self.assertTrue(do.verifyInfoInEventLogTable("mapped to", 3), "Cannot find 'map to:row3' in the Event Log table.")
self.assertTrue(do.verifyInfoInEventLogTable("mapped to", 4), "Cannot find 'map to:row4' in the Event Log table.")
self.assertTrue(do.verifyInfoInEventLogTable("mapped to", 5), "Cannot find 'map to:row5' in the Event Log table.")
# tests the "by whom" and "when at" fields
self.assertTrue(do.verifyInfoInEventLogTable("whom", 2), "Cannot find 'whom' in the Event Log table.")
self.assertTrue(do.verifyInfoInEventLogTable("when", 2), "Cannot find 'when' in the Event Log table.")
# the program created should be logged
self.assertTrue(do.verifyInfoInEventLogTable(program_name, 6), "Cannot find 'create program' in the Event Log table.")
# verify that Prev and Next buttons work
self.assertTrue(do.verifyPrevNextOperation(), "Fail verifying Prev and Next buttons.")
# CORE-727
print "CORE-727 is still open which causes this failure."
示例5: testCreatePrivateProgramReader
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import selectMenuInTopRight [as 别名]
def testCreatePrivateProgramReader(self):
self.testname="TestCreatePrivateProgramReader"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
email = config.reader1
password = config.same_password
private_prgm_1 = do.createPrivateProgramPermission(email, "", "ProgramReader")
print private_prgm_1
# map any object so that we can check if read can see it or not
do.mapAObjectLHN("Contract")
# now log out and then log in with the ProgramReader user
do.selectMenuInTopRight("Logout")
do.refresh()
# Log in with new user
do.login(email, password)
print "Log in as : " + do.whoAmI()
do.assertEquals("Reader", do.getRoleLabelInTopRight(), "Label does not says 'Reader'.")
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.")
# map link and edit authorization link should not exist
do.selectInnerNavTab("person")
do.assertFalse(do.isMapLinkPresent("person"), "Expect map link not present since it's a ProgramReader role.")
do.assertFalse(do.isEditAuthorizationPresent(), "Expect Edit Authorization link not present since it's a ProgramReader role.")
# go to program info page
do.selectInnerNavTab("program")
do.assertFalse(do.isInfoPageEditLinkPresent(), "Expect Edit link not present since it's a ProgramReader role.")
do.assertFalse(do.isSubmitForReviewPresent(), "Expect Submit For Review link not present since it's a ProgramReader role.")
示例6: testAllRolesPresent
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import selectMenuInTopRight [as 别名]
def testAllRolesPresent(self):
self.testname="TestAllRolesPresent"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
grcobject = GRCObject()
do = Helpers(self)
do.setUtils(util)
do.login()
do.selectMenuInTopRight("Admin Dashboard")
do.selectMenuItemInnerNavDashBoard("Roles")
do.verifyDifferentRolesExist()
示例7: testImportExportHelp
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import selectMenuInTopRight [as 别名]
def testImportExportHelp(self):
self.testname="TestImportExportHelp"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
do = Helpers(self)
do.setUtils(util)
do.login()
# export help
filePath = config.test_db + "HELP.csv"
do.selectMenuInTopRight("Admin Dashboard")
do.exportFile("help", filePath)
# import help
do.importFile("Processes", filePath)
示例8: testAdminDBGeneral
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import selectMenuInTopRight [as 别名]
def testAdminDBGeneral(self):
# [email protected] exists in the database
the_email = '[email protected]'
roles = 9 # nine types of roles
self.testname="TestAdminDBGeneral"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
do.selectMenuInTopRight("Admin Dashboard")
# verify people table
do.selectMenuItemInnerNavDashBoard("People")
self.assertTrue(do.searchPersonInAdminDB(the_email), "Cannot find it in the People table.")
people_count = do._countOfObjectsFromAdminDB("people")
self.assertEquals(1, people_count, "Expect count equals to 1, but it's " + str(people_count))
# verify Roles table
do.selectMenuItemInnerNavDashBoard("Roles")
roles_count = do._countOfObjectsFromAdminDB("roles")
self.assertEquals(roles, roles_count, "Expect count equals to" + str(roles) + ", but it's " + str(roles_count))
# verify events table
# There are more than 22 thousands entries so can't count every entries. Work-around is to verify that it
# increments by 1 when you create an object for example
do.selectMenuItemInnerNavDashBoard("Events")
events_count_before = do._countOfObjectsFromAdminDB("events")
#events_count_from_label = do._countOfObjectsFromAdminDBLabel("events")
#self.assertEquals(events_count_before, events_count_from_label, "Events count is not in sync.")
xpath = do.createObject("Contract")
title = util.getTextFromXpathString(xpath)
do.selectMenuInTopRight("Admin Dashboard")
do.selectMenuItemInnerNavDashBoard("Events")
do.delay(20) #events table takes time to load
events_count_after = do._countOfObjectsFromAdminDB("events")
#self.assertEquals(events_count_before, events_count_from_label, "Events count is not in sync.")
self.assertLess(events_count_before, events_count_after, "Count before=" + str(events_count_before) + "; Count after=" + str(events_count_after))
示例9: testCreateObjectsAsSetup
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import selectMenuInTopRight [as 别名]
def testCreateObjectsAsSetup(self):
self.testname="TestCreateObjectsAsSetup"
self.setup()
object_list = ["Contract","Control","DataAsset","Facility","Market","Objective","OrgGroup","Policy","Process","Product","Program",
"Project","Regulation","System","Standard","Clause"]
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
print "First: Log in as : " + do.whoAmI()
for obj in object_list:
count = 0; #initalize to 0
currentCount = do.countOfAnyObjectLHS(obj)
if currentCount < 2:
count = 2 - currentCount;
while count > 0:
do.createObject(obj)
count = count - 1
# 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 and create objects
# This support other tests scripts checking for objects created by different users, and also object counts update
do.login(config.creator2, config.same_password)
print "Second: Log in as : " + do.whoAmI()
for obj in object_list:
do.createObject(obj)
# just create one more to test that contract count differ between "all objects" and "my objects"
do.createObject("Contract")
示例10: testCreatePersonProgramCreatorLogInOut
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import selectMenuInTopRight [as 别名]
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: testCreatePeople
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import selectMenuInTopRight [as 别名]
def testCreatePeople(self):
self.testname="TestCreatePeople"
self.setup()
if 'localhost' in config.url:
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
entity = "[email protected]"
do.selectMenuInTopRight("Admin Dashboard")
do.selectMenuItemInnerNavDashBoard("People")
for x in range(3):
if x==1:
entity = "[email protected]"
elif x==2:
entity = "[email protected]"
try:
self.assertTrue(do.addPersonInAdminDB(entity, entity, entity), "Fail to add person or person already exists")
do.refresh()
self.assertTrue(do.searchPersonInAdminDB(entity), "Fail searching for newly created person in Admin Dashboard.")
# edit person authorization
do.selectMenuItemInnerNavDashBoard("People") # on the roles selection
do.clickOnEditAuthorization(entity)
do.assignUserRole("gGRC Admin")
except:
do.clickCancelButtonOnAddPersonModal()
continue # if it already exist then fine
示例12: testCreatePersonNoAccessLogInOut
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import selectMenuInTopRight [as 别名]
def testCreatePersonNoAccessLogInOut(self):
self.testname="TestCreatePersonNoAccessLogInOut"
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("No access")
# 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", "Task", "Audit", "Regulation", "Policy", "Standard", "Contract", "Clause",
"Section", "Objective", "Control", "Person", "OrgGroup", "System","Process", "DataAsset",
"Product", "Project", "Facility", "Market"]
# no Create New occurs
for object in object_list:
do.navigateLHSMenu4NoAccess(object)
do.assertFalse(do.doesThisElementExist(str(Elements.left_nav_object_section_add_button).replace("OBJECT", object), 8))
# Restore old login information
do.changeUsernameEmail(aName, oldName, aEmail, oldEmail, absFilePath)
do.selectMenuInTopRight("Logout")
示例13: testImportPeopleValidation
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import selectMenuInTopRight [as 别名]
def testImportPeopleValidation(self):
self.testname="TestImportPeopleValidation"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
do = Helpers(self)
do.setUtils(util)
do.login()
do.selectMenuInTopRight("Admin Dashboard")
self.assertFalse(do.importFile("People", self.dupEmail, False, "Error"), "Fail negative test on duplicate email.")
do.selectMenuInTopRight("Admin Dashboard")
self.assertFalse(do.importFile("People", self.noEmail, False, "Error"), "Fail negative test with email field.")
do.selectMenuInTopRight("Admin Dashboard")
self.assertFalse(do.importFile("People", self.wrongType, False, "Error"), "Fail negative test where type is not people.")
# THIS ONE FAILS BECAUSE THERE IS A AN ACTUAL BUG !!! 16463790 "Uncaught SecurityError"
print ("THIS ONE FAILS BECAUSE THERE IS A AN ACTUAL BUG !!! 16463790 'Uncaught SecurityError.' ")
print ("Need to uncomment when it's fixed.")
示例14: testImportProcessesValidation
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import selectMenuInTopRight [as 别名]
def testImportProcessesValidation(self):
noRow = config.test_db + "PROCESSES_NO_ROW.csv"
wrongType = config.test_db + "PROCESSES_WRONG_TYPE.csv"
noTitle = config.test_db + "PROCESSES_NO_TITLE.csv"
dupTitle = config.test_db + "PROCESSES_DUP_TITLE.csv"
self.testname="TestImportProcessesValidation"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
do = Helpers(self)
do.setUtils(util)
do.login()
do.selectMenuInTopRight("Admin Dashboard")
self.assertFalse(do.importFile("Processes", noRow, False, "Warning: Missing column"), "Fail negative test on file with now data.")
do.selectMenuInTopRight("Admin Dashboard")
self.assertFalse(do.importFile("Processes", wrongType, False, "Warning: Type must be"), "Fail negative test on file with wrong data type.")
self.assertEquals(do.getWrongTypeMessage(),"Type must be \"Processes\"", "Fail to display 'wrong type' message.")
do.selectMenuInTopRight("Admin Dashboard")
self.assertTrue(do.importFile("Processes", noTitle, True), "Fail negative test on file with no title.")
self.assertEquals(do.getImportFailedMessage(), "Error!", "Fail to display 'Error' message. ")
示例15: testCreatePersonObjectEditorLogInOut
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import selectMenuInTopRight [as 别名]
def testCreatePersonObjectEditorLogInOut(self):
self.testname="TestCreatePersonObjectEditorLogInOut"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
# ***************************** run this block of codes if run locally *****************************
if "localhost" in config.url:
print "Executing the block of codes locally ..."
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("ObjectEditor")
# now log out and then log in with the new account and try to create a program
oldEmail = "Example user"
oldName = "[email protected]"
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 = ["Workflow", "Vendor", "Regulation", "Policy", "Standard", "Contract", "Clause", "Section",
"Section", "Objective", "Control", "Person", "OrgGroup", "System","Process", "DataAsset",
"Product", "Project", "Facility", "Market", "Program", "Audit"]
# since it's an object editor role, the Create New button won't show for certain types
for object in object_list:
if object=="Program" or 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 an object that is not Program or Audit
last_created_object_link = do.createObject("Contract")
object_name = str(do.util.getTextFromXpathString(last_created_object_link)).strip()
self.assertTrue(do.partialMatch("contract-auto-test", object_name), "Fail to match contract name.")
# Restore old login information
do.changeUsernameEmail(aName, oldName, aEmail, oldEmail, absFilePath)
do.selectMenuInTopRight("Logout")
# ******************* execute this else block of codes if not run locally *******************
else:
print "Executing the block of codes for non-local ..."
aEmail = config.editor2
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("ObjectEditor")
# 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(aEmail, config.password)
print "Log in as : " + do.whoAmI()
object_list = ["Workflow", "Vendor", "Regulation", "Policy", "Standard", "Contract", "Clause", "Section",
"Section", "Objective", "Control", "Person", "OrgGroup", "System","Process", "DataAsset",
"Product", "Project", "Facility", "Market", "Program", "Audit"]
# since it's an object editor role, the Create New button won't show for certain types
for object in object_list:
do.ensureLHNSectionExpanded(object)
if object=="Program" or object=="Audit":
#.........这里部分代码省略.........