further tweaked sepia palette; shored up TestTray for headless browser pipeline testing
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
@@ -37,13 +37,24 @@ def wait(fn):
|
||||
# Functional Tests
|
||||
class FunctionalTest(StaticLiveServerTestCase):
|
||||
# Helper methods
|
||||
def setUp(self):
|
||||
def _make_browser(self, width=1366, height=900):
|
||||
"""Create a Firefox instance sized to width×height.
|
||||
In headless CI, pass --width/--height as binary args so the CSS
|
||||
media query (orientation: landscape/portrait) is correct from the
|
||||
first paint — set_window_size() alone is unreliable in headless mode.
|
||||
"""
|
||||
options = webdriver.FirefoxOptions()
|
||||
headless = os.environ.get("HEADLESS")
|
||||
if headless:
|
||||
options.add_argument("--headless")
|
||||
self.browser = webdriver.Firefox(options=options)
|
||||
self.browser.set_window_size(1366, 900)
|
||||
options.add_argument(f"--width={width}")
|
||||
options.add_argument(f"--height={height}")
|
||||
browser = webdriver.Firefox(options=options)
|
||||
browser.set_window_size(width, height)
|
||||
return browser
|
||||
|
||||
def setUp(self):
|
||||
self.browser = self._make_browser(1366, 900)
|
||||
self.test_server = os.environ.get("TEST_SERVER")
|
||||
if self.test_server:
|
||||
self.live_server_url = 'http://' + self.test_server
|
||||
|
||||
Reference in New Issue
Block a user