当前位置: 首页>>代码示例>>Python>>正文


Python Helpers.countOfAnyObjectLHS方法代码示例

本文整理汇总了Python中helpers.Helpers.Helpers.countOfAnyObjectLHS方法的典型用法代码示例。如果您正苦于以下问题:Python Helpers.countOfAnyObjectLHS方法的具体用法?Python Helpers.countOfAnyObjectLHS怎么用?Python Helpers.countOfAnyObjectLHS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在helpers.Helpers.Helpers的用法示例。


在下文中一共展示了Helpers.countOfAnyObjectLHS方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testSaveAndAddAnotherProject

# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import countOfAnyObjectLHS [as 别名]
 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()        
开发者ID:amrishs,项目名称:ggrc-test,代码行数:35,代码来源:TestSaveAndAddAnotherProject.py

示例2: testNoAccessRole

# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import countOfAnyObjectLHS [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."
开发者ID:amrishs,项目名称:ggrc-test,代码行数:37,代码来源:TestNoAccessRole.py

示例3: testImportExportSystem

# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import countOfAnyObjectLHS [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
开发者ID:amrishs,项目名称:ggrc-test,代码行数:58,代码来源:TestImportExportSystem.py

示例4: testRelevantStress

# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import countOfAnyObjectLHS [as 别名]
    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.")
开发者ID:amrishs,项目名称:ggrc-test,代码行数:61,代码来源:TestRelevantStress.py

示例5: testDeleteObjects

# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import countOfAnyObjectLHS [as 别名]
    def testDeleteObjects(self):
        self.testname="TestDeleteObjects"
        self.setup()
        util = WebdriverUtilities()
        util.setDriver(self.driver)
        element = Elements()
        grcobject = GRCObject()
        do = Helpers(self)
        do.setUtils(util)
        do.login()
        for section in ["Regulation",
                        "Objective",
                        "Program",                        
                        "Contract",
                        "Policy",
                        "Control",
                        "System",
                        "Process",
                        "Data",
                        "Product",
                        "Project",
                        "Facility",
                        "Market",
                        "Group"
                           ]:
            print "Starting Deletion of Objects for " + section
            deleted_objects=0
            do.ensureLHNSectionExpanded(section)
            do.checkMyWorkBox()
            
            object_left_nav_section_object_link = element.left_nav_expand_object_section_link.replace("OBJECT", section)
            
            # enter term to search
            util.inputTextIntoField("Auto", element.left_nav_search_input_textfield)
            util.pressEnterKey(element.left_nav_search_input_textfield)
            
            left_nav_first_link = element.left_nav_first_object_link_in_the_section.replace("SECTION",section)
            util.waitForElementToBePresent(left_nav_first_link)
            lef_nav_objects_for_deletion_in_section = element.left_nav_objects_candidate_for_deletion.replace("SECTION",section )
            number_of_auto_objects = do.countOfAnyObjectLHS(section)
                
            deleted_objects = number_of_auto_objects - 2     # leave 2 behind                        

            while (deleted_objects > 0):
                            
                do.navigateToObjectAndOpenObjectEditWindow(section,lef_nav_objects_for_deletion_in_section, refresh_page=False)
                do.deleteObject()
                deleted_objects = deleted_objects - 1 #LHN collapse after this
                
                do.showLHMenu(True) # reopen it
            
                object_left_nav_section_object_link = element.left_nav_expand_object_section_link.replace("OBJECT", section)
                left_nav_first_link = element.left_nav_first_object_link_in_the_section.replace("SECTION",section)
                util.waitForElementToBePresent(left_nav_first_link)
                lef_nav_objects_for_deletion_in_section = element.left_nav_objects_candidate_for_deletion.replace("SECTION",section )
                
            print "Finished deletion of objects for " + section + ". " + str(deleted_objects) + " object is left to be deleted."
开发者ID:amrishs,项目名称:ggrc-test,代码行数:59,代码来源:TestDeleteObjects.py

示例6: testArtyCreate

# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import countOfAnyObjectLHS [as 别名]
    def testArtyCreate(self):

        self.testname="TestArtyCreate"
        self.setup()
        util = WebdriverUtilities()
        util.setDriver(self.driver)
        element = Elements()
        do = Helpers(self)
        do.setUtils(util)
        do.login()
        
        program_object = GRCObject 
        program_object.program_elements['title']="Program for Load Test" + do.getTimeId()
        program_object.program_elements['description']="This program is created by ARTY as part of the Load Performance Test"
               
        standard_object = GRCObject 
        standard_object.standard_elements['title']="Standard" + do.getTimeId() # Standard for Load Test
        standard_object.standard_elements['description']="This standard is created by ARTY as part of the Load Performance Test"       
         
        section_object = GRCObject 
        section_object.section_elements['title']="Section" + do.getTimeId() # Section for Load Test
        section_object.section_elements['description']="This section is created by ARTY as part of the Load Performance Test"  
        
        objective_object = GRCObject 
        objective_object.objective_elements['title']="Objective" + do.getTimeId() # Objective for Load Test
        objective_object.objective_elements['description']="This objective is created by ARTY as part of the Load Performance Test"  
        
        control_object = GRCObject 
        control_object.control_elements['title']="Control" + do.getTimeId() # Control for Load Test
        control_object.control_elements['description']="This control is created by ARTY as part of the Load Performance Test"  
        
        if do.countOfAnyObjectLHS("Standard") > 0:
            firstItemStandard = do.getFirstItemFromASection("Standard")
        
        # uncomment later
        do.createObjectIncrementingNaming(program_object, "Program", 1)     
        do.createObjectIncrementingNaming(standard_object, "Standard",1)  #case sensitive parameter & singularity

        # select "Standard1" created in the above is used in filling Section form
        do.createObjectIncrementingNaming(section_object, "Section", 25, firstItemStandard)  #case sensitive parameter & singularity
        do.createObjectIncrementingNaming(objective_object, "Objective", 125)
        do.createObjectIncrementingNaming(objective_object, "Control", 625)
开发者ID:amrishs,项目名称:ggrc-test,代码行数:44,代码来源:TestArtyCreate.py

示例7: testCreateObjectsAsSetup

# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import countOfAnyObjectLHS [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")     
开发者ID:amrishs,项目名称:ggrc-test,代码行数:43,代码来源:TestCreateObjectsAsSetup.py

示例8: testImportExportPeople

# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import countOfAnyObjectLHS [as 别名]
    def testImportExportPeople(self):
        self.testname="TestImportExportPeople"
        self.setup()
        util = WebdriverUtilities()
        util.setDriver(self.driver)
        do = Helpers(self)
        do.setUtils(util)
        do.login()

        # create a person
        number = str(do.getRandomNumber())
        aEmail = "email" + number + "@gmail.com"
        aName =  "name" + number   
        aCompany = "company" + number              
        do.createPersonLHN(aName, aEmail, aCompany)

        do.uncheckMyWorkBox()
        do.navigateToObjectWithSearch(aName, "Person")
        
        print ""
        print "On screen."
        print "User is displayed as : " + aName
        print "Email is displayed as : " + aEmail
        print "Company is displayed as : " + aCompany
        
# export people
        filePath = config.test_db + "PEOPLE.csv"
        print filePath
        do.selectMenuInTopRight("Admin Dashboard")
        do.exportFile("people", filePath)
               
        # verify that information in file matched
        self.assertTrue(do.verifyPeopleExportFile(aName, aEmail, aCompany, filePath), "User not found in exported file.")
   
# import people
        # create some data, add it to the import file and upload       
        number = str(do.getRandomNumber())
        aEmail = "emailImport" + number + "@gmail.com"
        aName =  "nameImport" + number   
        aCompany = "companyImport" + number  
        
        print ""
        print "Add this new user info to the import file and upload."
        print "User name: " + aName
        print "Email: " + aEmail
        print "Company: " + aCompany
        userInfo = aName + "," + aEmail + "," + aCompany
        
        # proof: verify that this user never exist in the database
        do.navigateToObjectWithSearchWithNoAssertion(aName, "Person")
        count = do.countOfAnyObjectLHS("Person")
        self.assertEqual(0, count, "User " + aName + " is verified not existed.")
                
        do.appendToFile(userInfo, filePath)
        do.importFile("People", filePath)
        do.refresh()   
        
        # after import, verify that user has been added to the database
        do.navigateToObjectWithSearch(aName, "Person")
        count = do.countOfAnyObjectLHS("Person")
        self.assertEqual(1, count, "User " + aName + " is verified not existed.")
        self.assertEqual(aName, do.getObjectNavWidgetInfo("username"), "User's name " + aName + " is not found in the database.")
        self.assertEqual(aEmail, do.getObjectNavWidgetInfo("email"), "User's email " + aEmail + " is not found in the database.")
        self.assertEqual(aCompany, do.getObjectNavWidgetInfo("company"), "User's company " + aCompany + " is not found in the database.")
        
        print ""
        print "User is imported successfully and found in the database."
        print aName + "," + aEmail + "," + aCompany
开发者ID:amrishs,项目名称:ggrc-test,代码行数:70,代码来源:TestImportExportPeople.py

示例9: testMyWorkPageGeneral

# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import countOfAnyObjectLHS [as 别名]
    def testMyWorkPageGeneral(self):
        self.testname="TestMyWorkPageGeneral"
        self.setup()
        util = WebdriverUtilities()
        util.setDriver(self.driver)
        element = Elements()
        do = Helpers(self)
        do.setUtils(util)
        do.login()

        item_input = ['Program', 'Workflow', 'Audit', 'Regulation', 'Policy', 'Standard', 'Contract', 'Clause', 'Section', \
                     'Objective', 'Control', 'Person', 
                     'OrgGroup', 'Vendor', 'System', 'Process', 'DataAsset', 'Product', \
                     'Project', 'Facility', 'Market']


        # open menu
        do.showLHMenu(True)

        # All and my object radio buttons exist?
        do.assertTrue(do.isMyObjectsOnlyPresent(), "My objects only radio button does not exist")
        do.assertTrue(do.isMyObjectsOnlyChecked(), "My objects only is not checked by default")
        
        # get counts for each type of object
        my_list = []
        for object in item_input:
            count_my = do.countOfAnyObjectLHS(object)
            my_list.append(count_my)

        
        do.assertTrue(do.isAllObjectsPresent(), "All objects radio button does not exist")        
        do.assertFalse(do.isAllObjectsChecked(), "All objects is checked by default which is wrong")
        do.uncheckMyWorkBox() # select all radio
          
        # program, workflows, audits with count in the parenthesis should update and should be different than in the above
        # get counts for each type of object
        all_list = []
        for object in item_input:
            count_all = do.countOfAnyObjectLHS(object)
            all_list.append(count_all)
        
        # counts are not updating; it's likely that there is a difference

        count_updated = False
        total_items = len(item_input)
        for object_count in my_list:
            my_count = my_list.pop()
            all_count = all_list.pop()
            total_items = total_items - 1
            
            if not my_count == all_count:
                count_updated = True
                break # good, it updates
            else:
                if total_items == 0:
                    do.assertTrue(count_updated, "Count of objects do not update.  Error.")
                    
            
        
        # verify that objects created by different users show up; repeat for all different object type
        # PRE-REQUISITES:  There are at least 2 objects created by 2 different users for each object type
        print ("WARNING !!!")
        print ("PRE-REQUISITES:  There are at least 2 objects created by 2 different users for each object type")
        for object in item_input:
            do.verifyAllUsersObjectsShown(object)
        
         
        # verify to each items in the LHS exist and labels are correct
        expected   = ['Programs', 'Workflows', 'Audits', 'Regulations', 'Policies', 'Standards', 'Contracts', 'Clauses', 'Sections', \
                     'Objectives', 'Controls', 'People', 
                     'Org Groups', 'Vendors', 'Systems', 'Processes', 'Data Assets', 'Products', \
                     'Projects', 'Facilities', 'Markets']
         
        dictionary = dict(zip(item_input, expected))
        for object in item_input:
            raw = do.getItemLabelInLHS(object)
             
            if object == 'OrgGroup' or \
               object == 'DataAsset':
                Nth = 2
            else:
                Nth = 1
             
            filtered = do.getTextUpToNthSpace(raw, Nth)
            expected_text = dictionary.get(object)
            do.assertTrue(do.compareText(filtered, expected_text), "Mismatch text for object: " + filtered)
        
        # add help content and verify
        do.addHelpTitleContent("Help Me", "I will help you.")
        do.clickHelpTopRightCorner()
        do.assertEqual(do.getHelpTitle(), "Help Me", "Fail to get Help title.")
        #do.assertEqual(do.getHelpContent(), "I will help you.", "Fail to get Help content.")
        do.clickHelpDone()
        
        # click help icon, then click outside of modal
        do.clickHelpIcon()
        do.clickMyTasksIcon()
开发者ID:amrishs,项目名称:ggrc-test,代码行数:99,代码来源:TestMyWorkPageGeneral.py


注:本文中的helpers.Helpers.Helpers.countOfAnyObjectLHS方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。