Path: blob/trunk/py/test/selenium/webdriver/firefox/firefox_sizing_tests.py
1865 views
# Licensed to the Software Freedom Conservancy (SFC) under one1# or more contributor license agreements. See the NOTICE file2# distributed with this work for additional information3# regarding copyright ownership. The SFC licenses this file4# to you under the Apache License, Version 2.0 (the5# "License"); you may not use this file except in compliance6# with the License. You may obtain a copy of the License at7#8# http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing,11# software distributed under the License is distributed on an12# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY13# KIND, either express or implied. See the License for the14# specific language governing permissions and limitations15# under the License.1617import os18import sys19from unittest.mock import patch2021import pytest2223from selenium import webdriver242526def is_running_wayland():27return sys.platform == "linux" and os.getenv("WAYLAND_DISPLAY")282930@pytest.mark.skipif(not is_running_wayland(), reason="This test only runs on Linux under Wayland")31def test_firefox_opens_large_when_running_xwayland(firefox_options):32# setting environment variable `MOZ_ENABLE_WAYLAND=0` forces Firefox33# to run under XWayland on Wayland based systems34with patch.dict("os.environ", {"MOZ_ENABLE_WAYLAND": "0"}):35with webdriver.Firefox(options=firefox_options) as driver:36size = driver.get_window_size()37assert size["height"] > 50038assert size["width"] > 500394041@pytest.mark.skipif(not is_running_wayland(), reason="This test only runs on Linux under Wayland")42@pytest.mark.xfail(reason="https://bugzilla.mozilla.org/show_bug.cgi?id=1959040")43def test_firefox_opens_large_when_running_wayland(firefox_options):44with webdriver.Firefox(options=firefox_options) as driver:45size = driver.get_window_size()46assert size["height"] > 50047assert size["width"] > 500484950