Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: configure Puppeteer headless mode and add GitHub Actions workflow #62

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Run Checks

on:
push:
branches: [ feature/v2 ]
pull_request:
branches: [ feature/v2 ]

jobs:
check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'

- name: Install Chrome dependencies
run: |
sudo apt-get install -qq chromium-browser xvfb > /dev/null

- name: Install dependencies
run: |
npm install
npm install -g sass-lint

- name: Run checks
env:
PUPPETEER_EXECUTABLE_PATH: /usr/bin/chromium-browser
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 'true'
DISPLAY: ':99.0'
CI: 'true'
PUPPETEER_HEADLESS: 'true'
run: |
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
chmod +x bin/check
chmod +x bin/fastcheck
bin/check
19 changes: 15 additions & 4 deletions __test__/integration/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,23 @@ const readProp = (query: string, prop: string, index = 0) => (
const setup = async () => {
const extensionPath = path.join(__dirname, '../../dist');

const isHeadless = process.env.PUPPETEER_HEADLESS?.toLowerCase() !== 'false';
const isCI = process.env.CI === 'true';

const args = [
`--disable-extensions-except=${extensionPath}`,
...(isCI ? [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--disable-gpu',
] : []),
];

browser = await puppeteer.launch({
headless: false,
headless: isHeadless,
ignoreHTTPSErrors: true,
args: [
`--disable-extensions-except=${extensionPath}`,
],
args,
});

page = await browser.newPage();
Expand Down
Loading