Skip to content

Commit

Permalink
second attempt at getting interception working in CI in browser
Browse files Browse the repository at this point in the history
  • Loading branch information
lawrence-forooghian committed Apr 19, 2024
1 parent cc01e89 commit c5d6627
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion .github/workflows/test-browser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,53 @@ jobs:
with:
node-version: 20.x
- run: npm ci

# Set up Python (for pipx)
- uses: actions/setup-python@v5
with:
python-version: '3.12'

# Install pipx (for mitmproxy)
# See https://pipx.pypa.io/stable/installation/
- name: Install pipx
run: |
python3 -m pip install --user pipx
sudo pipx --global ensurepath
# https://docs.mitmproxy.org/stable/overview-installation/#installation-from-the-python-package-index-pypi
- name: Install mitmproxy
run: |
pipx install mitmproxy
# We use this library in our addon
pipx inject mitmproxy websockets
# This user comes from when originally following the mitmproxy documentation (i.e. intercepting _all_ traffic except that from this user). We no longer do this, but I guess there’s no harm in having a separate user instead of running as root.
- name: Create a user to run mitmproxy
run: sudo useradd --create-home mitmproxyuser

# This runs the proxy as the mitmproxyuser user created above (see start-interception-proxy script).
- name: Start interception proxy server
run: ./start-interception-proxy

- name: Install Playwright browsers and dependencies
run: npx playwright install --with-deps
- env:

- name: Run the tests
env:
PLAYWRIGHT_BROWSER: ${{ matrix.browser }}
run: npm run test:playwright

- name: Save interception proxy server logs
if: always()
run: sudo journalctl -u ably-sdk-test-proxy.service > interception-proxy-logs.txt

- name: Upload interception proxy server logs
if: always()
uses: actions/upload-artifact@v4
with:
name: interception-proxy-logs-${{ matrix.browser }}
path: interception-proxy-logs.txt

- name: Upload test results
if: always()
uses: ably/test-observability-action@v1
Expand Down

0 comments on commit c5d6627

Please sign in to comment.