Exemplo n.º 1
0
def main(TimeMachine):
    
    homepage_tests = unittest.TestLoader().loadTestsFromTestCase(HomepageTestCase)
    latest_tests = unittest.TestLoader().loadTestsFromTestCase(LatestTestCase)
    article_tests = unittest.TestLoader().loadTestsFromTestCase(ArticleTestCase)
    optimized_template_tests = unittest.TestLoader().loadTestsFromTestCase(OptimizedTemplateTestCase)
    widget_tests = unittest.TestLoader().loadTestsFromTestCase(WidgetTestCase)
    #offer_logic_tests = unittest.TestLoader().loadTestsFromTestCase(OfferLogicTestCase)
    zip_recruiter_tests = unittest.TestLoader().loadTestsFromTestCase(ZipRecruiterTestCase)
    countdown_tests = unittest.TestLoader().loadTestsFromTestCase(CountdownTestCase)
    
    device_name = mobile_util.get_device_name()
    
    # # Put them in the list
    test_list = [homepage_tests, latest_tests, article_tests, optimized_template_tests, widget_tests, zip_recruiter_tests, countdown_tests] # add product_table for image comparation
    
    #test_list = [subscribe_tests]
    if TimeMachine == True:
        test_list.append(time_machine)
        print time_machine
    smoke_tests = unittest.TestSuite(test_list)
    
    env = env_util.get_env().upper()
    
    # # File
    sys.stdout.flush()
    dir = os.getcwd()
    #outfile = open(dir + "\RegressionTestReport.html", "w")
    outfile = open(dir + os.sep +device_name+"MobileSmokesReport.html", "w")
    runner = HTMLTestRunner.HTMLTestRunner(stream=outfile, title='BND Smokes Report - '+env, description=' Smokes Tests', \
                                            verbosity=2)
    sys.stdout.flush()
    runner.run(smoke_tests)
Exemplo n.º 2
0
 def testReferenceCashFlow(self):
     url = WEB_SITE + '4635-cash-flow-management.html'
     print(url)
     self.driver.get(url)
     try:
         verifyWidgetWidget(self, 1)
     except AssertionError as err:
         env = env_util.get_env()
         if ("prod" in env):
             raise err
 def testByLine(self):
     env = env_util.get_env()
     author = self.driver.find_element_by_css_selector('.author')
     self.assertTrue(author.is_displayed(), 'Author is not displayed')
     author_text = author.text
     if 'prod' in env:
         self.assertEquals(
             author_text, PROD_AUTHOR,
             "actual [{0}] doesn't match expected [{1}]".format(
                 author_text, PROD_AUTHOR))
     else:
         self.assertEquals(
             author_text, AUTHOR,
             "actual [{0}] doesn't match expected [{1}]".format(
                 author_text, AUTHOR))
     date = self.driver.find_element_by_css_selector('.byline>time')
     self.assertTrue(date.is_displayed(), "'Publish date is not displayed")
     date_text = date.text.strip()
     if 'prod' in env:
         self.assertEquals(
             date_text, PROD_PUBLISH_DATE,
             "actual [{0}] doesn't match expected [{1}]".format(
                 date_text, PROD_PUBLISH_DATE))
     else:
         self.assertEquals(
             date_text, PUBLISH_DATE,
             "actual [{0}] doesn't match expected [{1}]".format(
                 date_text, PUBLISH_DATE))
     fb = self.driver.find_element_by_css_selector(
         '.st_facebook_custom.fa.fa-facebook')
     self.assertTrue(fb.is_displayed(),
                     'Facebook social share icon is displayed')
     twitter = self.driver.find_element_by_css_selector(
         '.st_twitter_custom.fa.fa-twitter')
     self.assertTrue(twitter.is_displayed(),
                     'Twitter social share icon is displayed')
     linkedin = self.driver.find_element_by_css_selector(
         '.st_linkedin_custom.fa.fa-linkedin')
     self.assertTrue(linkedin.is_displayed(),
                     'Linkedin social share icon is displayed')
     reddit = self.driver.find_element_by_css_selector(
         '.st_reddit_custom.fa.fa-reddit')
     self.assertTrue(reddit.is_displayed(),
                     'Reddit social share icon is displayed')
     stumbleupon = self.driver.find_element_by_css_selector(
         '.st_stumbleupon_custom.fa.fa-stumbleupon')
     self.assertTrue(stumbleupon.is_displayed(),
                     'stumbleupon social share icon is displayed')
     more = self.driver.find_element_by_css_selector(
         '.st_sharethis_custom.stMore')
     self.assertTrue(more.is_displayed(),
                     'more social share option is displayed')
Exemplo n.º 4
0
def main(TimeMachine):

    time_machine = unittest.TestLoader().loadTestsFromTestCase(TimeMachineTest)
    homepage_tests = unittest.TestLoader().loadTestsFromTestCase(
        HomepageTestCase)
    latest_tests = unittest.TestLoader().loadTestsFromTestCase(LatestTestCase)
    article_tests = unittest.TestLoader().loadTestsFromTestCase(
        ArticleTestCase)
    f04_tests = unittest.TestLoader().loadTestsFromTestCase(F04TestCase)
    credits_tests = unittest.TestLoader().loadTestsFromTestCase(
        CreditsTestCase)
    #product_table = unittest.TestLoader().loadTestsFromTestCase(ProductTableTest)
    big_tests = unittest.TestLoader().loadTestsFromTestCase(BIGTestCase)
    quiz_test = unittest.TestLoader().loadTestsFromTestCase(QuizCase)
    header_search_tests = unittest.TestLoader().loadTestsFromTestCase(
        HeaderSearchTestCase)
    optimized_template_tests = unittest.TestLoader().loadTestsFromTestCase(
        OptimizedTemplateTestCase)
    sub_header_tests = unittest.TestLoader().loadTestsFromTestCase(
        SubheaderTestCase)
    search_tests = unittest.TestLoader().loadTestsFromTestCase(SearchTestCase)
    widget_tests = unittest.TestLoader().loadTestsFromTestCase(WidgetTestCase)
    offer_logic_tests = unittest.TestLoader().loadTestsFromTestCase(
        OfferLogicTestCase)
    countdown_tests = unittest.TestLoader().loadTestsFromTestCase(
        CountdownTestCase)
    about_us_tests = unittest.TestLoader().loadTestsFromTestCase(
        AboutUsTestCase)

    # # Put them in the list
    test_list = [homepage_tests, latest_tests, article_tests, \
                                      f04_tests, credits_tests, big_tests, quiz_test, header_search_tests, optimized_template_tests,
                                      sub_header_tests, search_tests, widget_tests, offer_logic_tests, countdown_tests, about_us_tests] # add product_table for image comparation

    #test_list = [subscribe_tests]
    if TimeMachine == True:
        test_list.append(time_machine)
        print time_machine
    smoke_tests = unittest.TestSuite(test_list)

    env = env_util.get_env().upper()
    browser = env_util.get_browser()

    # # File
    sys.stdout.flush()
    dir = os.getcwd()
    #outfile = open(dir + "\RegressionTestReport.html", "w")
    outfile = open(dir + os.sep + browser + "RegressionTestReport.html", "w")
    runner = HTMLTestRunner.HTMLTestRunner(stream=outfile, title='BND Regression Report - '+env+' - '+browser, description=' Regression Tests', \
                                            verbosity=2)
    sys.stdout.flush()
    runner.run(smoke_tests)
    def testByLine(self):
        env = env_util.get_env()
        author_date = self.driver.find_element_by_xpath(
            "//*[@class='css-1flyc9m elbhbli3']")
        self.assertTrue(author_date.is_displayed(),
                        'Author & Date is not displayed')
        author_date_text = author_date.text
        author_date_text.encode('ascii', 'ignore')
        i = author_date_text.find("\n")
        author_name = author_date_text[:i]
        if 'prod' in env:
            self.assertEquals(
                author_name, PROD_AUTHOR,
                "actual [{0}] doesn't match expected [{1}]".format(
                    author_name, PROD_AUTHOR))
        else:
            self.assertEquals(
                author_name, AUTHOR,
                "actual [{0}] doesn't match expected [{1}]".format(
                    author_name, AUTHOR))
#        date = self.driver.find_element_by_xpath("//*[@class='css-1flyc9m elbhbli3']")
#        self.assertTrue(date.is_displayed(), "'Publish date is not displayed")
        date_text = author_date_text[i + 1:]
        if 'prod' in env:
            self.assertEquals(
                date_text, PROD_PUBLISH_DATE,
                "actual [{0}] doesn't match expected [{1}]".format(
                    date_text, PROD_PUBLISH_DATE))
        else:
            self.assertEquals(
                date_text, PUBLISH_DATE,
                "actual [{0}] doesn't match expected [{1}]".format(
                    date_text, PUBLISH_DATE))

        fb = self.driver.find_element_by_xpath(
            "//div[@class='css-m37a3p e48afky0']/div[2]")
        self.assertTrue(fb.is_displayed(),
                        'Facebook social share icon is displayed')
        twitter = self.driver.find_element_by_xpath(
            "//div[@class='css-m37a3p e48afky0']/div[3]")
        self.assertTrue(twitter.is_displayed(),
                        'Twitter social share icon is displayed')
        linkedin = self.driver.find_element_by_xpath(
            "//div[@class='css-m37a3p e48afky0']/div[1]")
        self.assertTrue(linkedin.is_displayed(),
                        'Linkedin social share icon is displayed')
        google = self.driver.find_element_by_xpath(
            "//div[@class='css-m37a3p e48afky0']/div[4]")
        self.assertTrue(google.is_displayed(),
                        'Google+ social share icon is displayed')
 def testHeadline(self):
     headline = self.driver.find_element_by_css_selector('.h1.nolinks')
     self.assertTrue(headline.is_displayed(),
                     'Article headline is not displayed')
     headline_text = headline.text
     if 'prod' in env_util.get_env():
         self.assertEquals(
             headline_text, PROD_HEADLINE,
             "actual [{0}] doesn't match expected [{1}]".format(
                 headline_text, PROD_HEADLINE))
     else:
         self.assertEquals(
             headline_text, HEADLINE,
             "actual [{0}] doesn't match expected [{1}]".format(
                 headline_text, HEADLINE))
Exemplo n.º 7
0
    if TimeMachine == True:
        test_list.append(time_machine)
        print time_machine
    smoke_tests = unittest.TestSuite(test_list)
    
    env = env_util.get_env().upper()
    
    # # File
    sys.stdout.flush()
    dir = os.getcwd()
    #outfile = open(dir + "\RegressionTestReport.html", "w")
    outfile = open(dir + os.sep +device_name+"MobileSmokesReport.html", "w")
    runner = HTMLTestRunner.HTMLTestRunner(stream=outfile, title='BND Smokes Report - '+env, description=' Smokes Tests', \
                                            verbosity=2)
    sys.stdout.flush()
    runner.run(smoke_tests)

    
if __name__ == "__main__":
    device_name = mobile_util.get_device_name()
    TimeMachine = False
    if len(argv) > 3:
        TimeMachine = True
    #unittest.main(verbosity=2)            
    main(TimeMachine)
    mail(RESULTS_EMAIL,
    "BUSINESSNEWSDAILY - Mobile ("+device_name+") - Smoke Tests Report - "+env_util.get_env().upper(),
    "See attachment for the test results",
    device_name+"MobileSmokesReport.html")