How to use commands method in autotest

Best Python code snippet using autotest_python

commands.js

Source:commands.js Github

copy

Full Screen

1// Copyright 2012 Selenium committers2// Copyright 2012 Software Freedom Conservancy3//4// Licensed under the Apache License, Version 2.0 (the "License");5// you may not use this file except in compliance with the License.6// You may obtain a copy of the License at7//8// http://www.apache.org/licenses/LICENSE-2.09//10// Unless required by applicable law or agreed to in writing, software11// distributed under the License is distributed on an "AS IS" BASIS,12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13// See the License for the specific language governing permissions and14// limitations under the License.15/**16 * @fileoverview Command handlers used by the SafariDriver's injected script.17 */18goog.provide('safaridriver.inject.commands');19goog.require('bot');20goog.require('bot.Error');21goog.require('bot.ErrorCode');22goog.require('bot.action');23goog.require('bot.dom');24goog.require('bot.frame');25goog.require('bot.inject');26goog.require('bot.inject.cache');27goog.require('bot.locators');28goog.require('bot.window');29goog.require('goog.array');30goog.require('goog.debug.Logger');31goog.require('goog.math.Coordinate');32goog.require('goog.math.Size');33goog.require('goog.net.cookies');34goog.require('goog.style');35goog.require('safaridriver.inject.CommandRegistry');36goog.require('safaridriver.inject.message.Activate');37goog.require('webdriver.atoms.element');38/**39 * @private {!goog.debug.Logger}40 * @const41 */42safaridriver.inject.commands.LOG_ = goog.debug.Logger.getLogger(43 'safaridriver.inject.commands');44/** @return {string} The name of the current window. */45safaridriver.inject.commands.getWindowName = function() {46 return window.name;47};48/** @return {string} The current URL. */49safaridriver.inject.commands.getCurrentUrl = function() {50 return window.location.href;51};52/**53 * Loads a new URL in the current page.54 * @param {!safaridriver.Command} command The command object.55 */56safaridriver.inject.commands.loadUrl = function(command) {57 window.location.href = /** @type {string} */ (command.getParameter('url'));58 // No need to send a response. The global page should be listening for the59 // navigate event.60};61/** Reloads the current page. */62safaridriver.inject.commands.reloadPage = function() {63 window.location.reload();64 // No need to send a response. The global page should be listening for the65 // navigate event.66};67/**68 * Stub that reports an error that navigating through the browser history does69 * not work for the SafariDriver.70 */71safaridriver.inject.commands.unsupportedHistoryNavigation = function() {72 throw Error('Yikes! Safari history navigation does not work. We can ' +73 'go forward or back, but once we do, we can no longer ' +74 'communicate with the page...');75};76/** @return {string} The document title. */77safaridriver.inject.commands.getTitle = function() {78 return document.title;79};80/** @return {string} A string representation of the current page source. */81safaridriver.inject.commands.getPageSource = function() {82 return new XMLSerializer().serializeToString(document);83};84/**85 * Defines an element locating command.86 * @param {function(!Object, (Document|Element)=):87 * (Element|!goog.array.ArrayLike.<Element>)} locatorFn The locator function88 * that should be used.89 * @return {function(!safaridriver.Command): !bot.response.ResponseObject} The90 * locator command function.91 * @private92 */93safaridriver.inject.commands.findElementCommand_ = function(locatorFn) {94 return function(command) {95 var locator = {};96 locator[command.getParameter('using')] = command.getParameter('value');97 var args = [locator];98 if (command.getParameter('id')) {99 args.push({'ELEMENT': command.getParameter('id')});100 }101 return bot.inject.executeScript(locatorFn, args);102 };103};104/**105 * Locates an element on the page.106 * @param {!safaridriver.Command} command The command object.107 * @return {!bot.response.ResponseObject} The command response.108 */109safaridriver.inject.commands.findElement =110 safaridriver.inject.commands.findElementCommand_(bot.locators.findElement);111/**112 * Locates multiple elements on the page.113 * @param {!safaridriver.Command} command The command object.114 * @return {bot.response.ResponseObject} The command response.115 */116safaridriver.inject.commands.findElements =117 safaridriver.inject.commands.findElementCommand_(bot.locators.findElements);118/**119 * Retrieves the element that currently has focus.120 * @return {!bot.response.ResponseObject} The response object.121 */122safaridriver.inject.commands.getActiveElement = function() {123 var getActiveElement = goog.partial(bot.dom.getActiveElement, document);124 return /** @type {!bot.response.ResponseObject} */ (bot.inject.executeScript(125 getActiveElement, []));126};127/**128 * Adds a new cookie to the page.129 * @param {!safaridriver.Command} command The command object.130 */131safaridriver.inject.commands.addCookie = function(command) {132 var cookie = command.getParameter('cookie');133 // The WebDriver wire protocol defines cookie expiration times in seconds134 // since midnight, January 1, 1970 UTC, but goog.net.Cookies expects them135 // to be in seconds since "right now".136 var maxAge = cookie['expiry'];137 if (goog.isNumber(maxAge)) {138 maxAge = new Date(maxAge - goog.now());139 }140 // TODO: check whether cookie['domain'] is valid.141 goog.net.cookies.set(cookie['name'], cookie['value'], maxAge,142 cookie['path'], cookie['domain'], cookie['secure']);143};144/**145 * @return {!Array.<{name:string, value:string}>} A list of the cookies visible146 * to the current page.147 */148safaridriver.inject.commands.getCookies = function() {149 var keys = goog.net.cookies.getKeys();150 return goog.array.map(keys, function(key) {151 return {152 'name': key,153 'value': goog.net.cookies.get(key)154 };155 });156};157/** Deletes all cookies visible to the current page. */158safaridriver.inject.commands.deleteCookies = function() {159 goog.net.cookies.clear();160};161/**162 * Deletes a specified cookie.163 * @param {!safaridriver.Command} command The command object.164 */165safaridriver.inject.commands.deleteCookie = function(command) {166 goog.net.cookies.remove(/** @type {string} */ (command.getParameter('name')));167};168/**169 * Creates a command that targets a specific DOM element.170 * @param {!Function} handlerFn The actual handler function. The first parameter171 * should be the Element to target.172 * @param {...string} var_args Any named parameters which should be extracted173 * and passed as arguments to {@code commandFn}.174 * @return {function(!safaridriver.Command)} The new element command function.175 * @private176 */177safaridriver.inject.commands.elementCommand_ = function(handlerFn, var_args) {178 var keys = goog.array.slice(arguments, 1);179 return function(command) {180 command = safaridriver.inject.commands.util.prepareElementCommand(command);181 var element = command.getParameter('id');182 var args = goog.array.concat(element, goog.array.map(keys, function(key) {183 return command.getParameter(key);184 }));185 return bot.inject.executeScript(handlerFn, args);186 };187};188/**189 * @param {!safaridriver.Command} command The command to execute.190 * @see bot.action.clear191 */192safaridriver.inject.commands.clearElement =193 safaridriver.inject.commands.elementCommand_(bot.action.clear);194/**195 * @param {!safaridriver.Command} command The command to execute.196 * @see bot.action.click197 */198safaridriver.inject.commands.clickElement =199 safaridriver.inject.commands.elementCommand_(bot.action.click);200/**201 * @param {!safaridriver.Command} command The command to execute.202 * @see bot.action.submit203 */204safaridriver.inject.commands.submitElement =205 safaridriver.inject.commands.elementCommand_(bot.action.submit);206/**207 * @param {!safaridriver.Command} command The command to execute.208 * @see webdriver.atoms.element.getAttribute209 */210safaridriver.inject.commands.getElementAttribute =211 safaridriver.inject.commands.elementCommand_(212 webdriver.atoms.element.getAttribute, 'name');213/**214 * @param {!safaridriver.Command} command The command to execute.215 * @see goog.style.getPageOffset216 */217safaridriver.inject.commands.getElementLocation =218 safaridriver.inject.commands.elementCommand_(goog.style.getPageOffset);219/**220 * @param {!safaridriver.Command} command The command to execute.221 * @see webdriver.atoms.element.getLocationInView222 */223safaridriver.inject.commands.getLocationInView =224 safaridriver.inject.commands.elementCommand_(225 webdriver.atoms.element.getLocationInView);226/**227 * @param {!safaridriver.Command} command The command to execute.228 * @see goog.style.getSize229 */230safaridriver.inject.commands.getElementSize =231 safaridriver.inject.commands.elementCommand_(goog.style.getSize);232/**233 * @param {!safaridriver.Command} command The command to execute.234 * @see webdriver.atoms.element.getText235 */236safaridriver.inject.commands.getElementText =237 safaridriver.inject.commands.elementCommand_(238 webdriver.atoms.element.getText);239/**240 * @param {!safaridriver.Command} command The command to execute.241 */242safaridriver.inject.commands.getElementTagName =243 safaridriver.inject.commands.elementCommand_(function(el) {244 return el.tagName.toLowerCase();245 });246/**247 * @param {!safaridriver.Command} command The command to execute.248 * @see bot.dom.isShown249 */250safaridriver.inject.commands.isElementDisplayed =251 safaridriver.inject.commands.elementCommand_(bot.dom.isShown);252/**253 * @param {!safaridriver.Command} command The command to execute.254 * @see bot.dom.isEnabled255 */256safaridriver.inject.commands.isElementEnabled =257 safaridriver.inject.commands.elementCommand_(bot.dom.isEnabled);258/**259 * @param {!safaridriver.Command} command The command to execute.260 * @see webdriver.atoms.element.isSelected261 */262safaridriver.inject.commands.isElementSelected =263 safaridriver.inject.commands.elementCommand_(264 webdriver.atoms.element.isSelected);265/**266 * @param {!safaridriver.Command} command The command to execute.267 */268safaridriver.inject.commands.elementEquals =269 safaridriver.inject.commands.elementCommand_(function(a, b) {270 return a === b;271 }, 'other');272/**273 * @param {!safaridriver.Command} command The command to execute.274 * @see bot.dom.getEffectiveStyle275 */276safaridriver.inject.commands.getCssValue =277 safaridriver.inject.commands.elementCommand_(bot.dom.getEffectiveStyle,278 'propertyName');279/**280 * @return {!goog.math.Coordinate} The position of the window.281 * @see bot.window.getPosition282 */283safaridriver.inject.commands.getWindowPosition = function() {284 return bot.window.getPosition();285};286/**287 * @param {!safaridriver.Command} command The command to execute.288 * @see bot.window.setPosition289 */290safaridriver.inject.commands.setWindowPosition = function(command) {291 var position = new goog.math.Coordinate(292 /** @type {number} */ (command.getParameter('x')),293 /** @type {number} */ (command.getParameter('y')));294 bot.window.setPosition(position);295};296/**297 * @return {!goog.math.Size} The size of the window.298 * @see bot.window.getSize299 */300safaridriver.inject.commands.getWindowSize = function() {301 return bot.window.getSize();302};303/**304 * @param {!safaridriver.Command} command The command to execute.305 * @see bot.window.setSize306 */307safaridriver.inject.commands.setWindowSize = function(command) {308 var size = new goog.math.Size(309 /** @type {number} */ (command.getParameter('width')),310 /** @type {number} */ (command.getParameter('height')));311 bot.window.setSize(size);312};313/** Maximizes the window. */314safaridriver.inject.commands.maximizeWindow = function() {315 window.moveTo(0, 0);316 window.resizeTo(window.screen.width, window.screen.height);317};318/**319 * Executes a command in the context of the current page.320 * @param {!safaridriver.Command} command The command to execute.321 * @param {!safaridriver.inject.Tab} tab A reference to the tab issuing this322 * command.323 * @return {!webdriver.promise.Promise} A promise that will be resolved with the324 * {@link bot.response.ResponseObject} from the page.325 * @throws {Error} If there is an error while sending the command to the page.326 */327safaridriver.inject.commands.executeInPage = function(command, tab) {328 command = safaridriver.inject.commands.util.prepareElementCommand(command);329 return tab.executeInPage(command);330};331/**332 * Locates a frame and sends a message to it to activate itself with the333 * extension. The located frame will be334 * @param {!safaridriver.Command} command The command to execute.335 * the target of all subsequent commands.336 * @throws {Error} If there is an error whilst locating the frame.337 */338safaridriver.inject.commands.switchToFrame = function(command) {339 var id = command.getParameter('id');340 var frameWindow;341 if (goog.isNull(id)) {342 safaridriver.inject.commands.LOG_.info('Resetting focus to window.top');343 frameWindow = window.top;344 } else if (goog.isString(id)) {345 safaridriver.inject.commands.LOG_.info(346 'Switching to frame by name or ID: ' + id);347 frameWindow = bot.frame.findFrameByNameOrId(/** @type {string} */ (id));348 } else if (goog.isNumber(id)) {349 safaridriver.inject.commands.LOG_.info(350 'Switching to frame by index: ' + id);351 frameWindow = bot.frame.findFrameByIndex(/** @type {number} */ (id));352 } else {353 var elementKey = /** @type {string} */ (id[bot.inject.ELEMENT_KEY]);354 safaridriver.inject.commands.LOG_.info('Switching to frame by ' +355 'WebElement: ' + elementKey);356 // ID must be a WebElement. Pull it from the cache.357 var frameElement = bot.inject.cache.getElement(elementKey);358 frameWindow = bot.frame.getFrameWindow(359 /** @type {!(HTMLIFrameElement|HTMLFrameElement)} */ (frameElement));360 }361 if (!frameWindow) {362 throw new bot.Error(bot.ErrorCode.NO_SUCH_FRAME,363 'Unable to locate frame with ' + id);364 }365 // De-activate ourselves. We should no longer respond to commands until366 // we are re-activated.367 safaridriver.inject.Tab.getInstance().setActive(false);368 var message = new safaridriver.inject.message.Activate(command);369 message.send(frameWindow);370};371goog.scope(function() {372var CommandName = webdriver.CommandName;373var commands = safaridriver.inject.commands;374// Commands that should be defined for every frame.375safaridriver.inject.CommandRegistry.getInstance()376 .defineModule(safaridriver.inject.commands.module.ID, goog.object.create(377 CommandName.ADD_COOKIE, commands.addCookie,378 CommandName.CLEAR_ELEMENT, commands.clearElement,379 CommandName.CLICK_ELEMENT, commands.clickElement,380 CommandName.DELETE_ALL_COOKIES, commands.deleteCookies,381 CommandName.DELETE_COOKIE, commands.deleteCookie,382 CommandName.ELEMENT_EQUALS, commands.elementEquals,383 CommandName.FIND_CHILD_ELEMENT, commands.findElement,384 CommandName.FIND_CHILD_ELEMENTS, commands.findElements,385 CommandName.FIND_ELEMENT, commands.findElement,386 CommandName.FIND_ELEMENTS, commands.findElements,387 CommandName.GET, commands.loadUrl,388 CommandName.GET_ACTIVE_ELEMENT, commands.getActiveElement,389 CommandName.GET_ALL_COOKIES, commands.getCookies,390 CommandName.GET_CURRENT_URL, commands.getCurrentUrl,391 CommandName.GET_ELEMENT_ATTRIBUTE, commands.getElementAttribute,392 CommandName.GET_ELEMENT_LOCATION, commands.getElementLocation,393 CommandName.GET_ELEMENT_LOCATION_IN_VIEW, commands.getLocationInView,394 CommandName.GET_ELEMENT_SIZE, commands.getElementSize,395 CommandName.GET_ELEMENT_TAG_NAME, commands.getElementTagName,396 CommandName.GET_ELEMENT_TEXT, commands.getElementText,397 CommandName.GET_ELEMENT_VALUE_OF_CSS_PROPERTY, commands.getCssValue,398 CommandName.GET_PAGE_SOURCE, commands.getPageSource,399 CommandName.GET_TITLE, commands.getTitle,400 CommandName.GET_WINDOW_POSITION, commands.getWindowPosition,401 CommandName.GET_WINDOW_SIZE, commands.getWindowSize,402 CommandName.GO_BACK, commands.unsupportedHistoryNavigation,403 CommandName.GO_FORWARD, commands.unsupportedHistoryNavigation,404 CommandName.IS_ELEMENT_DISPLAYED, commands.isElementDisplayed,405 CommandName.IS_ELEMENT_ENABLED, commands.isElementEnabled,406 CommandName.IS_ELEMENT_SELECTED, commands.isElementSelected,407 CommandName.MAXIMIZE_WINDOW, commands.maximizeWindow,408 CommandName.REFRESH, commands.reloadPage,409 CommandName.SET_WINDOW_POSITION, commands.setWindowPosition,410 CommandName.SET_WINDOW_SIZE, commands.setWindowSize,411 CommandName.SUBMIT_ELEMENT, commands.submitElement,412 CommandName.SWITCH_TO_FRAME, commands.switchToFrame,413 // The extension handles window switches. It sends the command to this414 // injected script only as a means of retrieving the window name.415 CommandName.SWITCH_TO_WINDOW, commands.getWindowName));...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1'use strict';2const defaultExclude = require('./default-exclude.js');3const defaultExtension = require('./default-extension.js');4const nycCommands = {5 all: [null, 'check-coverage', 'instrument', 'merge', 'report'],6 testExclude: [null, 'instrument', 'report', 'check-coverage'],7 instrument: [null, 'instrument'],8 checkCoverage: [null, 'report', 'check-coverage'],9 report: [null, 'report'],10 main: [null],11 instrumentOnly: ['instrument']12};13const cwd = {14 description: 'working directory used when resolving paths',15 type: 'string',16 get default() {17 return process.cwd();18 },19 nycCommands: nycCommands.all20};21const nycrcPath = {22 description: 'specify an explicit path to find nyc configuration',23 nycCommands: nycCommands.all24};25const tempDir = {26 description: 'directory to output raw coverage information to',27 type: 'string',28 default: './.nyc_output',29 nycAlias: 't',30 nycHiddenAlias: 'temp-directory',31 nycCommands: [null, 'check-coverage', 'merge', 'report']32};33const testExclude = {34 exclude: {35 description: 'a list of specific files and directories that should be excluded from coverage, glob patterns are supported',36 type: 'array',37 items: {38 type: 'string'39 },40 default: defaultExclude,41 nycCommands: nycCommands.testExclude,42 nycAlias: 'x'43 },44 excludeNodeModules: {45 description: 'whether or not to exclude all node_module folders (i.e. **/node_modules/**) by default',46 type: 'boolean',47 default: true,48 nycCommands: nycCommands.testExclude49 },50 include: {51 description: 'a list of specific files that should be covered, glob patterns are supported',52 type: 'array',53 items: {54 type: 'string'55 },56 default: [],57 nycCommands: nycCommands.testExclude,58 nycAlias: 'n'59 },60 extension: {61 description: 'a list of extensions that nyc should handle in addition to .js',62 type: 'array',63 items: {64 type: 'string'65 },66 default: defaultExtension,67 nycCommands: nycCommands.testExclude,68 nycAlias: 'e'69 }70};71const instrumentVisitor = {72 coverageVariable: {73 description: 'variable to store coverage',74 type: 'string',75 default: '__coverage__',76 nycCommands: nycCommands.instrument77 },78 coverageGlobalScope: {79 description: 'scope to store the coverage variable',80 type: 'string',81 default: 'this',82 nycCommands: nycCommands.instrument83 },84 coverageGlobalScopeFunc: {85 description: 'avoid potentially replaced `Function` when finding global scope',86 type: 'boolean',87 default: true,88 nycCommands: nycCommands.instrument89 },90 ignoreClassMethods: {91 description: 'class method names to ignore for coverage',92 type: 'array',93 items: {94 type: 'string'95 },96 default: [],97 nycCommands: nycCommands.instrument98 }99};100const instrumentParseGen = {101 autoWrap: {102 description: 'allow `return` statements outside of functions',103 type: 'boolean',104 default: true,105 nycCommands: nycCommands.instrument106 },107 esModules: {108 description: 'should files be treated as ES Modules',109 type: 'boolean',110 default: true,111 nycCommands: nycCommands.instrument112 },113 parserPlugins: {114 description: 'babel parser plugins to use when parsing the source',115 type: 'array',116 items: {117 type: 'string'118 },119 /* Babel parser plugins are to be enabled when the feature is stage 3 and120 * implemented in a released version of node.js. */121 default: [122 'asyncGenerators',123 'bigInt',124 'classProperties',125 'classPrivateProperties',126 'classPrivateMethods',127 'dynamicImport',128 'importMeta',129 'numericSeparator',130 'objectRestSpread',131 'optionalCatchBinding',132 'topLevelAwait'133 ],134 nycCommands: nycCommands.instrument135 },136 compact: {137 description: 'should the output be compacted?',138 type: 'boolean',139 default: true,140 nycCommands: nycCommands.instrument141 },142 preserveComments: {143 description: 'should comments be preserved in the output?',144 type: 'boolean',145 default: true,146 nycCommands: nycCommands.instrument147 },148 produceSourceMap: {149 description: 'should source maps be produced?',150 type: 'boolean',151 default: true,152 nycCommands: nycCommands.instrument153 }154};155const checkCoverage = {156 excludeAfterRemap: {157 description: 'should exclude logic be performed after the source-map remaps filenames?',158 type: 'boolean',159 default: true,160 nycCommands: nycCommands.checkCoverage161 },162 branches: {163 description: 'what % of branches must be covered?',164 type: 'number',165 default: 0,166 minimum: 0,167 maximum: 100,168 nycCommands: nycCommands.checkCoverage169 },170 functions: {171 description: 'what % of functions must be covered?',172 type: 'number',173 default: 0,174 minimum: 0,175 maximum: 100,176 nycCommands: nycCommands.checkCoverage177 },178 lines: {179 description: 'what % of lines must be covered?',180 type: 'number',181 default: 90,182 minimum: 0,183 maximum: 100,184 nycCommands: nycCommands.checkCoverage185 },186 statements: {187 description: 'what % of statements must be covered?',188 type: 'number',189 default: 0,190 minimum: 0,191 maximum: 100,192 nycCommands: nycCommands.checkCoverage193 },194 perFile: {195 description: 'check thresholds per file',196 type: 'boolean',197 default: false,198 nycCommands: nycCommands.checkCoverage199 }200};201const report = {202 checkCoverage: {203 description: 'check whether coverage is within thresholds provided',204 type: 'boolean',205 default: false,206 nycCommands: nycCommands.report207 },208 reporter: {209 description: 'coverage reporter(s) to use',210 type: 'array',211 items: {212 type: 'string'213 },214 default: ['text'],215 nycCommands: nycCommands.report,216 nycAlias: 'r'217 },218 reportDir: {219 description: 'directory to output coverage reports in',220 type: 'string',221 default: 'coverage',222 nycCommands: nycCommands.report223 },224 showProcessTree: {225 description: 'display the tree of spawned processes',226 type: 'boolean',227 default: false,228 nycCommands: nycCommands.report229 },230 skipEmpty: {231 description: 'don\'t show empty files (no lines of code) in report',232 type: 'boolean',233 default: false,234 nycCommands: nycCommands.report235 },236 skipFull: {237 description: 'don\'t show files with 100% statement, branch, and function coverage',238 type: 'boolean',239 default: false,240 nycCommands: nycCommands.report241 }242};243const nycMain = {244 silent: {245 description: 'don\'t output a report after tests finish running',246 type: 'boolean',247 default: false,248 nycCommands: nycCommands.main,249 nycAlias: 's'250 },251 all: {252 description: 'whether or not to instrument all files of the project (not just the ones touched by your test suite)',253 type: 'boolean',254 default: false,255 nycCommands: nycCommands.main,256 nycAlias: 'a'257 },258 eager: {259 description: 'instantiate the instrumenter at startup (see https://git.io/vMKZ9)',260 type: 'boolean',261 default: false,262 nycCommands: nycCommands.main263 },264 cache: {265 description: 'cache instrumentation results for improved performance',266 type: 'boolean',267 default: true,268 nycCommands: nycCommands.main,269 nycAlias: 'c'270 },271 cacheDir: {272 description: 'explicitly set location for instrumentation cache',273 type: 'string',274 nycCommands: nycCommands.main275 },276 babelCache: {277 description: 'cache babel transpilation results for improved performance',278 type: 'boolean',279 default: false,280 nycCommands: nycCommands.main281 },282 useSpawnWrap: {283 description: 'use spawn-wrap instead of setting process.env.NODE_OPTIONS',284 type: 'boolean',285 default: false,286 nycCommands: nycCommands.main287 },288 hookRequire: {289 description: 'should nyc wrap require?',290 type: 'boolean',291 default: true,292 nycCommands: nycCommands.main293 },294 hookRunInContext: {295 description: 'should nyc wrap vm.runInContext?',296 type: 'boolean',297 default: false,298 nycCommands: nycCommands.main299 },300 hookRunInThisContext: {301 description: 'should nyc wrap vm.runInThisContext?',302 type: 'boolean',303 default: false,304 nycCommands: nycCommands.main305 },306 clean: {307 description: 'should the .nyc_output folder be cleaned before executing tests',308 type: 'boolean',309 default: true,310 nycCommands: nycCommands.main311 }312};313const instrumentOnly = {314 inPlace: {315 description: 'should nyc run the instrumentation in place?',316 type: 'boolean',317 default: false,318 nycCommands: nycCommands.instrumentOnly319 },320 exitOnError: {321 description: 'should nyc exit when an instrumentation failure occurs?',322 type: 'boolean',323 default: false,324 nycCommands: nycCommands.instrumentOnly325 },326 delete: {327 description: 'should the output folder be deleted before instrumenting files?',328 type: 'boolean',329 default: false,330 nycCommands: nycCommands.instrumentOnly331 },332 completeCopy: {333 description: 'should nyc copy all files from input to output as well as instrumented files?',334 type: 'boolean',335 default: false,336 nycCommands: nycCommands.instrumentOnly337 }338};339const nyc = {340 description: 'nyc configuration options',341 type: 'object',342 properties: {343 cwd,344 nycrcPath,345 tempDir,346 /* Test Exclude */347 ...testExclude,348 /* Instrumentation settings */349 ...instrumentVisitor,350 /* Instrumentation parser/generator settings */351 ...instrumentParseGen,352 sourceMap: {353 description: 'should nyc detect and handle source maps?',354 type: 'boolean',355 default: true,356 nycCommands: nycCommands.instrument357 },358 require: {359 description: 'a list of additional modules that nyc should attempt to require in its subprocess, e.g., @babel/register, @babel/polyfill',360 type: 'array',361 items: {362 type: 'string'363 },364 default: [],365 nycCommands: nycCommands.instrument,366 nycAlias: 'i'367 },368 instrument: {369 description: 'should nyc handle instrumentation?',370 type: 'boolean',371 default: true,372 nycCommands: nycCommands.instrument373 },374 /* Check coverage */375 ...checkCoverage,376 /* Report options */377 ...report,378 /* Main command options */379 ...nycMain,380 /* Instrument command options */381 ...instrumentOnly382 }383};384const configs = {385 nyc,386 testExclude: {387 description: 'test-exclude options',388 type: 'object',389 properties: {390 cwd,391 ...testExclude392 }393 },394 babelPluginIstanbul: {395 description: 'babel-plugin-istanbul options',396 type: 'object',397 properties: {398 cwd,399 ...testExclude,400 ...instrumentVisitor401 }402 },403 instrumentVisitor: {404 description: 'instrument visitor options',405 type: 'object',406 properties: instrumentVisitor407 },408 instrumenter: {409 description: 'stand-alone instrumenter options',410 type: 'object',411 properties: {412 ...instrumentVisitor,413 ...instrumentParseGen414 }415 }416};417function defaultsReducer(defaults, [name, {default: value}]) {418 /* Modifying arrays in defaults is safe, does not change schema. */419 if (Array.isArray(value)) {420 value = [...value];421 }422 return Object.assign(defaults, {[name]: value});423}424module.exports = {425 ...configs,426 defaults: Object.keys(configs).reduce(427 (defaults, id) => {428 Object.defineProperty(defaults, id, {429 enumerable: true,430 get() {431 /* This defers `process.cwd()` until defaults are requested. */432 return Object.entries(configs[id].properties)433 .filter(([, info]) => 'default' in info)434 .reduce(defaultsReducer, {});435 }436 });437 return defaults;438 },439 {}440 )...

Full Screen

Full Screen

f36.py

Source:f36.py Github

copy

Full Screen

1#2# Copyright 2021 Red Hat, Inc.3#4# This copyrighted material is made available to anyone wishing to use, modify,5# copy, or redistribute it subject to the terms and conditions of the GNU6# General Public License v.2. This program is distributed in the hope that it7# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the8# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.9# See the GNU General Public License for more details.10#11# You should have received a copy of the GNU General Public License along with12# this program; if not, write to the Free Software Foundation, Inc., 5113# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat14# trademarks that are incorporated in the source code or documentation are not15# subject to the GNU General Public License and may only be used or replicated16# with the express permission of Red Hat, Inc.17#18__all__ = ["F36Handler"]19from pykickstart import commands20from pykickstart.base import BaseHandler21from pykickstart.version import F3622class F36Handler(BaseHandler):23 version = F3624 commandMap = {25 "auth": commands.authconfig.F35_Authconfig, # RemovedCommand26 "authconfig": commands.authconfig.F35_Authconfig, # RemovedCommand27 "authselect": commands.authselect.F28_Authselect,28 "autopart": commands.autopart.F29_AutoPart,29 "autostep": commands.autostep.F34_AutoStep,30 "bootloader": commands.bootloader.F34_Bootloader,31 "btrfs": commands.btrfs.F23_BTRFS,32 "cdrom": commands.cdrom.FC3_Cdrom,33 "clearpart": commands.clearpart.F28_ClearPart,34 "cmdline": commands.displaymode.F26_DisplayMode,35 "device": commands.device.F34_Device,36 "deviceprobe": commands.deviceprobe.F34_DeviceProbe,37 "dmraid": commands.dmraid.F34_DmRaid,38 "driverdisk": commands.driverdisk.F14_DriverDisk,39 "module": commands.module.F31_Module,40 "eula": commands.eula.F20_Eula,41 "fcoe": commands.fcoe.F28_Fcoe,42 "firewall": commands.firewall.F28_Firewall,43 "firstboot": commands.firstboot.FC3_Firstboot,44 "graphical": commands.displaymode.F26_DisplayMode,45 "group": commands.group.F12_Group,46 "halt": commands.reboot.F23_Reboot,47 "harddrive": commands.harddrive.F33_HardDrive,48 "hmc": commands.hmc.F28_Hmc,49 "ignoredisk": commands.ignoredisk.F34_IgnoreDisk,50 "install": commands.install.F34_Install,51 "iscsi": commands.iscsi.F17_Iscsi,52 "iscsiname": commands.iscsiname.FC6_IscsiName,53 "keyboard": commands.keyboard.F18_Keyboard,54 "lang": commands.lang.F19_Lang,55 "liveimg": commands.liveimg.F19_Liveimg,56 "logging": commands.logging.F34_Logging,57 "logvol": commands.logvol.F29_LogVol,58 "mediacheck": commands.mediacheck.FC4_MediaCheck,59 "method": commands.method.F34_Method,60 "mount": commands.mount.F27_Mount,61 "multipath": commands.multipath.F34_MultiPath,62 "network": commands.network.F27_Network,63 "nfs": commands.nfs.FC6_NFS,64 "nvdimm": commands.nvdimm.F28_Nvdimm,65 "timesource": commands.timesource.F33_Timesource,66 "ostreesetup": commands.ostreesetup.F21_OSTreeSetup,67 "part": commands.partition.F34_Partition,68 "partition": commands.partition.F34_Partition,69 "poweroff": commands.reboot.F23_Reboot,70 "raid": commands.raid.F29_Raid,71 "realm": commands.realm.F19_Realm,72 "reboot": commands.reboot.F23_Reboot,73 "repo": commands.repo.F33_Repo,74 "reqpart": commands.reqpart.F23_ReqPart,75 "rescue": commands.rescue.F10_Rescue,76 "rootpw": commands.rootpw.F18_RootPw,77 "selinux": commands.selinux.FC3_SELinux,78 "services": commands.services.FC6_Services,79 "shutdown": commands.reboot.F23_Reboot,80 "skipx": commands.skipx.FC3_SkipX,81 "snapshot": commands.snapshot.F26_Snapshot,82 "sshpw": commands.sshpw.F24_SshPw,83 "sshkey": commands.sshkey.F22_SshKey,84 "text": commands.displaymode.F26_DisplayMode,85 "timezone": commands.timezone.F33_Timezone,86 "updates": commands.updates.F34_Updates,87 "url": commands.url.F30_Url,88 "user": commands.user.F24_User,89 "vnc": commands.vnc.F9_Vnc,90 "volgroup": commands.volgroup.F21_VolGroup,91 "xconfig": commands.xconfig.F14_XConfig,92 "zerombr": commands.zerombr.F9_ZeroMbr,93 "zfcp": commands.zfcp.F14_ZFCP,94 "zipl": commands.zipl.F32_Zipl,95 }96 dataMap = {97 "BTRFSData": commands.btrfs.F23_BTRFSData,98 "DriverDiskData": commands.driverdisk.F14_DriverDiskData,99 "DeviceData": commands.device.F8_DeviceData,100 "DmRaidData": commands.dmraid.FC6_DmRaidData,101 "ModuleData": commands.module.F31_ModuleData,102 "TimesourceData": commands.timesource.F33_TimesourceData,103 "FcoeData": commands.fcoe.F28_FcoeData,104 "GroupData": commands.group.F12_GroupData,105 "IscsiData": commands.iscsi.F17_IscsiData,106 "LogVolData": commands.logvol.F29_LogVolData,107 "MountData": commands.mount.F27_MountData,108 "MultiPathData": commands.multipath.FC6_MultiPathData,109 "NetworkData": commands.network.F27_NetworkData,110 "NvdimmData": commands.nvdimm.F28_NvdimmData,111 "PartData": commands.partition.F29_PartData,112 "RaidData": commands.raid.F29_RaidData,113 "RepoData": commands.repo.F30_RepoData,114 "SnapshotData": commands.snapshot.F26_SnapshotData,115 "SshPwData": commands.sshpw.F24_SshPwData,116 "SshKeyData": commands.sshkey.F22_SshKeyData,117 "UserData": commands.user.F19_UserData,118 "VolGroupData": commands.volgroup.F21_VolGroupData,119 "ZFCPData": commands.zfcp.F14_ZFCPData,...

Full Screen

Full Screen

f35.py

Source:f35.py Github

copy

Full Screen

1#2# Copyright 2021 Red Hat, Inc.3#4# This copyrighted material is made available to anyone wishing to use, modify,5# copy, or redistribute it subject to the terms and conditions of the GNU6# General Public License v.2. This program is distributed in the hope that it7# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the8# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.9# See the GNU General Public License for more details.10#11# You should have received a copy of the GNU General Public License along with12# this program; if not, write to the Free Software Foundation, Inc., 5113# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat14# trademarks that are incorporated in the source code or documentation are not15# subject to the GNU General Public License and may only be used or replicated16# with the express permission of Red Hat, Inc.17#18__all__ = ["F35Handler"]19from pykickstart import commands20from pykickstart.base import BaseHandler21from pykickstart.version import F3522class F35Handler(BaseHandler):23 version = F3524 commandMap = {25 "auth": commands.authconfig.F35_Authconfig, # RemovedCommand26 "authconfig": commands.authconfig.F35_Authconfig, # RemovedCommand27 "authselect": commands.authselect.F28_Authselect,28 "autopart": commands.autopart.F29_AutoPart,29 "autostep": commands.autostep.F34_AutoStep,30 "bootloader": commands.bootloader.F34_Bootloader,31 "btrfs": commands.btrfs.F23_BTRFS,32 "cdrom": commands.cdrom.FC3_Cdrom,33 "clearpart": commands.clearpart.F28_ClearPart,34 "cmdline": commands.displaymode.F26_DisplayMode,35 "device": commands.device.F34_Device,36 "deviceprobe": commands.deviceprobe.F34_DeviceProbe,37 "dmraid": commands.dmraid.F34_DmRaid,38 "driverdisk": commands.driverdisk.F14_DriverDisk,39 "module": commands.module.F31_Module,40 "eula": commands.eula.F20_Eula,41 "fcoe": commands.fcoe.F28_Fcoe,42 "firewall": commands.firewall.F28_Firewall,43 "firstboot": commands.firstboot.FC3_Firstboot,44 "graphical": commands.displaymode.F26_DisplayMode,45 "group": commands.group.F12_Group,46 "halt": commands.reboot.F23_Reboot,47 "harddrive": commands.harddrive.F33_HardDrive,48 "hmc": commands.hmc.F28_Hmc,49 "ignoredisk": commands.ignoredisk.F34_IgnoreDisk,50 "install": commands.install.F34_Install,51 "iscsi": commands.iscsi.F17_Iscsi,52 "iscsiname": commands.iscsiname.FC6_IscsiName,53 "keyboard": commands.keyboard.F18_Keyboard,54 "lang": commands.lang.F19_Lang,55 "liveimg": commands.liveimg.F19_Liveimg,56 "logging": commands.logging.F34_Logging,57 "logvol": commands.logvol.F29_LogVol,58 "mediacheck": commands.mediacheck.FC4_MediaCheck,59 "method": commands.method.F34_Method,60 "mount": commands.mount.F27_Mount,61 "multipath": commands.multipath.F34_MultiPath,62 "network": commands.network.F27_Network,63 "nfs": commands.nfs.FC6_NFS,64 "nvdimm": commands.nvdimm.F28_Nvdimm,65 "timesource": commands.timesource.F33_Timesource,66 "ostreesetup": commands.ostreesetup.F21_OSTreeSetup,67 "part": commands.partition.F34_Partition,68 "partition": commands.partition.F34_Partition,69 "poweroff": commands.reboot.F23_Reboot,70 "raid": commands.raid.F29_Raid,71 "realm": commands.realm.F19_Realm,72 "reboot": commands.reboot.F23_Reboot,73 "repo": commands.repo.F33_Repo,74 "reqpart": commands.reqpart.F23_ReqPart,75 "rescue": commands.rescue.F10_Rescue,76 "rootpw": commands.rootpw.F18_RootPw,77 "selinux": commands.selinux.FC3_SELinux,78 "services": commands.services.FC6_Services,79 "shutdown": commands.reboot.F23_Reboot,80 "skipx": commands.skipx.FC3_SkipX,81 "snapshot": commands.snapshot.F26_Snapshot,82 "sshpw": commands.sshpw.F24_SshPw,83 "sshkey": commands.sshkey.F22_SshKey,84 "text": commands.displaymode.F26_DisplayMode,85 "timezone": commands.timezone.F33_Timezone,86 "updates": commands.updates.F34_Updates,87 "url": commands.url.F30_Url,88 "user": commands.user.F24_User,89 "vnc": commands.vnc.F9_Vnc,90 "volgroup": commands.volgroup.F21_VolGroup,91 "xconfig": commands.xconfig.F14_XConfig,92 "zerombr": commands.zerombr.F9_ZeroMbr,93 "zfcp": commands.zfcp.F14_ZFCP,94 "zipl": commands.zipl.F32_Zipl,95 }96 dataMap = {97 "BTRFSData": commands.btrfs.F23_BTRFSData,98 "DriverDiskData": commands.driverdisk.F14_DriverDiskData,99 "DeviceData": commands.device.F8_DeviceData,100 "DmRaidData": commands.dmraid.FC6_DmRaidData,101 "ModuleData": commands.module.F31_ModuleData,102 "TimesourceData": commands.timesource.F33_TimesourceData,103 "FcoeData": commands.fcoe.F28_FcoeData,104 "GroupData": commands.group.F12_GroupData,105 "IscsiData": commands.iscsi.F17_IscsiData,106 "LogVolData": commands.logvol.F29_LogVolData,107 "MountData": commands.mount.F27_MountData,108 "MultiPathData": commands.multipath.FC6_MultiPathData,109 "NetworkData": commands.network.F27_NetworkData,110 "NvdimmData": commands.nvdimm.F28_NvdimmData,111 "PartData": commands.partition.F29_PartData,112 "RaidData": commands.raid.F29_RaidData,113 "RepoData": commands.repo.F30_RepoData,114 "SnapshotData": commands.snapshot.F26_SnapshotData,115 "SshPwData": commands.sshpw.F24_SshPwData,116 "SshKeyData": commands.sshkey.F22_SshKeyData,117 "UserData": commands.user.F19_UserData,118 "VolGroupData": commands.volgroup.F21_VolGroupData,119 "ZFCPData": commands.zfcp.F14_ZFCPData,...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful