Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
redJ4y committed Aug 19, 2024
1 parent 95fe5ce commit ddcece9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,24 @@ jobs:

steps:
- uses: actions/checkout@v3

- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x

- name: Setup Chrome
id: setup-chrome
uses: browser-actions/setup-chrome@latest
with:
chrome-version: latest
install-chromedriver: true

- name: Set Chrome and ChromeDriver paths
run: |
echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> $GITHUB_ENV
echo "CHROMEDRIVER_PATH=${{ steps.setup-chrome.outputs.chromedriver-path }}" >> $GITHUB_ENV
- run: npm ci
- run: npx grunt
- run: npm test
Expand Down
21 changes: 12 additions & 9 deletions wdio.conf.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
const fs = require('fs');
const path = require('path');

// Function to check if ChromeDriver exists in a specific path
const chromeDriverExists = (path) => {
return fs.existsSync(path);
};

// Paths to check for ChromeDriver
const githubActionsChromeDriver = process.env.CHROMEDRIVER_PATH;
const localChromeDriver = path.join(__dirname, 'node_modules', 'chromedriver', 'bin', 'chromedriver');

// Determine which ChromeDriver to use
// If we are on a Continuous Integration server, use the ChromeDriver installed by browser-actions/setup-chrome.
// Otherwise, use the ChromeDriver installed as a devDependency.
let chromeDriverPath;
if (githubActionsChromeDriver && chromeDriverExists(githubActionsChromeDriver)) {
chromeDriverPath = githubActionsChromeDriver;
Expand All @@ -20,8 +19,6 @@ if (githubActionsChromeDriver && chromeDriverExists(githubActionsChromeDriver))
console.warn('ChromeDriver not found in expected locations. Using default.');
}

console.info(process.env.CHROME_BIN);

exports.config = {
//
// ====================
Expand Down Expand Up @@ -72,10 +69,16 @@ exports.config = {
capabilities: [{
maxInstances: 4,
browserName: 'chrome',
'goog:chromeOptions': {
binary: process.env.CHROME_BIN,
args: ['headless', 'disable-gpu', 'no-sandbox']
},
'goog:chromeOptions': (function() {
const options = {
args: ['headless', 'disable-gpu', 'no-sandbox'],
};
// Use the CHROME_BIN environment variable if present.
if (process.env.CHROME_BIN) {
options.binary = process.env.CHROME_BIN;
}
return options;
})(),
}],
//
// ===================
Expand Down

0 comments on commit ddcece9

Please sign in to comment.