Skip to content

Conversation

@kaitozaw
Copy link
Collaborator

@kaitozaw kaitozaw commented Jan 3, 2026

Pull Request

Category

Bug, Tests

Feature/Issue Description

Q: Please give a brief summary of your feature/fix
A: Fixed orphaned BeEF server processes after test runs and added Firefox/geckodriver support for Selenium-based integration tests. Tests no longer fail with "Port 3000 already in use" errors and all long tests now pass successfully.

Q: Give a technical rundown of what you have changed (if applicable)
A:

  • spec/spec_helper.rb: Changed exit if pid.nil? to return if pid.nil? in stop_beef_server to prevent premature test suite termination. Changed exit to raise in start_beef_server to allow RSpec cleanup hooks to run properly.
  • spec/support/ui_support.rb: Added rescue block in start_beef_and_hook_browser to ensure BeEF server cleanup even when browser setup fails mid-process.
  • Dockerfile: Added firefox-esr package and geckodriver installation to enable Selenium WebDriver tests to run in Docker container.

Test Cases

Q: Describe your test cases, what you have covered and if there are any use cases that still need addressing.
A:
All existing short tests (unit) and long tests (integration with Selenium) now pass. Verified that BeEF processes are properly killed after each test, no port conflicts occur between test runs, and tests are no longer seed-dependent. Tested with multiple RSpec seed values to confirm deterministic behavior.

@kaitozaw kaitozaw temporarily deployed to Integrate Pull Request January 3, 2026 06:03 — with GitHub Actions Inactive
@kaitozaw kaitozaw linked an issue Jan 3, 2026 that may be closed by this pull request
@kaitozaw kaitozaw force-pushed the issue/3488-long-tests branch from 447798f to 065c7ad Compare January 12, 2026 06:57
@kaitozaw kaitozaw temporarily deployed to Integrate Pull Request January 12, 2026 06:57 — with GitHub Actions Inactive
&& apt-get -y clean \
&& rm -rf /var/lib/apt/lists/*

# Install geckodriver for Selenium tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pin geckodriver version and verify checksum to prevent supply chain attacks:

-RUN GECKODRIVER_VERSION=$(curl -sL [https://api.github.com/repos/mozilla/geckodriver/releases/latest](https://api.github.com/repos/mozilla/geckodriver/releases/latest) | grep -oP '"tag_name": "\K(.*)(?=")') \
- && wget -q "[https://github.com/mozilla/geckodriver/releases/download/${GECKODRIVER_VERSION}/geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz](https://github.com/mozilla/geckodriver/releases/download/${GECKODRIVER_VERSION}/geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz)" \
+ENV GECKODRIVER_VERSION=v0.36.0
+ENV GECKODRIVER_SHA256=0bde38707eb0a686a20c6bd50f4adcc7d60d4f73c60eb83ee9e0db8f65823e04
+RUN wget -q "[https://github.com/mozilla/geckodriver/releases/download/${GECKODRIVER_VERSION}/geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz](https://github.com/mozilla/geckodriver/releases/download/${GECKODRIVER_VERSION}/geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz)" \
+ && echo "${GECKODRIVER_SHA256}  geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz" | sha256sum -c - \

@kaitozaw kaitozaw temporarily deployed to Integrate Pull Request January 13, 2026 00:07 — with GitHub Actions Inactive
@zinduolis
Copy link
Contributor

✅ Tested and Verified

Dockerfile changes:

  • Docker image builds successfully
  • SHA256 checksum verification for geckodriver passes (build would fail on mismatch)
  • Firefox and geckodriver properly installed and functional

Test cleanup changes (spec_helper.rb + ui_support.rb):

Ran integration tests inside Docker that exercise the modified code:

Test Status
spec/requests/beef_test_spec.rb:21 ✅ Pass
spec/requests/login_spec.rb:22 ✅ Pass
spec/features/debug_modules_spec.rb:20 ✅ Pass
  • stop_beef_server() with return instead of exit works correctly
  • start_beef_and_hook_browser() begin/rescue cleanup works
  • stop_beef_and_unhook_browser() nil guards work

@kaitozaw kaitozaw merged commit 113b154 into beefproject:master Jan 14, 2026
5 checks passed
@kaitozaw kaitozaw deleted the issue/3488-long-tests branch January 14, 2026 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improper test cleanup and order-dependent results in long tests

2 participants