Skip to content

Commit

Permalink
ruuvi_gw_ui_tester: Add support for running in Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSomeMan committed Apr 29, 2024
1 parent 053bf75 commit 104bb3c
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions scripts/ruuvi_gw_ui_tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ async function removeDirectory(path) {
.options({
dir_test: { type: 'string', demandOption: true, describe: 'Path to the folder with the test data, results and logs' },
})
.options({
docker: { type: 'boolean', demandOption: false, describe: 'Run the test inside a docker instance' },
})
.argv;

const args = new CmdArgs(argv);
Expand All @@ -127,18 +130,25 @@ async function removeDirectory(path) {

const browser_tmp = path.join(argv.dir_test, 'tmp');
await removeDirectory(browser_tmp);
let browser_args = [
`--window-size=${screenWidth},${screenHeight}`,
'--disable-infobars',
'--noerrdialogs',
'--disable-translate',
'--disable-extensions',
'--disable-features=TranslateUI',
'--disk-cache-size=0'
];
let flag_headless = false;
if (argv.docker) {
flag_headless = true;
browser_args.push('--no-sandbox');
browser_args.push('--disable-setuid-sandbox');
}
const browser = await puppeteer.launch({
headless: false,
headless: flag_headless,
ignoreDefaultArgs: false,
args: [
`--window-size=${screenWidth},${screenHeight}`,
'--disable-infobars',
'--noerrdialogs',
'--disable-translate',
'--disable-extensions',
'--disable-features=TranslateUI',
'--disk-cache-size=0'
],
args: browser_args,
defaultViewport: null, // Disables Puppeteer's default viewport settings
userDataDir: browser_tmp,
});
Expand Down

0 comments on commit 104bb3c

Please sign in to comment.