Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | "use strict"; /** * Configures `GlaceJS` before tests run. * * @namespace GlaceConfig * @prop {object} web - Web options. * @prop {boolean} [web.use=false] - Flag to use web. * @prop {string} [web.url] - URL of web application. * @prop {string} [web.platform=pc] - Platform type. * @prop {string} [web.browser] - Browser name. * @prop {object} webdriver - Webdriver options. */ var expect = require("chai").expect; var logfmt = require("logfmt"); var U = require("glace-utils"); var config = U.config; var args = config.args; config.webdriver = U.defVal(config.webdriver, {}); config.web = U.defVal(config.web, {}); config.web.uiTimeout = 5; config.web.pageTimeout = 60; config.web.use = U.defVal(!!args.web, false); config.web.url = U.defVal(args.webUrl); config.web.platform = U.defVal(args.platform, "pc"); [ config.web.width, config.web.height ] = U.defVal(args.webResolution, "").split("x"); config.web.width = config.web.width && parseInt(config.web.width); config.web.height = config.web.height && parseInt(config.web.height); config.web.seleniumOpts = { drivers: { chrome: { version: "2.46", }, }, }; config.chrome = U.defVal(config.chrome, {}); config.chrome.incognito = U.defVal(args.chromeIncognito, false); config.chrome.headless = U.defVal(args.chromeHeadless, false); Iif (args.chromeOptions) { config.chrome.options = logfmt.parse(args.chromeOptions.replace(/'/g, "\"")); } expect(["pc", "android", "ios"], "Invalid `--platform` value").include(config.web.platform); var desired = config.webdriver.desiredCapabilities = {}; Iif (args.seleniumAddress) { var [ host, port ] = args.seleniumAddress.split(":"); if (host) config.webdriver.host = host; if (port) config.webdriver.port = port; }; Eif (config.web.platform === "pc") { config.web.isDesktop = true; desired.browserName = U.defVal(args.browser, "chrome").toLowerCase(); Eif (desired.browserName === "chrome") { desired.chromeOptions = { args: [ "test-type", "start-maximized", "disable-infobars", "enable-precise-memory-info" ], prefs: { "credentials_enable_service": false, "profile": { "password_manager_enabled": false, }, }, excludeSwitches: [ "enable-automation", ], useAutomationExtension: false, }; Iif (config.chrome.incognito) { desired.chromeOptions.args.push("incognito"); }; Iif (config.chrome.headless) { desired.chromeOptions.args.push("headless"); } Iif (config.chrome.options) { for (var [k, v] of Object.entries(config.chrome.options)) { if (v === true) { desired.chromeOptions.args.push(k); } else { desired.chromeOptions.args.push(k + "=" + v); } } } }; } else { config.web.isMobile = true; desired.deviceName = args.device; desired.platformVersion = String(args.osVersion); if (args.udid) { desired.udid = args.udid; }; if (config.web.platform === "android") { config.web.isAndroid = true; desired.browserName = U.defVal(args.browser, "chrome").toLowerCase(); desired.platformName = "Android"; }; if (config.web.platform === "ios") { config.web.isIos = true; desired.browserName = U.defVal(args.browser, "safari").toLowerCase(); desired.platformName = "iOS"; desired.automationName = args.iosEngine || "XCUITest"; }; }; config.web.browser = U.defVal(config.webdriver.desiredCapabilities.browserName); module.exports = config; |