def testShouldCheckLibDelete(self):

        sel = self.driver
        homepage_obj = home_page.HomePage(sel)
        loginpage_obj = login_page.LoginPage(sel)
        dashboardpage_obj = dashboard_page.DashboardPage(sel)
        addonpage_obj = addon_editor_page.AddonEditorPage(sel)
        libpage_obj = lib_editor_page.LibraryEditorPage(sel)

        user_info = fd_login_data.FDLoginData().getLoginInfo()
        username = user_info['username']
        password = user_info['password']

        homepage_obj.go_to_home_page()

        homepage_obj.click_create_lib_btn()
        loginpage_obj.login(username, password)
        #Get the name of the library on the editor page.
        lib_name = libpage_obj.get_lib_name()

        #Go the the dashboard and delete the library that you just created. Then check that the library at the top of the list is not the same as the one you just deleted.
        homepage_obj.click_myaccount()
        top_lib_name = dashboardpage_obj.get_top_lib_name()
        dashboardpage_obj.click_lib_delete()
        dashboardpage_obj.confirm_delete()
        top_lib_name_after_delete = dashboardpage_obj.get_top_lib_name()
        self.assertNotEquals(top_lib_name, top_lib_name_after_delete)

        #Go to homepage and create a new library and check that its name is the same as the one that was just deleted.
        homepage_obj.go_to_home_page()
        homepage_obj.click_create_lib_btn()
        new_lib_name = libpage_obj.get_lib_name()
        self.assertEquals(new_lib_name, lib_name)
 def testLibraryPagination(self):
     #This test is to assert that if the count of the libraries on dashboard is more than 10, then the libraries should be paginated on public libraries page.
     #Create page objects
     sel = self.driver
     homepage_obj = home_page.HomePage(sel)
     loginpage_obj = login_page.LoginPage(sel)
     dashboardpage_obj = dashboard_page.DashboardPage(sel)
     public_page_obj = dashboard_public_page.DashboardPublicPage(sel)
     
     user_info = fd_login_data.FDLoginData().getLoginInfo()
     username = user_info['username']
     password = user_info['password']
 
     homepage_obj.go_to_home_page()
     homepage_obj.click_signin()
     loginpage_obj.login(username, password)
     self.assertEqual("Dashboard - Add-on Builder", dashboardpage_obj.get_page_title())
     
     #Get the total count of the number of add-ons that are displayed on the dashboard.
     #homepage_obj.click_myaccount()
     lib_count = dashboardpage_obj.calc_total_libs()
     
     if lib_count>10:
     #If there are more than 10 addons on the dashboard, go to the public addons page and check that the next button is present for pagination
         dashboardpage_obj.go_to_public_libs_page()
         self.assertTrue(public_page_obj.check_next_button_present())
     else:
         print 'Total Libraries are less then 10, so there will be no pagination'
    def test_forum_pagination_on_prod(self, testsetup):
        """Post a new thread and reply to the thread
        Check pagination after 20 posts.
        This test is suppossed to be run only on Production site.
        It Posts in the auto-test forums which is only viewable by certain users
        Note: This test will not run locally by itself. It will only run in BFT suite.
        """
        thread_num = str(random.randint(100, 10000))
        thread_title = 'test_thread_' + thread_num
        thread_text = 'some text'

        login_page_obj = login_page.LoginPage(testsetup)
        forums_page_obj = forums_page.ForumsPage(testsetup)

        login_page_obj.log_in_as_admin()

        # Post a new thread
        # this forum is only only viewable by certain users,
        # so posting to it on Prod is allowed.

        forums_page_obj.open(
            'https://support.mozilla.com/en-US/forums/auto-test')
        forums_page_obj.post_new_thread_first_cat(thread_title, thread_text)

        assert (forums_page_obj.is_text_present(thread_text))

        forums_page_obj.log_out()
Example #4
0
    def testShouldCheckDisableButtonPresentAfterSignin(self):
        #This test case should be run only after create addon and create library test case
        sel = self.driver
        homepage_obj = home_page.HomePage(sel)
        loginpage_obj = login_page.LoginPage(sel)
        dashboardpage_obj = dashboard_page.DashboardPage(sel)

        user_info = fd_login_data.FDLoginData().getLoginInfo()
        username = user_info['username']
        password = user_info['password']

        homepage_obj.go_to_home_page()

        #Check that the disable button are not present for addon and library.
        self.assertFalse(homepage_obj.check_addon_disable_btn_present())
        self.assertFalse(homepage_obj.check_lib_disable_btn_present())

        homepage_obj.click_signin()
        loginpage_obj.login(username, password)
        self.assertEqual("Dashboard - Add-on Builder",
                         dashboardpage_obj.get_page_title())
        homepage_obj.go_to_home_page()

        #Check that the disable button should be present now for addon and library
        self.assertTrue(homepage_obj.check_addon_disable_btn_present())
        self.assertTrue(homepage_obj.check_lib_disable_btn_present())
Example #5
0
    def testShouldCheckLibraryLabel(self):
        #This test is to check the labels of a library on the dashboard
        #Create page objects
        sel = self.driver
        homepage_obj = home_page.HomePage(sel)
        loginpage_obj = login_page.LoginPage(sel)
        dashboardpage_obj = dashboard_page.DashboardPage(sel)
        libpage_obj = lib_editor_page.LibraryEditorPage(sel)

        user_info = fd_login_data.FDLoginData().getLoginInfo()
        username = user_info['username']
        password = user_info['password']

        #Create a library. Then go to dashoard and assert that the label is 'initial'.
        homepage_obj.go_to_home_page()
        homepage_obj.click_create_lib_btn()
        loginpage_obj.login(username, password)
        lib_name = libpage_obj.get_lib_name()
        homepage_obj.click_myaccount()
        self.assertEqual("Dashboard - Add-on Builder",
                         dashboardpage_obj.get_page_title())
        label_name = dashboardpage_obj.get_lib_label_name()
        self.assertEqual("initial", label_name.text)

        #Click on the edit button of the library.Then create a copy of that library and assert that the label is 'copy'
        dashboardpage_obj.navigate_to_lib_editor()
        libpage_obj.click_copy_btn()
        copy_lib_name = libpage_obj.get_lib_name()
        try:
            self.assertNotEqual(lib_name, copy_lib_name)
        except:
            print 'A copy of the addon could not be created'
        homepage_obj.click_myaccount()
        label_name = dashboardpage_obj.get_lib_label_name()
        self.assertEqual("copy", label_name.text)
Example #6
0
    def testAddonCount(self):
        #This test is to assert that the count of the addons on dashboard is equal to the number of addons present on the page.
        #Create page objects
        sel = self.driver
        homepage_obj = home_page.HomePage(sel)
        loginpage_obj = login_page.LoginPage(sel)
        dashboardpage_obj = dashboard_page.DashboardPage(sel)

        user_info = fd_login_data.FDLoginData().getLoginInfo()
        username = user_info['username']
        password = user_info['password']

        homepage_obj.go_to_home_page()
        homepage_obj.click_signin()
        loginpage_obj.login(username, password)
        self.assertEqual("Dashboard - Add-on Builder",
                         dashboardpage_obj.get_page_title())

        #Get the total count of the number of add-ons that are displayed on the dashboard.
        #homepage_obj.click_myaccount()
        addon_count = dashboardpage_obj.calc_total_addons()

        #Get the number of addons that are displayed on the left hand side of the page.(Something like your add-ons(20))
        counter = dashboardpage_obj.get_addons_count()
        counter = string.lstrip(counter, '(')
        counter = string.rstrip(counter, ')')

        #Assert that the total addons on the page matches the counter on the left hand side.
        self.assertEquals(str(addon_count), str(counter))
    def test_that_article_can_be_previewed_before_submitting(self):
        knowledge_base_pg = knowledge_base_page.KBPage(self.selenium)
        login_pg = login_page.LoginPage(self.selenium)

        login_pg.log_in_as_non_admin()

        random_num = random.randint(1000, 9999)
        article_name = "test_article_%s" % random_num

        article_info_dict = {
            'title': article_name,
            'category': 'How to',
            'keyword': 'test',
            'summary': "this is an automated summary_%s" % random_num,
            'content': "automated content__%s" % random_num
        }

        # create a new article
        knowledge_base_pg.go_to_create_new_article_page()
        knowledge_base_pg.set_article(article_info_dict)
        knowledge_base_pg.click_article_preview_button()
        actual_preview_text = knowledge_base_pg.get_article_preview_text()

        assert actual_preview_text == article_info_dict['content'],\
                                      "Expected: %s Actual: %s" % (article_info_dict['content'], actual_preview_text)
Example #8
0
    def testShouldCreateAddOn(self):
        #This test is to check that we should be able to create an addon.
        #Create page objects
        sel = self.driver
        homepage_obj = home_page.HomePage(sel)
        loginpage_obj = login_page.LoginPage(sel)
        dashboardpage_obj = dashboard_page.DashboardPage(sel)
        addonpage_obj = addon_editor_page.AddonEditorPage(sel)

        user_info = fd_login_data.FDLoginData().getLoginInfo()
        username = user_info['username']
        password = user_info['password']

        #Click on sign-in link on homepage, enter the username and password, and assert that you are on the dashboard page
        homepage_obj.go_to_home_page()
        homepage_obj.click_signin()
        loginpage_obj.login(username, password)
        self.assertEqual("Dashboard - Add-on Builder",
                         dashboardpage_obj.get_page_title())

        #Get the account name displayed on the dashboard
        account_name = dashboardpage_obj.get_account_name()
        homepage_obj.go_to_home_page()

        #Click on create addon button on homepage and compare the addon name should be same as account name
        homepage_obj.click_create_addon_btn()
        addon_name = addonpage_obj.get_addon_name()
        self.failUnless(re.match(account_name, addon_name))
Example #9
0
    def test_forum_new_post(self):
        """Post a new thread in the KB articles forums"""
        sel = self.selenium
        login_page_obj = login_page.LoginPage(sel)
        forums_page_obj = forums_page.ForumsPage(sel)

        user_info = sumo_test_data.SUMOtestData().getUserInfo(0)
        uname = user_info['username']
        pwd = user_info['password']
        timestamp = sel.get_eval("new Date().getTime()")
        thread_title = "Litmus 7829 test" + timestamp
        thread_text = "Litmus QA 7829 Testcase Test Msg"
        ''' Login '''
        login_page_obj.log_in(uname, pwd)
        ''' Post a new thread '''
        forums_page_obj.open(forums_page_obj.kb_articles_forum_url)
        forums_page_obj.post_new_thread_first_cat(thread_title, thread_text)

        time.sleep(5)
        self.failUnless(sel.is_text_present(thread_text))
        # Verify post title
        forums_page_obj.open(forums_page_obj.kb_articles_forum_url)
        self.failUnless(sel.is_text_present(thread_title))
        ''' Logout '''
        forums_page_obj.log_out()
Example #10
0
    def testShouldCheckButtonsForAddonsInEditAndViewMode(self):
        #This test is to check that we should be able to see specific buttons in the edit mode of an addon.
        #Create page objects
        sel = self.driver
        homepage_obj = home_page.HomePage(sel)
        loginpage_obj = login_page.LoginPage(sel)
        addonpage_obj = addon_editor_page.AddonEditorPage(sel)

        user_info = fd_login_data.FDLoginData().getLoginInfo()
        username = user_info['username']
        password = user_info['password']

        homepage_obj.go_to_home_page()
        homepage_obj.click_create_addon_btn()
        loginpage_obj.login(username, password)

        #When signed in , check that the Test, Download, Save, Copy, Error Console, Revision, Properties button are present on the editor page
        self.assertTrue(addonpage_obj.check_test_btn_present())
        self.assertTrue(addonpage_obj.check_download_btn_present())
        self.assertTrue(addonpage_obj.check_save_btn_present())
        self.assertTrue(addonpage_obj.check_copy_btn_present())
        self.assertTrue(addonpage_obj.check_error_console_btn_present())
        self.assertTrue(addonpage_obj.check_revision_btn_present())
        self.assertTrue(addonpage_obj.check_properties_btn_present())

        homepage_obj.click_signout()
        homepage_obj.click_addon_view_btn()

        #After signout, the save and the error console button shoult not be present.
        self.assertTrue(addonpage_obj.check_test_btn_present())
        self.assertTrue(addonpage_obj.check_download_btn_present())
        self.assertTrue(addonpage_obj.check_copy_btn_present())
        self.assertTrue(addonpage_obj.check_revision_btn_present())
        self.assertTrue(addonpage_obj.check_properties_btn_present())
    def test_that_article_can_be_created(self):
        """
           Creates a new knowledge base article.
           Verifies creation.
           Deletes the article
        """
        knowledge_base_pg = knowledge_base_page.KBPage(self.selenium)
        login_pg = login_page.LoginPage(self.selenium)

        #login with an Admin account as he can delete the article
        login_pg.log_in_as_admin()

        random_num = random.randint(1000, 9999)
        article_name = "test_article_%s" % random_num

        article_info_dict = {
            'title': article_name,
            'category': 'How to',
            'keyword': 'test',
            'summary': "this is an automated summary_%s" % random_num,
            'content': "automated content__%s" % random_num
        }

        # create a new article
        knowledge_base_pg.go_to_create_new_article_page()
        knowledge_base_pg.set_article(article_info_dict)
        knowledge_base_pg.submit_article()
        knowledge_base_pg.set_article_comment_box()

        # verify article history
        article_history_url = knowledge_base_pg.get_url_current_page()
        knowledge_base_pg.article_history_url = article_history_url
        actual_page_title = knowledge_base_pg.get_page_title()
        if not (knowledge_base_pg.page_title_revision_history
                in actual_page_title):
            raise Exception("Expected string: %s not found in title: %s"\
                             % (knowledge_base_pg.page_title_revision_history, actual_page_title))

        # verify article contents
        knowledge_base_pg.article_url = (
            knowledge_base_pg.article_history_url).replace("/history", "")
        knowledge_base_pg.go_to_article_page()
        knowledge_base_pg.click_edit_article()

        edit_page_title = knowledge_base_pg.get_page_title()
        assert knowledge_base_pg.article_title in edit_page_title,\
               "%s not found in Page title %s" % (knowledge_base_pg.article_title, edit_page_title)
        actual_summary_text = knowledge_base_pg.get_article_summary_text()
        actual_contents_text = knowledge_base_pg.get_article_contents_box()
        assert article_info_dict['summary'] == actual_summary_text,\
               "Expected: %s Actual: %s"\
                % (article_info_dict['summary'], actual_summary_text)
        assert article_info_dict['content'] == actual_contents_text,\
               "Expected: %s Actual: %s"\
                % (article_info_dict['content'], actual_contents_text)

        # delete the same article
        knowledge_base_pg.delete_entire_article_document()
Example #12
0
 def test_02_login(self):
     """登录 演示失败"""
     username = "******"
     password = "******"
     sp = login_page.LoginPage(self.driver)
     name = sp.input_username_password(self.url, username, password)
     try:
         self.assertIn(name, '2', '失败')
         print('成功,登录后用户名=', name)
     except Exception as e:
         print('出错了!', str(e))
         self.imgs.append(self.driver.get_screenshot_as_base64())
         raise
    def test_forum_deletion(self):
        '''Checks bug 569310 (accidental forum deletion)'''
        sel = self.selenium
        login_page_obj   = login_page.LoginPage(sel)
        forums_page_obj  = forums_page.ForumsPage(sel)
        
        user_adm = 1
        thread_num = str(random.randint(100, 10000))
        user_info       = sumo_test_data.SUMOtestData().getUserInfo(user_adm)
        uname           = user_info['username']
        pwd             = user_info['password']
        
        ''' Login '''
        login_page_obj.log_in(uname, pwd)       
        
        ''' Post a new thread '''

        thread_title = 'test_thread_' + thread_num
        thread_text = 'some text'
        ''' Post a new thread '''
        forums_page_obj.go_to_forums_cat_list_page()
        forums_page_obj.click(forums_page_obj.first_cat_forum_link,True)
        forums_page_obj.post_new_thread_first_cat(thread_title,thread_text)
               
        thread_loc = str(sel.get_location())
        thread_loc_arr = thread_loc.split('/')
        url1 = thread_loc_arr[len(thread_loc_arr) - 2]
        url2 = thread_loc_arr[len(thread_loc_arr) - 1]    
        thread_loc = vars.ConnectionParameters.baseurl_ssl+'/en-US/forums/%s/%s' % (url1, url2)

        num_of_posts = 5

        for counter in range(1, (num_of_posts + 1)):
            thread_reply = 'some reply %s' % str(int(thread_num) + counter)
            forums_page_obj.post_reply(thread_loc, thread_reply)
            
        location = sel.get_location()
        p = re.compile('post-[0-9]*')
        postString = p.search(location)
        postNum = postString.group()[5:]
        # delete link of second to last post
        post_to_delete_link = "css=li#post-%s > div > div > a:nth-child(2)" % str(int(postNum) - 1)
        forums_page_obj.wait_for_element_present(post_to_delete_link)
        sel.click(post_to_delete_link)
        sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout)
        #confirmation dialogue for deletion
        sel.click("css=form > input[type='submit']")
        sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout)
        sel.open(thread_loc)
        self.failUnless(sel.is_text_present(thread_title))
    def test_no_query_adv_forum_search(self, testsetup):
        login_pg = login_page.LoginPage(testsetup)
        refine_search_pg = refine_search_page.RefineSearchPage(testsetup)

        login_pg.log_in_as_non_admin()
        refine_search_pg.go_to_refine_search_page()
        refine_search_pg.click(refine_search_pg.support_questions_tab)
        refine_search_pg.type(refine_search_pg.asked_by_box,
                              login_pg.get_user_name_non_admin())
        refine_search_pg.click_button(refine_search_pg.search_button_support,
                                      True, testsetup.timeout)
        assert "refine" in testsetup.selenium.get_attribute(\
                           "css=div#basic-search > form > input:nth-child(13)@class"),\
                           "refine class not found"
Example #15
0
def startup():
    window = Tk()
    window.geometry("800x600")
    window.rowconfigure(0, weight=1)
    window.columnconfigure(0, weight=1)
    window.rowconfigure(2, weight=1)
    window.columnconfigure(2, weight=1)
    window.wm_title("ProLog")

    content = Frame(window)
    content.grid(row=1, column=1)

    login_page.LoginPage(window, content)
    window.mainloop()
Example #16
0
    def test_forum_b_goto_post_after_reply(self):
        """Check if forum redirects to post after replying."""
        sel = self.selenium
        login_page_obj = login_page.LoginPage(sel)
        forums_page_obj = forums_page.ForumsPage(sel)
        thread_reply = 'some reply ' + str(int(self.thread_num))

        user_info = sumo_test_data.SUMOtestData().getUserInfo(0)
        uname = user_info['username']
        pwd = user_info['password']
        ''' login '''
        login_page_obj.log_in(uname, pwd)
        forums_page_obj.post_reply(thread_loc, thread_reply)
        post_url = forums_page_obj.get_url_current_page()
        self.failUnless(('#post-' in post_url),
                        "Not redirecting to post (not in url)")
Example #17
0
    def add_user(self, window, content, create_user_content, username, age,
                 height, weight, password, password2):

        username_warning = Text(create_user_content,
                                fg="red",
                                width=35,
                                height=1,
                                pady=2,
                                wrap=WORD)
        input_warning = Text(create_user_content,
                             fg="red",
                             width=35,
                             height=1,
                             pady=2,
                             wrap=WORD)
        input_warning.insert(INSERT, "Please check your input for errors")

        all_users = database.view_users()

        for user in all_users:
            if username == user[1]:
                username_warning.insert(INSERT, "Username is taken")
                username_warning.grid(row=0, column=1, columnspan=3)
                return

        pwcorrect = False
        if password == password2:
            pwcorrect = True

        try:
            age = int(age)
            height = int(height)
            weight = int(weight)
            input_warning.grid_forget()
        except Exception as e:
            input_warning.grid(row=0, column=1, columnspan=3)
            print(e)

        if isinstance(username, str) and len(
                username
        ) > 3 and age > 12 and height > 100 and weight > 30 and pwcorrect:
            database.create_user(username, age, height, weight, password)
            create_user_content.grid_forget()
            login_page.LoginPage(window, content)
        else:
            input_warning.grid(row=0, column=1, columnspan=3)
Example #18
0
    def test_automation(self):

        login = login_page.LoginPage(self.driver)
        login.do_login()

        home = home_page.HomePage(self.driver)
        #self.assertEqual(home.verify_home_page(), 'True')
        home.click_camera_icon()

        gallery = gallery_page.GalleryPage(self.driver)
        gallery.click_and_save_image()

        home = home_page.HomePage(self.driver)
        home.click_options_menu()

        options = options_page.OptionsPage(self.driver)
        options.swipe_to_bottom()
        options.log_out()
Example #19
0
    def test_login(self):
        """tests login & logout
        """
        sel = self.selenium
        login_page_obj = login_page.LoginPage(sel)
        support_page_obj = support_home_page.SupportHomePage(sel)

        user_info = sumo_test_data.SUMOtestData().getUserInfo(0)
        uname = user_info['username']
        pwd = user_info['password']
        ''' Login '''

        login_page_obj.log_in(uname, pwd)

        login_page_obj.go_to_login_page()
        ''' Logout '''
        login_page_obj.log_out()
        support_page_obj.is_the_current_page
Example #20
0
    def test_forum_deletion(self, testsetup):
        '''Checks bug 569310 (accidental forum deletion)'''
        login_page_obj = login_page.LoginPage(testsetup)
        forums_page_obj = forums_page.ForumsPage(testsetup)

        thread_num = str(random.randint(100, 10000))

        login_page_obj.log_in_as_admin()

        # Post a new thread
        thread_title = 'test_thread_%s' % thread_num
        thread_text = 'some text'

        forums_page_obj.go_to_forums_cat_list_page()
        forums_page_obj.click(forums_page_obj.first_cat_forum_link, True)
        forums_page_obj.post_new_thread_first_cat(thread_title, thread_text)

        thread_loc = str(forums_page_obj.get_url_current_page())
        thread_loc_arr = thread_loc.split('/')
        url1 = thread_loc_arr[len(thread_loc_arr) - 2]
        url2 = thread_loc_arr[len(thread_loc_arr) - 1]
        thread_loc = '%s/en-US/forums/%s/%s' % (testsetup.base_url_ssl, url1,
                                                url2)

        num_of_posts = 5

        for counter in range(1, (num_of_posts + 1)):
            thread_reply = 'some reply %s' % str(int(thread_num) + counter)
            forums_page_obj.post_reply(thread_loc, thread_reply)

        location = forums_page_obj.get_url_current_page()
        p = re.compile('post-[0-9]*')
        postString = p.search(location)
        postNum = postString.group()[5:]
        # delete link of second to last post
        post_to_delete_link = "css=li#post-%s > div > div > a:nth-child(2)" % str(
            int(postNum) - 1)
        forums_page_obj.wait_for_element_present(post_to_delete_link)
        forums_page_obj.click(post_to_delete_link, True)
        #confirmation dialogue for deletion
        forums_page_obj.click("css=form > input[type='submit']", True)
        forums_page_obj.open(thread_loc)
        assert forums_page_obj.is_text_present(thread_title)
    def testShouldCreateLibrary(self):
        #This test is to check that we should be able to create a library.
        #Create page objects
        sel = self.driver
        homepage_obj = home_page.HomePage(sel)
        loginpage_obj = login_page.LoginPage(sel)
        libpage_obj = lib_editor_page.LibraryEditorPage(sel)

        user_info = fd_login_data.FDLoginData().getLoginInfo()
        username = user_info['username']
        password = user_info['password']

        #Click on creatae library button on homepage, login and check that the library name for the current library starts with "My Library"
        homepage_obj.go_to_home_page()
        homepage_obj.click_create_lib_btn()
        loginpage_obj.login(username, password)
        lib_name = libpage_obj.get_lib_name()
        #self.assertEquals(addon_name.text, "regexp:"+account_name.text+".*")
        self.failUnless(re.match("My Library", lib_name))
Example #22
0
    def testShouldCheckLibButtonsPresent(self):
        sel = self.driver
        homepage_obj = home_page.HomePage(sel)
        loginpage_obj = login_page.LoginPage(sel)
        dashboardpage_obj = dashboard_page.DashboardPage(sel)
        username = "******"
        password = "******"

        homepage_obj.go_to_home_page()
        homepage_obj.click_signin()
        loginpage_obj.login(username, password)
        self.assertEqual("Dashboard - Add-on Builder",
                         dashboardpage_obj.get_page_title())

        #On the dashboard, check that the library has ""Edit", Delete", "Public" and "Private" button present
        self.assertTrue(dashboardpage_obj.check_lib_edit_btn_present())
        self.assertTrue(dashboardpage_obj.check_lib_delete_btn_present())
        self.assertTrue(dashboardpage_obj.check_lib_public_btn_present())
        self.assertTrue(dashboardpage_obj.check_lib_private_btn_present())
    def test_that_article_can_be_deleted(self):
        """
           Creates a new knowledge base article.
           Deletes the article.
           Verifies the deletion.
        """
        knowledge_base_pg = knowledge_base_page.KBPage(self.selenium)
        login_pg = login_page.LoginPage(self.selenium)

        #login with an Admin account as he can delete the article
        login_pg.log_in_as_admin()

        random_num = random.randint(1000, 9999)
        article_name = "test_article_%s" % random_num

        article_info_dict = {
            'title': article_name,
            'category': 'How to',
            'keyword': 'test',
            'summary': "this is an automated summary_%s" % random_num,
            'content': "automated content__%s" % random_num
        }

        # create a new article
        knowledge_base_pg.go_to_create_new_article_page()
        knowledge_base_pg.set_article(article_info_dict)
        knowledge_base_pg.submit_article()
        knowledge_base_pg.set_article_comment_box()

        # set article history url
        knowledge_base_pg.article_history_url = knowledge_base_pg.get_url_current_page(
        )
        knowledge_base_pg.article_url = (
            knowledge_base_pg.article_history_url).replace("/history", "")

        # delete the same article
        knowledge_base_pg.delete_entire_article_document()
        knowledge_base_pg.go_to_article_page()
        actual_page_title = knowledge_base_pg.get_page_title()
        if re.search('Page Not Found', actual_page_title, re.I) is None:
            raise AssertionError('Page title is %s, was expecting %s' %
                                 (actual_page_title, 'Page Not Found'))
Example #24
0
    def test_automation(self):

        login = login_page.LoginPage(self.driver)
        login.do_login()

        home = home_page.HomePage(self.driver)
        self.assertEqual(home.verify_home_page(), 'True')
        home.click_avatar_button()

        gallery = gallery_page.GalleryPage(self.driver)
        gallery.click_and_save_image()

        home = home_page.HomePage(self.driver)
        home.click_profile_icon()

        profile = profile_page.ProfilePage(self.driver)
        profile.click_more_options()

        log_out = options_page.OptionsPage(self.driver)
        log_out.do_logout()
Example #25
0
    def test_forum_new_post(self, testsetup):
        """Post a new thread in the KB articles forums"""
        login_page_obj = login_page.LoginPage(testsetup)
        forums_page_obj = forums_page.ForumsPage(testsetup)

        timestamp = str(datetime.datetime.now())
        thread_title = "Litmus 7829 test" + timestamp
        thread_text = "Litmus QA 7829 Testcase Test Msg"

        login_page_obj.log_in_as_non_admin()

        forums_page_obj.open(forums_page_obj.kb_articles_forum_url)
        forums_page_obj.post_new_thread_first_cat(thread_title, thread_text)

        assert forums_page_obj.is_text_present(thread_text)

        # Verify post title
        forums_page_obj.open(forums_page_obj.kb_articles_forum_url)
        assert forums_page_obj.is_text_present(thread_title)

        forums_page_obj.log_out()
    def test_forum_pagination_on_prod(self):
        """Post a new thread and reply to the thread
        Check pagination after 20 posts.
        This test is suppossed to be run only on Production site.
        It Posts in the auto-test forums which is only viewable by certain users
        Note: This test will not run locally by itself. It will only run in BFT suite.
        """
        thread_num = str(random.randint(100, 10000))
        thread_title = 'test_thread_' + thread_num
        thread_text = 'some text'
        self.selenium.stop()
        self.selenium = selenium(vars.ConnectionParameters.server,
                                 vars.ConnectionParameters.port,
                                 vars.ConnectionParameters.browser,
                                 'https://support.mozilla.com')
        self.selenium.start()
        self.timeout = vars.ConnectionParameters.page_load_timeout
        self.selenium.set_timeout(self.timeout)
        sel = self.selenium

        login_page_obj = login_page.LoginPage(sel)
        forums_page_obj = forums_page.ForumsPage(sel)

        user_info = sumo_test_data.SUMOtestData().getUserInfo(1)
        uname = user_info['username']
        pwd = user_info['password']

        login_page_obj.log_in(uname, pwd)

        # Post a new thread
        # this forum is only only viewable by certain users,
        # so posting to it on Prod is allowed.

        forums_page_obj.open(
            'https://support.mozilla.com/en-US/forums/auto-test')
        forums_page_obj.post_new_thread_first_cat(thread_title, thread_text)

        self.failUnless(sel.is_text_present(thread_text))
        ''' Logout '''
        forums_page_obj.log_out()
Example #27
0
    def testShouldCheckAddonButtonsPresent(self):
        sel = self.driver
        homepage_obj = home_page.HomePage(sel)
        loginpage_obj = login_page.LoginPage(sel)
        dashboardpage_obj = dashboard_page.DashboardPage(sel)

        user_info = fd_login_data.FDLoginData().getLoginInfo()
        username = user_info['username']
        password = user_info['password']

        homepage_obj.go_to_home_page()
        homepage_obj.click_signin()
        loginpage_obj.login(username, password)
        self.assertEqual("Dashboard - Add-on Builder",
                         dashboardpage_obj.get_page_title())

        #On the dashboard, check that the addon has "Test", "Edit", Delete", "Public" and "Private" button present
        self.assertTrue(dashboardpage_obj.check_addon_test_btn_present())
        self.assertTrue(dashboardpage_obj.check_addon_edit_btn_present())
        self.assertTrue(dashboardpage_obj.check_addon_delete_btn_present())
        self.assertTrue(dashboardpage_obj.check_addon_public_btn_present())
        self.assertTrue(dashboardpage_obj.check_addon_private_btn_present())
    def testShouldCheckLibDeactivateAndActivate(self):
        sel = self.driver
        homepage_obj = home_page.HomePage(sel)
        loginpage_obj = login_page.LoginPage(sel)
        dashboardpage_obj = dashboard_page.DashboardPage(sel)
        privatepage_obj = dashboard_private_page.DashboardPrivatePage(sel)

        user_info = fd_login_data.FDLoginData().getLoginInfo()
        username = user_info['username']
        password = user_info['password']

        homepage_obj.go_to_home_page()
        homepage_obj.click_signin()
        loginpage_obj.login(username, password)
        self.assertEqual("Dashboard - Add-on Builder",
                         dashboardpage_obj.get_page_title())

        #Get the name of the library present at the top of the library list on dashboard.
        #This will be used to compare whether the library is removed from the top of list after making it private
        lib_name = dashboardpage_obj.get_top_lib_name()

        #Click on the private button to make it private and then check that the library is not in the list anymore
        dashboardpage_obj.click_lib_mkprivate_btn()
        new_top_lib_name = dashboardpage_obj.get_top_lib_name()
        self.assertNotEqual(lib_name, new_top_lib_name)
        dashboardpage_obj.go_to_private_libs_page()

        #Go to the private libraries page and check that the library that you just made private is present there.
        #Click on public to make it public and check on the dashboard that the library is present there.
        priv_lib_name = privatepage_obj.get_top_lib_name()
        #text_priv_addon = priv_addon_name.text
        #print text_priv_addon
        self.assertEquals(lib_name, priv_lib_name)
        privatepage_obj.click_lib_mkpublic_btn()
        new_priv_top_lib_name = privatepage_obj.get_top_lib_name()
        self.assertNotEqual(priv_lib_name, new_priv_top_lib_name)
        privatepage_obj.go_to_dashboard()
        top_lib = dashboardpage_obj.get_top_lib_name()
        self.assertEquals(priv_lib_name, top_lib)
    def test_that_posting_question_works(self, testsetup):
        """Posts a question to /questions"""
        login_po = login_page.LoginPage(testsetup)
        ask_new_questions_pg = ask_new_questions_page.AskNewQuestionsPage(
            testsetup)
        timestamp = datetime.datetime.today()
        q_to_ask = "automation test question %s" % (timestamp)
        q_details = "This is a test. %s" % (timestamp)

        login_po.log_in_as_non_admin()

        # go to the /questions/new page and post a question
        ask_new_questions_pg.go_to_ask_new_questions_page()
        ask_new_questions_pg.click_firefox_product_link()
        ask_new_questions_pg.click_category_problem_link()
        ask_new_questions_pg.type_question(q_to_ask)
        ask_new_questions_pg.click_provide_details_button()
        ask_new_questions_pg.fill_up_questions_form(q_details)

        assert ask_new_questions_pg.is_text_present(q_to_ask),\
               "Did not find text: %s on the page" % (q_to_ask)
        assert ask_new_questions_pg.is_text_present(q_details),\
               "Did not find text: %s on the page" % (q_details)
    def test_that_posting_question_works(self):
        """Posts a question to /questions"""
        login_po = login_page.LoginPage(self.selenium)
        questions_po = questions_page.QuestionsPage(self.selenium)
        timestamp = self.selenium.get_eval("new Date().getTime()")
        q_to_ask = "automation test question %s" % (datetime.date.today())
        q_details = "This is a test. " + timestamp

        user_info = sumo_test_data.SUMOtestData().getUserInfo(0)
        uname = user_info['username']
        pwd = user_info['password']
        ''' login '''
        login_po.log_in(uname, pwd)
        """ go to the /questions/new page and post a question
        """
        questions_po.go_to_ask_new_questions_page()
        questions_po.click_firefox_product_link()
        questions_po.click_category_problem_link()
        questions_po.type_question(q_to_ask)
        questions_po.click_provide_details_button()
        questions_po.fill_up_questions_form(q_details)

        self.failUnless(self.selenium.is_text_present(q_to_ask))
        self.failUnless(self.selenium.is_text_present(q_details))