示例#1
0
 def _formatMessage(self, msg, standardMsg):
     s = StringIO.StringIO()
     s.write(LiveServerTestCase._formatMessage(self, msg, standardMsg))
     s.write("\n")
     s.write("\n")
     s.write("failure url: %s\n" % self.browser.current_url)
     s.write("failure page source\n")
     s.write("-" * 80)
     s.write("\n")
     s.write(self.browser.page_source.encode('utf-8'))
     s.write("\n")
     s.write("-" * 80)
     s.write("\n")
     return s.getvalue()
示例#2
0
文件: base.py 项目: mattoc/slug
 def _formatMessage(self, msg, standardMsg):
     s = StringIO.StringIO()
     s.write(LiveServerTestCase._formatMessage(self, msg, standardMsg))
     s.write("\n")
     s.write("\n")
     s.write("failure url: %s\n" % self.browser.current_url)
     s.write("failure page source\n")
     s.write("-"*80)
     s.write("\n")
     s.write(self.browser.page_source.encode('utf-8'))
     s.write("\n")
     s.write("-"*80)
     s.write("\n")
     return s.getvalue()
示例#3
0
    def setUp(self):
        LiveServerTestCase.setUp(self)

        browser = os.environ.get("TEST_DRIVER", "firefox")
        if browser == "firefox":
            profile = FirefoxProfile()
            profile.set_preference('plugins.hide_infobar_for_missing_plugin',
                                   True)

            firefox_bin = os.path.join(os.getcwd(), 'firefox', 'firefox')
            if os.path.exists(firefox_bin):
                self.browser = webdriver.Firefox(
                    firefox_profile=profile,
                    firefox_binary=FirefoxBinary(firefox_bin))
            else:
                warnings.warn("Using your default firefox, this can be "
                              "unreliable")
                self.browser = webdriver.Firefox(firefox_profile=profile)
        elif browser == "chrome":
            chromedriver_bin = os.path.join(os.getcwd(), 'chromedriver')
            if not os.path.exists(chromedriver_bin):
                raise SystemError("""\
Unable to find chromedriver binary.

Please download from http://code.google.com/p/chromedriver/downloads/list and
put in your base directory.
""")
            self.browser = webdriver.Chrome(executable_path=chromedriver_bin)

        self.browser_quitter = BrowserQuitter(self.browser)

        self.browser.implicitly_wait(600)

        self.browser.get("%s" % self.live_server_url)
        self.assertIn("Sydney Linux User Group", self.browser.title)
        self.main_window_handle = self.browser.window_handles[0]
示例#4
0
文件: base.py 项目: mattoc/slug
    def setUp(self):
        LiveServerTestCase.setUp(self)

        browser = os.environ.get("TEST_DRIVER", "firefox")
        if browser == "firefox":
            profile = FirefoxProfile()
            profile.set_preference('plugins.hide_infobar_for_missing_plugin',
                                   True)

            firefox_bin = os.path.join(os.getcwd(), 'firefox', 'firefox')
            if os.path.exists(firefox_bin):
                self.browser = webdriver.Firefox(
                        firefox_profile=profile,
                        firefox_binary=FirefoxBinary(firefox_bin))
            else:
                warnings.warn("Using your default firefox, this can be "
                              "unreliable")
                self.browser = webdriver.Firefox(firefox_profile=profile)
        elif browser == "chrome":
            chromedriver_bin = os.path.join(os.getcwd(), 'chromedriver')
            if not os.path.exists(chromedriver_bin):
                raise SystemError("""\
Unable to find chromedriver binary.

Please download from http://code.google.com/p/chromedriver/downloads/list and
put in your base directory.
""")
            self.browser = webdriver.Chrome(executable_path=chromedriver_bin)

        self.browser_quitter = BrowserQuitter(self.browser)

        self.browser.implicitly_wait(600)

        self.browser.get("%s" % self.live_server_url)
        self.assertIn("Sydney Linux User Group", self.browser.title)
        self.main_window_handle = self.browser.window_handles[0]
示例#5
0
 def tearDown(self):
     del self.browser_quitter
     LiveServerTestCase.tearDown(self)
示例#6
0
文件: base.py 项目: mattoc/slug
 def tearDown(self):
     del self.browser_quitter
     LiveServerTestCase.tearDown(self)