playwright-fluent
Version:
Fluent API around playwright
94 lines (93 loc) • 2.53 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sizeOf = exports._3840x2160 = exports._2560x1440 = exports._1920x1440 = exports._1920x1200 = exports._1920x1080 = exports._1600x1200 = exports._1600x1024 = exports._1600x900 = exports._1280x720 = exports._1024x768 = exports._800x600 = exports.getBrowserArgsForWindowSize = exports.defaultWindowSizeOptions = void 0;
// eslint-disable-next-line @typescript-eslint/no-var-requires
const isCI = require('is-ci');
exports.defaultWindowSizeOptions = {
ciOnly: false,
};
function getBrowserArgsForWindowSize(size, options) {
return {
andBrowser: (browsername) => {
if (!size) {
return [];
}
if (options && options.ciOnly && isCI === false) {
return [];
}
switch (browsername) {
case 'chromium':
case 'chrome-canary':
case 'chrome': {
const arg = `--window-size=${size.width},${size.height}`;
return [arg];
}
case 'firefox': {
const arg1 = `-height=${size.height}`;
const arg2 = `-width=${size.width}`;
return [arg1, arg2];
}
default:
return [];
}
},
};
}
exports.getBrowserArgsForWindowSize = getBrowserArgsForWindowSize;
exports._800x600 = {
width: 800,
height: 600,
};
exports._1024x768 = {
width: 1024,
height: 768,
};
exports._1280x720 = {
width: 1280,
height: 720,
};
exports._1600x900 = {
width: 1600,
height: 900,
};
exports._1600x1024 = {
width: 1600,
height: 1024,
};
exports._1600x1200 = {
width: 1600,
height: 1200,
};
exports._1920x1080 = {
width: 1920,
height: 1080,
};
exports._1920x1200 = {
width: 1920,
height: 1200,
};
exports._1920x1440 = {
width: 1920,
height: 1440,
};
exports._2560x1440 = {
width: 2560,
height: 1440,
};
exports._3840x2160 = {
width: 3840,
height: 2160,
};
exports.sizeOf = {
_800x600: exports._800x600,
_1024x768: exports._1024x768,
_1280x720: exports._1280x720,
_1600x1024: exports._1600x1024,
_1600x1200: exports._1600x1200,
_1600x900: exports._1600x900,
_1920x1080: exports._1920x1080,
_1920x1200: exports._1920x1200,
_1920x1440: exports._1920x1440,
_2560x1440: exports._2560x1440,
_3840x2160: exports._3840x2160,
};