refactor: Extract window size into a object.

This will be passed to the function that will start the recording.
This commit is contained in:
Priyank Patel 2020-07-29 23:34:37 +00:00 committed by Tim Abbott
parent 0b2854f010
commit 3ab603e3a2
1 changed files with 12 additions and 1 deletions

View File

@ -41,17 +41,28 @@ class CommonUtils {
assert.equal(actual_recipients, expected); assert.equal(actual_recipients, expected);
}, },
}; };
this.fullname = { this.fullname = {
cordelia: "Cordelia Lear", cordelia: "Cordelia Lear",
othello: "Othello, the Moor of Venice", othello: "Othello, the Moor of Venice",
hamlet: "King Hamlet", hamlet: "King Hamlet",
}; };
this.window_size = {
width: 1400,
height: 1024,
};
} }
async ensure_browser() { async ensure_browser() {
if (this.browser === null) { if (this.browser === null) {
const {window_size} = this;
this.browser = await puppeteer.launch({ this.browser = await puppeteer.launch({
args: ["--window-size=1400,1024", "--no-sandbox", "--disable-setuid-sandbox"], args: [
`--window-size=${window_size.width},${window_size.height}`,
"--no-sandbox",
"--disable-setuid-sandbox",
],
defaultViewport: {width: 1280, height: 1024}, defaultViewport: {width: 1280, height: 1024},
headless: true, headless: true,
}); });