Skip to content

Commit

Permalink
Use Fluxbox as window manager for browser tests using Xvfb
Browse files Browse the repository at this point in the history
  • Loading branch information
whimboo authored and titusfortner committed Sep 23, 2022
1 parent 31190f8 commit 2a6ab54
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 21 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/ci-java.yml
Expand Up @@ -171,6 +171,8 @@ jobs:
${{ runner.os }}-bazel-build-
- name: Setup bazelisk
uses: ./.github/actions/setup-bazelisk
- name: Setup Fluxbox
run: sudo apt-get -y install fluxbox
- name: Setup Java
uses: actions/setup-java@v1
with:
Expand All @@ -189,6 +191,8 @@ jobs:
matrix.browser == 'chrome'
- name: Start XVFB
run: Xvfb :99 &
- name: Start Fluxbox
run: fluxbox -display :99 &
- name: Run browser tests in ${{ matrix.browser }}
uses: ./.github/actions/bazel-test
with:
Expand Down Expand Up @@ -225,6 +229,8 @@ jobs:
${{ runner.os }}-bazel-build-
- name: Setup bazelisk
uses: ./.github/actions/setup-bazelisk
- name: Setup Fluxbox
run: sudo apt-get -y install fluxbox
- name: Setup Java
uses: actions/setup-java@v1
with:
Expand All @@ -243,6 +249,8 @@ jobs:
matrix.browser == 'chrome'
- name: Start XVFB
run: Xvfb :99 &
- name: Start Fluxbox
run: fluxbox -display :99 &
- name: Run server tests
uses: ./.github/actions/bazel-test
with:
Expand Down Expand Up @@ -270,6 +278,8 @@ jobs:
${{ runner.os }}-bazel-build-
- name: Setup bazelisk
uses: ./.github/actions/setup-bazelisk
- name: Setup Fluxbox
run: sudo apt-get -y install fluxbox
- name: Setup Java
uses: actions/setup-java@v1
with:
Expand All @@ -280,6 +290,8 @@ jobs:
version: latest
- name: Start XVFB
run: Xvfb :99 &
- name: Start Fluxbox
run: fluxbox -display :99 &
- name: Run browser tests in Firefox
uses: ./.github/actions/bazel-test
with:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/ci-javascript.yml
Expand Up @@ -53,6 +53,8 @@ jobs:
java-version: 11
- name: Setup bazelisk
uses: ./.github/actions/setup-bazelisk
- name: Setup Fluxbox
run: sudo apt-get -y install fluxbox
- name: Setup Firefox and GeckoDriver
uses: ./.github/actions/setup-firefox
with:
Expand Down Expand Up @@ -98,12 +100,16 @@ jobs:
java-version: 11
- name: Setup bazelisk
uses: ./.github/actions/setup-bazelisk
- name: Setup Fluxbox
run: sudo apt-get -y install fluxbox
- name: Setup Firefox and GeckoDriver
uses: ./.github/actions/setup-firefox
with:
version: ${{ matrix.version }}
- name: Start XVFB
run: Xvfb :99 &
- name: Start Fluxbox
run: fluxbox -display :99 &
- name: Run atom tests on Firefox
uses: ./.github/actions/bazel
with:
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/ci-python.yml
Expand Up @@ -132,6 +132,8 @@ jobs:
${{ runner.os }}-bazel-python-unit-tests-
- name: Setup bazelisk
uses: ./.github/actions/setup-bazelisk
- name: Setup Fluxbox
run: sudo apt-get -y install fluxbox
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
Expand All @@ -144,6 +146,8 @@ jobs:
uses: ./.github/actions/setup-chrome
- name: Start XVFB
run: Xvfb :99 &
- name: Start Fluxbox
run: fluxbox -display :99 &
- name: Run browser tests in Chrome
uses: ./.github/actions/bazel-test
with:
Expand Down Expand Up @@ -171,6 +175,8 @@ jobs:
${{ runner.os }}-bazel-python-unit-tests-
- name: Setup bazelisk
uses: ./.github/actions/setup-bazelisk
- name: Setup Fluxbox
run: sudo apt-get -y install fluxbox
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
Expand All @@ -183,6 +189,8 @@ jobs:
uses: ./.github/actions/setup-firefox
- name: Start XVFB
run: Xvfb :99 &
- name: Start Fluxbox
run: fluxbox -display :99 &
- name: Run browser tests in Firefox (Remote)
uses: ./.github/actions/bazel
with:
Expand All @@ -209,6 +217,8 @@ jobs:
${{ runner.os }}-bazel-python-unit-tests-
- name: Setup bazelisk
uses: ./.github/actions/setup-bazelisk
- name: Setup Fluxbox
run: sudo apt-get -y install fluxbox
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
Expand All @@ -219,8 +229,10 @@ jobs:
java-version: '11'
- name: Setup Firefox and GeckoDriver
uses: ./.github/actions/setup-firefox
- name: Start XVFB
- name: Start Xvfb
run: Xvfb :99 &
- name: Start Fluxbox
run: fluxbox -display :99 &
- name: Run browser tests in Firefox
uses: ./.github/actions/bazel-test
with:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/ci-ruby.yml
Expand Up @@ -74,8 +74,12 @@ jobs:
restore-keys: |
${{ runner.os }}-bazel-ruby-${{ matrix.target }}-
- uses: ./.github/actions/setup-bazelisk
- name: Setup Fluxbox
run: sudo apt-get -y install fluxbox
- uses: ./.github/actions/setup-chrome
- run: Xvfb :99 &
- name: Start Fluxbox
run: fluxbox -display :99 &
- uses: ./.github/actions/bazel
with:
command: test --test_output=all //rb:${{ matrix.target }}
Expand Down Expand Up @@ -107,9 +111,13 @@ jobs:
restore-keys: |
${{ runner.os }}-bazel-ruby-${{ matrix.target }}-
- uses: ./.github/actions/setup-bazelisk
- name: Setup Fluxbox
run: sudo apt-get -y install fluxbox
- name: Setup Firefox and GeckoDriver
uses: ./.github/actions/setup-firefox
- run: Xvfb :99 &
- name: Start Fluxbox
run: fluxbox -display :99 &
- uses: ./.github/actions/bazel
with:
command: test --test_output=all //rb:${{ matrix.target }}
Expand Down
1 change: 0 additions & 1 deletion java/test/org/openqa/selenium/WindowTest.java
Expand Up @@ -91,7 +91,6 @@ public void testGetsThePositionOfTheCurrentWindow() {
}

@Test
@Ignore(value = FIREFOX, gitHubActions = true, issue = "https://github.com/mozilla/geckodriver/issues/2042")
public void testSetsThePositionOfTheCurrentWindow() {
// Browser window cannot be resized or moved on ANDROID (and most mobile platforms
// though others aren't defined in org.openqa.selenium.Platform).
Expand Down
2 changes: 0 additions & 2 deletions py/test/selenium/webdriver/common/api_example_tests.py
Expand Up @@ -240,8 +240,6 @@ def test_is_element_displayed(driver, pages):


@pytest.mark.xfail_chrome
@pytest.mark.xfail_firefox(reason='https://github.com/mozilla/geckodriver/issues/2042')
@pytest.mark.xfail_remote(reason='https://github.com/mozilla/geckodriver/issues/2042')
def test_move_window_position(driver, pages):
pages.load("blank.html")
loc = driver.get_window_position()
Expand Down
4 changes: 0 additions & 4 deletions py/test/selenium/webdriver/common/window_tests.py
Expand Up @@ -65,8 +65,6 @@ def test_should_get_the_position_of_the_current_window(driver):
assert position.get('y') >= 0


@pytest.mark.xfail_firefox(reason='https://github.com/mozilla/geckodriver/issues/2042')
@pytest.mark.xfail_remote(reason='https://github.com/mozilla/geckodriver/issues/2042')
def test_should_set_the_position_of_the_current_window(driver):
position = driver.get_window_position()

Expand All @@ -93,8 +91,6 @@ def test_should_get_the_rect_of_the_current_window(driver):
assert rect.get('height') >= 0


@pytest.mark.xfail_firefox(reason='https://github.com/mozilla/geckodriver/issues/2042')
@pytest.mark.xfail_remote(reason='https://github.com/mozilla/geckodriver/issues/2042')
@pytest.mark.xfail_safari(raises=WebDriverException,
reason='Get Window Rect command not implemented')
def test_should_set_the_rect_of_the_current_window(driver):
Expand Down
2 changes: 0 additions & 2 deletions rb/spec/integration/selenium/webdriver/spec_helper.rb
Expand Up @@ -53,8 +53,6 @@
guards.add_condition(:driver, GlobalTestEnv.driver)
guards.add_condition(:browser, GlobalTestEnv.browser)
guards.add_condition(:platform, WebDriver::Platform.os)
window_manager = !WebDriver::Platform.linux? || !ENV['DESKTOP_SESSION'].nil?
guards.add_condition(:window_manager, window_manager)

results = guards.disposition
send(*results) if results
Expand Down
16 changes: 5 additions & 11 deletions rb/spec/integration/selenium/webdriver/window_spec.rb
Expand Up @@ -60,10 +60,7 @@ module WebDriver
expect(pos.y).to be >= 0
end

it 'sets the position of the current window',
except: {browser: :firefox,
window_manager: false,
reason: 'https://github.com/mozilla/geckodriver/issues/2042'} do
it 'sets the position of the current window' do
pos = window.position

target_x = pos.x + 10
Expand All @@ -89,10 +86,7 @@ module WebDriver
expect(rect.height).to be >= 0
end

it 'sets the rect of the current window',
except: {browser: :firefox,
window_manager: false,
reason: 'https://github.com/mozilla/geckodriver/issues/2042'} do
it 'sets the rect of the current window' do
rect = window.rect

target_x = rect.x + 10
Expand All @@ -111,7 +105,7 @@ module WebDriver
expect(new_rect.height).to eq(target_height)
end

it 'can maximize the current window', except: {window_manager: false, browser: %i[ie firefox safari]} do
it 'can maximize the current window' do
window.size = old_size = Dimension.new(700, 700)

window.maximize
Expand All @@ -122,7 +116,7 @@ module WebDriver
expect(new_size.height).to be > old_size.height
end

it 'can make window full screen', except: {window_manager: false, browser: :firefox} do
it 'can make window full screen' do
window.size = old_size = Dimension.new(700, 700)

window.full_screen
Expand All @@ -133,7 +127,7 @@ module WebDriver
expect(new_size.height).to be > old_size.height
end

it 'can minimize the window', only: {window_manager: true} do
it 'can minimize the window' do
window.minimize
expect(driver.execute_script('return document.hidden;')).to be true
end
Expand Down

0 comments on commit 2a6ab54

Please sign in to comment.