Skip to content

Tests/integration tests lineage #1492

Tests/integration tests lineage

Tests/integration tests lineage #1492

Workflow file for this run

name: Test
on:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
# Set minimal permissions for security
permissions:
contents: read
actions: read
checks: write
pull-requests: write
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Setup Node.js with cache
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: npm-ci
run: npm ci
- name: Allow unprivileged user namespace (ubuntu)
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
- name: Setup Chrome browser (Ubuntu)
if: ${{ startsWith(matrix.os, 'ubuntu') }}
uses: browser-actions/setup-chrome@v1
- name: Setup Chrome browser (macOS)
if: ${{ startsWith(matrix.os, 'macos') }}
uses: browser-actions/setup-chrome@v1
- name: Setup Chrome browser (Windows)
if: ${{ startsWith(matrix.os, 'windows') }}
uses: browser-actions/setup-chrome@v1
- name: Install dependencies
run: npm run install:all
# install bruin cli for linux, mac and windows
- name: Install Bruin CLI
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
curl -LsSf https://raw.githubusercontent.com/bruin-data/bruin/refs/heads/main/install.sh | sh
else
curl -LsSL https://raw.githubusercontent.com/bruin-data/bruin/refs/heads/main/install.sh | sh
fi
shell: bash
- name: Compile
run: npm run compile
- name: Build Webview
run: npm run build:webview
- name: Run extension tests
run: |
if [ "${{ runner.os }}" = "Linux" ]; then
xvfb-run -a npm run test
else
npm run test
fi
shell: bash
- name: Run webview tests
run: npm run test:webview
- name: Run basic integration tests
run: |
echo "Running integration tests..."
# Set Chrome-related environment variables and unique user data dir
if [ "${{ runner.os }}" = "Linux" ]; then
export CHROME_BIN=$(which google-chrome || which chromium-browser || which chromium)
export CHROME_USER_DATA_DIR="/tmp/chrome-user-data-$$"
echo "Using Chrome at: $CHROME_BIN"
echo "Using user data dir: $CHROME_USER_DATA_DIR"
xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npm run selenium:run-tests:connections
xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npm run selenium:run-tests:ingestr
elif [ "${{ runner.os }}" = "macOS" ]; then
# Try different Chrome locations on macOS
if [ -f "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" ]; then
export CHROME_BIN="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
elif [ -f "/Applications/Chromium.app/Contents/MacOS/Chromium" ]; then
export CHROME_BIN="/Applications/Chromium.app/Contents/MacOS/Chromium"
fi
export CHROME_USER_DATA_DIR="/tmp/chrome-user-data-$$"
echo "Using Chrome at: $CHROME_BIN"
echo "Using user data dir: $CHROME_USER_DATA_DIR"
npm run selenium:run-tests:connections
npm run selenium:run-tests:ingestr
else
# Windows - let extension tester handle Chrome detection
export CHROME_USER_DATA_DIR="C:\\temp\\chrome-user-data-$$"
npm run selenium:run-tests:connections
npm run selenium:run-tests:ingestr
fi
shell: bash
- name: Run advanced integration tests
run: |
echo "Running webview integration tests..."
# Set Chrome-related environment variables and unique user data dir
if [ "${{ runner.os }}" = "Linux" ]; then
export CHROME_BIN=$(which google-chrome || which chromium-browser || which chromium)
export CHROME_USER_DATA_DIR="/tmp/chrome-user-data-webview-$$"
echo "Using Chrome at: $CHROME_BIN"
echo "Using user data dir: $CHROME_USER_DATA_DIR"
xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npm run selenium:run-tests:webview
elif [ "${{ runner.os }}" = "macOS" ]; then
# Try different Chrome locations on macOS
if [ -f "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" ]; then
export CHROME_BIN="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
elif [ -f "/Applications/Chromium.app/Contents/MacOS/Chromium" ]; then
export CHROME_BIN="/Applications/Chromium.app/Contents/MacOS/Chromium"
fi
export CHROME_USER_DATA_DIR="/tmp/chrome-user-data-webview-$$"
echo "Using Chrome at: $CHROME_BIN"
echo "Using user data dir: $CHROME_USER_DATA_DIR"
npm run selenium:run-tests:webview
else
# Windows - let extension tester handle Chrome detection
export CHROME_USER_DATA_DIR="C:\\temp\\chrome-user-data-webview-$$"
npm run selenium:run-tests:webview
fi
shell: bash
- name: Run lineage integration tests
run: |
echo "Running lineage integration tests..."
# Set Chrome-related environment variables and unique user data dir
if [ "${{ runner.os }}" = "Linux" ]; then
export CHROME_BIN=$(which google-chrome || which chromium-browser || which chromium)
export CHROME_USER_DATA_DIR="/tmp/chrome-user-data-lineage-$$"
echo "Using Chrome at: $CHROME_BIN"
echo "Using user data dir: $CHROME_USER_DATA_DIR"
xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npm run selenium:run-tests:lineage
elif [ "${{ runner.os }}" = "macOS" ]; then
# Try different Chrome locations on macOS
if [ -f "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" ]; then
export CHROME_BIN="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
elif [ -f "/Applications/Chromium.app/Contents/MacOS/Chromium" ]; then
export CHROME_BIN="/Applications/Chromium.app/Contents/MacOS/Chromium"
fi
npm run selenium:run-tests:lineage
else
# Windows - let extension tester handle Chrome detection
export CHROME_USER_DATA_DIR="C:\\temp\\chrome-user-data-lineage-$$"
npm run selenium:run-tests:lineage
fi
echo "Lineage integration tests completed"
shell: bash
- name: Store UI test logs
uses: actions/upload-artifact@v4
if: failure() || cancelled()
with:
name: logs-${{ matrix.os }}
path: test-resources/settings/logs/*
- name: Store UI Test screenshots
uses: actions/upload-artifact@v4
if: failure() || cancelled()
with:
name: screenshots-${{ matrix.os }}
path: test-resources/screenshots/*.png