示例#1
0
 def deleteUser(self, email):
     WebDriverWait(self.driver,10).until(cond.title_is("Manage user"))
     time.sleep(10)
     try:
         pages = self.driver.find_elements(By.XPATH, ".//ul[@class='pagination']//li[@class='paginate_button page-item ']")
     except NoSuchElementException:
         pass
     if len(pages) > 0:
         i = 2
         while i <= len(pages) + 2:
             try:
                 del_sele_link = self.driver.find_elements_by_xpath(".//table[@id='table_data']/tbody//tr[contains(.,'" + email + "')]//span[@title='Remove']")
             except NoSuchElementException:
                 pass
             if len(del_sele_link) == 0:
                 time.sleep(2)
                 page_navigate_btn = self.driver.find_element(By.XPATH, ".//ul[@class='pagination']//a[contains(.,'" + str(i) + "')]")
                 page_navigate_btn.click()
                 time.sleep(3)
                 i += 1
             else:
                 time.sleep(2)
                 action = actions.init(self.driver)
                 action.click('user', 'delete', email)
                 time.sleep(3)
                 break
     confirm_delete_ok_btn = self.driver.find_element(*RealmaxUserPageLocators.confirm_delete_ok_btn)
     confirm_delete_ok_btn.click()
     time.sleep(10)
     ok_btn = self.driver.find_element(*RealmaxUserPageLocators.ok_btn)
     ok_btn.click()
示例#2
0
 def deleteCampaign(self, campaign_name):
     time.sleep(3)
     action = actions.init(self.driver)
     action.click('campaign', 'delete', campaign_name)
     time.sleep(2)
     confirm_delete_ok_btn = self.driver.find_element(
         *RealmaxCampaignPageLocators.confirm_delete_ok_btn)
     confirm_delete_ok_btn.click()
     time.sleep(2)
     ok_btn = self.driver.find_element(*RealmaxCampaignPageLocators.ok_btn)
     ok_btn.click()
示例#3
0
 def removeContact(self, email):
     WebDriverWait(self.driver, 10).until(cond.title_is("Manage contact"))
     time.sleep(3)
     action = actions.init(self.driver)
     action.click('contact', 'delete', email)
     time.sleep(5)
     delete_confirm_btn = self.driver.find_element(
         *RealmaxContactPageLocators.confirm_delete_ok_btn)
     delete_confirm_btn.click()
     time.sleep(5)
     ok_btn = self.driver.find_element(*RealmaxContactPageLocators.ok_btn)
     ok_btn.click()
示例#4
0
    def test_5_Add_Contact_To_Campaign(self):
        login_page = loginpage.init(self.driver)
        login_page.login(gb_admin, gb_admin_pass)
        dashboard_page = dashboardpage.init(self.driver)
        dashboard_page.navigateToCampaignPage()

        WebDriverWait(self.driver, 10).until(cond.title_is("Manage campaign"))
        campaign_page = campaignpage.init(self.driver)
        campaign_page.addContactToCampaign('sele test campaign2', ['seleuser'])

        ######################
        #                    #
        #    Checkpoint      #
        #                    #
        ######################
        exitflag = 0
        # Check if tag is auto tag to contact
        dashboard_page.navigateToManageContactPage()
        WebDriverWait(self.driver, 10).until(cond.title_is("Manage contact"))
        contact_page = contactpage.init(self.driver)
        contact_page.searchContact('email',
                                   '*****@*****.**')
        action = actions.init(self.driver)
        action.click('contact', 'apply_tag',
                     '*****@*****.**')
        time.sleep(10)
        try:
            applied_tag = self.driver.find_elements(
                By.XPATH,
                ".//div[@id='list-selected-tags']//label[contains(.,'Realmax')]"
            )
        except NoSuchElementException:
            pass
        if len(applied_tag) > 0:
            print "Checkpoint1[Pass]: Realmax tag displayed"
            assert True
        else:
            print "Checkpoint1[Failed]: Realmax tag not displayed"
            exitflag = 1
        # cleanup
        contact_page.removeAllTagsInContact(
            '*****@*****.**')

        self.driver.close()

        if exitflag == 1:
            assert False
示例#5
0
 def editUser(self, email, fname, lname, new_pass):
     WebDriverWait(self.driver,10).until(cond.title_is("Manage user"))
     time.sleep(10)
     try:
         pages = self.driver.find_elements(By.XPATH, ".//ul[@class='pagination']//li[@class='paginate_button page-item ']")
     except NoSuchElementException:
         pass
     if len(pages) > 0:
         i = 2
         while i <= len(pages) + 2:
             try:
                 edit_user_link = self.driver.find_elements_by_xpath(".//table[@id='table_data']/tbody//tr[contains(.,'" + email + "')]//span[@title='Edit']")
             except NoSuchElementException:
                 pass
             if len(edit_user_link) == 0:
                 time.sleep(2)
                 page_navigate_btn = self.driver.find_element(By.XPATH, ".//ul[@class='pagination']//a[contains(.,'" + str(i) + "')]")
                 page_navigate_btn.click()
                 time.sleep(3)
                 i += 1
             else:
                 time.sleep(2)
                 action = actions.init(self.driver)
                 action.click('user', 'edit', email)
                 time.sleep(3)
                 break
     WebDriverWait(self.driver,10).until(cond.title_is("User"))
     fname_tb = self.driver.find_element(*RealmaxUserPageLocators.fname_tb)
     fname_tb.clear()
     fname_tb.send_keys(fname)
     lname_tb = self.driver.find_element(*RealmaxUserPageLocators.lname_tb)
     lname_tb.clear()
     lname_tb.send_keys(lname)
     changepass_btn = self.driver.find_element(*RealmaxUserPageLocators.changepass_btn)
     changepass_btn.click()
     newpass_tb = self.driver.find_element(*RealmaxUserPageLocators.newpass_tb)
     newpass_tb.send_keys(new_pass)
     time.sleep(3)
     confirmpass_tb = self.driver.find_element(*RealmaxUserPageLocators.confirmpass_tb)
     confirmpass_tb.send_keys(new_pass)
     save_btn = self.driver.find_element(*RealmaxUserPageLocators.save_btn)
     save_btn.click()
     time.sleep(5)
     ok_btn = self.driver.find_element(*RealmaxUserPageLocators.ok_btn)
     ok_btn.click()
示例#6
0
 def editCampaign(self, name, new_name, tags, users=None):
     action = actions.init(self.driver)
     action.click('campaign', 'edit', name)
     WebDriverWait(self.driver, 10).until(cond.title_is("Campaign"))
     name_tb = self.driver.find_element(
         *RealmaxCampaignPageLocators.name_tb)
     name_tb.clear()
     name_tb.send_keys(new_name)
     tag_tb = self.driver.find_element(*RealmaxCampaignPageLocators.tag_tb)
     # Cleaning up tags and users
     try:
         close_btns = self.driver.find_elements(
             By.XPATH, ".//span[@class='fa fa-close']")
     except NoSuchElementException:
         pass
     for close_btn in close_btns:
         close_btn.click()
         time.sleep(2)
     # Edit...
     for tag in tags:
         tag_tb.send_keys(tag)
         time.sleep(3)
         tag_auto_complete = self.driver.find_element_by_xpath(
             ".//div[@id='input-auto-complete-tagsautocomplete-list']")
         tag_auto_complete.click()
         tag_tb.clear()
     user_tb = self.driver.find_element(
         *RealmaxCampaignPageLocators.user_tb)
     if users:
         for user in users:
             user_tb.send_keys(user)
             time.sleep(3)
             user_auto_complete = self.driver.find_element_by_xpath(
                 ".//div[@id='input-auto-complete-usersautocomplete-list']")
             user_auto_complete.click()
             user_tb.clear()
     add_campaign_save_btn = self.driver.find_element(
         *RealmaxCampaignPageLocators.add_campaign_save_btn)
     add_campaign_save_btn.click()
     time.sleep(3)
     ok_btn = self.driver.find_element(*RealmaxCampaignPageLocators.ok_btn)
     ok_btn.click()
示例#7
0
 def removeAllTagsInUser(self, user_email):
     WebDriverWait(self.driver,10).until(cond.title_is("Manage user"))
     time.sleep(2)
     try:
         pages = self.driver.find_elements(By.XPATH, ".//ul[@class='pagination']//li[@class='paginate_button page-item ']")
     except NoSuchElementException:
         pass
     if len(pages) > 0:
         i = 2
         while i <= len(pages) + 2:
             try:
                 add_tag_link = self.driver.find_elements_by_xpath(".//table[@id='table_data']/tbody//tr[contains(.,'" + user_email + "')]//span[@title='Grant Tag Permission']")
             except NoSuchElementException:
                 pass
             if len(add_tag_link) == 0:
                 page_navigate_btn = self.driver.find_element(By.XPATH, ".//ul[@class='pagination']//a[contains(.,'" + str(i) + "')]")
                 page_navigate_btn.click()
                 time.sleep(5)
                 i += 1
             else:
                 action = actions.init(self.driver)
                 action.click('user', 'apply_tag', user_email)
                 time.sleep(5)
                 break
     WebDriverWait(self.driver,10).until(cond.visibility_of_any_elements_located((By.XPATH, "//div[@class='modal-dialog']//input[@id='input-auto-complete-tags']")))
     try:
         remove_tags = self.driver.find_elements(By.XPATH, ".//div[@id='list-selected-tags']//button[@class='btn btn-remove-tag-permission btn-xs pull-right']")
     except NoSuchElementException:
         pass
     while len(remove_tags) > 0:
         time.sleep(2)
         remove_tags[0].click()
         try:
             remove_tags = self.driver.find_elements(By.XPATH, ".//div[@id='list-selected-tags']//button[@class='btn btn-remove-tag-permission btn-xs pull-right']")
         except NoSuchElementException:
             pass
     save_btn = self.driver.find_element(*RealmaxTagDialogLocator.save_btn)
     save_btn.click()
     time.sleep(3)
     ok_btn = self.driver.find_element(*RealmaxTagDialogLocator.ok_btn)
     ok_btn.click()
示例#8
0
 def addContactToCampaign(self, campaign_name, contacts):
     time.sleep(3)
     action = actions.init(self.driver)
     action.click('campaign', 'contact_management', campaign_name)
     time.sleep(2)
     contact_tb = self.driver.find_element(
         *RealmaxCampaignPageLocators.tag_tb)
     for contact in contacts:
         time.sleep(2)
         contact_tb.send_keys(contact)
         time.sleep(3)
         contact_auto_complete = self.driver.find_element_by_xpath(
             ".//div[@id='input-auto-complete-tagsautocomplete-list']")
         contact_auto_complete.click()
         contact_tb.clear()
     save_btn = self.driver.find_element(
         *RealmaxCampaignPageLocators.save_btn)
     save_btn.click()
     time.sleep(3)
     ok_btn = self.driver.find_element(*RealmaxCampaignPageLocators.ok_btn)
     ok_btn.click()
示例#9
0
    def test_2_Edit_Contact(self):
        login_page = loginpage.init(self.driver)
        login_page.login(gb_admin, gb_admin_pass)

        # Edit contact
        dashboard_page = dashboardpage.init(self.driver)
        dashboard_page.navigateToManageContactPage()
        WebDriverWait(self.driver, 10).until(cond.title_is("Manage contact"))
        action = actions.init(self.driver)
        action.click('contact', 'edit', '*****@*****.**')
        time.sleep(2)
        contact_page = contactpage.init(self.driver)
        contact_page.editContact('sele2', 'contact2', '*****@*****.**')

        ######################
        #                    #
        #    Checkpoint      #
        #                    #
        ######################
        exitflag = 0
        time.sleep(5)
        try:
            sele_contact = self.driver.find_elements(
                By.XPATH,
                ".//table[@id='table_data']//tr[contains(.,'*****@*****.**')]//td[contains(.,'*****@*****.**')]"
            )
        except NoSuchElementException:
            pass
        if len(sele_contact) > 0:
            print "Checkpoint2[Pass]: Sele contact 2 displayed"
            assert True
        else:
            print "Checkpoint2[Failed]: Sele contact 2 not displayed"
            exitflag = 1

        self.driver.close()

        if exitflag == 1:
            assert False
示例#10
0
 def appplyTagToUser(self, email, tag):
     WebDriverWait(self.driver,10).until(cond.title_is("Manage user"))
     time.sleep(2)
     try:
         pages = self.driver.find_elements(By.XPATH, ".//ul[@class='pagination']//li[@class='paginate_button page-item ']")
     except NoSuchElementException:
         pass
     if len(pages) > 0:
         i = 2
         while i <= len(pages) + 2:
             try:
                 add_tag_link = self.driver.find_elements_by_xpath(".//table[@id='table_data']/tbody//tr[contains(.,'" + email + "')]//span[@title='Grant Tag Permission']")
             except NoSuchElementException:
                 pass
             if len(add_tag_link) == 0:
                 page_navigate_btn = self.driver.find_element(By.XPATH, ".//ul[@class='pagination']//a[contains(.,'" + str(i) + "')]")
                 page_navigate_btn.click()
                 time.sleep(5)
                 i += 1
             else:
                 time.sleep(2)
                 action = actions.init(self.driver)
                 action.click('user', 'apply_tag', email)
                 time.sleep(5)
                 break
     WebDriverWait(self.driver,10).until(cond.visibility_of_any_elements_located((By.XPATH, "//div[@class='modal-dialog']//input[@id='input-auto-complete-tags']")))
     tag_input = self.driver.find_element(*RealmaxTagDialogLocator.tag_input)
     tag_input.send_keys(tag)
     time.sleep(5)
     tag = self.driver.find_element_by_xpath(".//div[@class='modal-content']//div[@class='modal-body']//div[@id='input-auto-complete-tagsautocomplete-list']//div[contains(.,'" + tag + "')]")
     tag.click()
     time.sleep(2)
     save_btn = self.driver.find_element(*RealmaxTagDialogLocator.save_btn)
     save_btn.click()
     time.sleep(2)
     ok_btn = self.driver.find_element(*RealmaxTagDialogLocator.ok_btn)
     ok_btn.click()
示例#11
0
 def applyTagToContact(self, email, tag):
     WebDriverWait(self.driver, 10).until(cond.title_is("Manage contact"))
     time.sleep(3)
     action = actions.init(self.driver)
     action.click('contact', 'apply_tag', email)
     time.sleep(5)
     WebDriverWait(self.driver, 10).until(
         cond.visibility_of_any_elements_located((
             By.XPATH,
             "//div[@class='modal-dialog']//input[@id='input-auto-complete-tags']"
         )))
     tag_input = self.driver.find_element(
         *RealmaxTagDialogLocator.tag_input)
     tag_input.send_keys(tag)
     time.sleep(5)
     tag = self.driver.find_element_by_xpath(
         ".//div[@class='modal-content']//div[@class='modal-body']//div[@id='input-auto-complete-tagsautocomplete-list']//div[contains(.,'"
         + tag + "')]")
     tag.click()
     save_btn = self.driver.find_element(*RealmaxTagDialogLocator.save_btn)
     save_btn.click()
     time.sleep(5)
     ok_btn = self.driver.find_element(*RealmaxContactPageLocators.ok_btn)
     ok_btn.click()
示例#12
0
    def test_Apply_Tag_To_Contact_And_User(self):
        # Login to realmax
        login_page = loginpage.init(self.driver)
        login_page.login(gb_admin, gb_admin_pass)

        WebDriverWait(self.driver, 10).until(cond.title_is("Dashboard"))
        dashboard_page = dashboardpage.init(self.driver)
        dashboard_page.navigatetouserpage()

        WebDriverWait(self.driver, 10).until(cond.title_is("Manage user"))
        time.sleep(2)
        user_page = userpage.init(self.driver)
        user_page.appplyTagToUser('*****@*****.**',
                                  'Realmax')

        # Add new contact apply tag
        time.sleep(2)
        dashboard_page.navigateToManageContactPage()
        time.sleep(2)
        contact_page = contactpage.init(self.driver)
        contact_page.searchContact('email',
                                   '*****@*****.**')
        contact_page.applyTagToContact('*****@*****.**',
                                       'Realmax')

        ######################
        #                    #
        #    Checkpoint      #
        #                    #
        ######################
        exitflag = 0
        self.driver.get(realmax_url + "/logout")
        login_page.login(gb_user, gb_user_pass)
        dashboard_page.navigateToTagPage()
        time.sleep(3)
        try:
            realmax_tag = self.driver.find_elements(
                By.XPATH,
                ".//table[@id='table_data']//tr[contains(.,'Realmax')]")
        except NoSuchElementException:
            pass
        if len(realmax_tag) > 0:
            print "Checkpoint1[Pass]: Realmax tag displayed"
            assert True
        else:
            print "Checkpoint1[Failed]: Realmax tag not displayed"
            exitflag = 1

        action = actions.init(self.driver)
        action.click('tag', 'apply_contact', 'Realmax')
        time.sleep(5)
        try:
            sele_contact = self.driver.find_elements(
                By.XPATH,
                ".//div[@id='list-selected-tags']//label[contains(.,'Seleuser User')]"
            )
        except NoSuchElementException:
            pass
        if len(sele_contact) > 0:
            print "Checkpoint2[Pass]: Seleuser contact displayed"
            assert True
        else:
            print "Checkpoint2[Failed]: Seleuser contact not displayed"
            exitflag = 1
        time.sleep(5)
        save_btn = self.driver.find_element(*RealmaxTagPageLocators.save_btn)
        save_btn.click()
        time.sleep(2)
        ok_btn = self.driver.find_element(*RealmaxTagPageLocators.ok_btn)
        ok_btn.click()

        ######################
        #                    #
        ###### Clean up ######
        #                    #
        ######################

        tag_page = tagpage.init(self.driver)
        tag_page.removeContagInTag('Realmax', 'Seleuser User')
        self.driver.get(realmax_url + "/logout")

        login_page.login(gb_admin, gb_admin_pass)
        dashboard_page.navigatetouserpage()
        WebDriverWait(self.driver, 10).until(cond.title_is("Manage user"))
        time.sleep(2)
        user_page = userpage.init(self.driver)
        user_page.removeAllTagsInUser('*****@*****.**')

        if exitflag == 1:
            assert False