How to use d.reset method in Appium Base Driver

Best JavaScript code snippet using appium-base-driver

oobe_screen_reset.js

Source:oobe_screen_reset.js Github

copy

Full Screen

1// Copyright (c) 2012 The Chromium Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4/**5 * @fileoverview Device reset screen implementation.6 */7login.createScreen('ResetScreen', 'reset', function() {8 var USER_ACTION_CANCEL_RESET = 'cancel-reset';9 var USER_ACTION_RESTART_PRESSED = 'restart-pressed';10 var USER_ACTION_LEARN_MORE_PRESSED = 'learn-more-link';11 var USER_ACTION_SHOW_CONFIRMATION = 'show-confirmation';12 var USER_ACTION_POWERWASH_PRESSED = 'powerwash-pressed';13 var USER_ACTION_RESET_CONFIRM_DISMISSED = 'reset-confirm-dismissed';14 var CONTEXT_KEY_ROLLBACK_AVAILABLE = 'rollback-available';15 var CONTEXT_KEY_ROLLBACK_CHECKED = 'rollback-checked';16 var CONTEXT_KEY_IS_OFFICIAL_BUILD = 'is-official-build';17 var CONTEXT_KEY_IS_CONFIRMATIONAL_VIEW = 'is-confirmational-view';18 var CONTEXT_KEY_SCREEN_STATE = 'screen-state';19 return {20 /* Possible UI states of the reset screen. */21 RESET_SCREEN_UI_STATE: {22 REVERT_PROMISE: 'ui-state-revert-promise',23 RESTART_REQUIRED: 'ui-state-restart-required',24 POWERWASH_PROPOSAL: 'ui-state-powerwash-proposal',25 ROLLBACK_PROPOSAL: 'ui-state-rollback-proposal',26 ERROR: 'ui-state-error',27 },28 RESET_SCREEN_STATE: {29 RESTART_REQUIRED: 0,30 REVERT_PROMISE: 1,31 POWERWASH_PROPOSAL: 2, // supports 2 ui-states32 ERROR: 3,33 },34 /** @override */35 decorate: function() {36 var self = this;37 this.declareUserAction($('powerwash-help-link'),38 { action_id: USER_ACTION_LEARN_MORE_PRESSED,39 event: 'click'40 });41 this.declareUserAction($('reset-confirm-dismiss'),42 { action_id: USER_ACTION_RESET_CONFIRM_DISMISSED,43 event: 'click'44 });45 this.declareUserAction($('reset-confirm-commit'),46 { action_id: USER_ACTION_POWERWASH_PRESSED,47 event: 'click'48 });49 this.context.addObserver(50 CONTEXT_KEY_SCREEN_STATE,51 function(state) {52 if (state == self.RESET_SCREEN_STATE.RESTART_REQUIRED)53 self.ui_state = self.RESET_SCREEN_UI_STATE.RESTART_REQUIRED;54 if (state == self.RESET_SCREEN_STATE.REVERT_PROMISE)55 self.ui_state = self.RESET_SCREEN_UI_STATE.REVERT_PROMISE;56 else if (state == self.RESET_SCREEN_STATE.POWERWASH_PROPOSAL)57 self.ui_state = self.RESET_SCREEN_UI_STATE.POWERWASH_PROPOSAL;58 self.setDialogView_();59 if (state == self.RESET_SCREEN_STATE.REVERT_PROMISE) {60 announceAccessibleMessage(61 loadTimeData.getString('resetRevertSpinnerMessage'));62 }63 }64 );65 this.context.addObserver(66 CONTEXT_KEY_IS_OFFICIAL_BUILD,67 function(isOfficial) {68 $('powerwash-help-link').setAttribute('hidden', !isOfficial);69 }70 );71 this.context.addObserver(72 CONTEXT_KEY_ROLLBACK_CHECKED,73 function(rollbackChecked) {74 self.setRollbackOptionView();75 }76 );77 this.context.addObserver(78 CONTEXT_KEY_ROLLBACK_AVAILABLE,79 function(rollbackAvailable) {80 self.setRollbackOptionView();81 }82 );83 this.context.addObserver(84 CONTEXT_KEY_IS_CONFIRMATIONAL_VIEW,85 function(is_confirmational) {86 if (is_confirmational) {87 console.log(self.context.get(CONTEXT_KEY_SCREEN_STATE, 0));88 if (self.context.get(CONTEXT_KEY_SCREEN_STATE, 0) !=89 self.RESET_SCREEN_STATE.POWERWASH_PROPOSAL)90 return;91 console.log(self);92 reset.ConfirmResetOverlay.getInstance().initializePage();93 } else {94 $('overlay-reset').setAttribute('hidden', true);95 }96 }97 );98 },99 /**100 * Header text of the screen.101 * @type {string}102 */103 get header() {104 return loadTimeData.getString('resetScreenTitle');105 },106 /**107 * Buttons in oobe wizard's button strip.108 * @type {array} Array of Buttons.109 */110 get buttons() {111 var buttons = [];112 var restartButton = this.ownerDocument.createElement('button');113 restartButton.id = 'reset-restart-button';114 restartButton.textContent = loadTimeData.getString('resetButtonRestart');115 this.declareUserAction(restartButton,116 { action_id: USER_ACTION_RESTART_PRESSED,117 event: 'click'118 });119 buttons.push(restartButton);120 // Button that leads to confirmation pop-up dialog.121 var toConfirmButton = this.ownerDocument.createElement('button');122 toConfirmButton.id = 'reset-toconfirm-button';123 toConfirmButton.textContent =124 loadTimeData.getString('resetButtonPowerwash');125 this.declareUserAction(toConfirmButton,126 { action_id: USER_ACTION_SHOW_CONFIRMATION,127 event: 'click'128 });129 buttons.push(toConfirmButton);130 var cancelButton = this.ownerDocument.createElement('button');131 cancelButton.id = 'reset-cancel-button';132 cancelButton.textContent = loadTimeData.getString('cancelButton');133 this.declareUserAction(cancelButton,134 { action_id: USER_ACTION_CANCEL_RESET,135 event: 'click'136 });137 buttons.push(cancelButton);138 return buttons;139 },140 /**141 * Returns a control which should receive an initial focus.142 */143 get defaultControl() {144 // choose145 if (this.context.get(CONTEXT_KEY_SCREEN_STATE,146 this.RESET_SCREEN_STATE.RESTART_REQUIRED) ==147 this.RESET_SCREEN_STATE.RESTART_REQUIRED)148 return $('reset-restart-button');149 if (this.context.get(CONTEXT_KEY_IS_CONFIRMATIONAL_VIEW, false))150 return $('reset-confirm-commit');151 return $('reset-toconfirm-button');152 },153 /**154 * Cancels the reset and drops the user back to the login screen.155 */156 cancel: function() {157 if (this.context.get(CONTEXT_KEY_IS_CONFIRMATIONAL_VIEW, false)) {158 $('reset').send(login.Screen.CALLBACK_USER_ACTED,159 USER_ACTION_RESET_CONFIRM_DISMISSED);160 return;161 }162 this.send(login.Screen.CALLBACK_USER_ACTED, USER_ACTION_CANCEL_RESET);163 },164 /**165 * Event handler that is invoked just before the screen in shown.166 * @param {Object} data Screen init payload.167 */168 onBeforeShow: function(data) {169 },170 /**171 * Sets css style for corresponding state of the screen.172 * @private173 */174 setDialogView_: function(state) {175 state = this.ui_state;176 var resetOverlay = $('reset-confirm-overlay');177 this.classList.toggle(178 'revert-promise-view',179 state == this.RESET_SCREEN_UI_STATE.REVERT_PROMISE);180 this.classList.toggle(181 'restart-required-view',182 state == this.RESET_SCREEN_UI_STATE.RESTART_REQUIRED);183 this.classList.toggle(184 'powerwash-proposal-view',185 state == this.RESET_SCREEN_UI_STATE.POWERWASH_PROPOSAL);186 resetOverlay.classList.toggle(187 'powerwash-proposal-view',188 state == this.RESET_SCREEN_UI_STATE.POWERWASH_PROPOSAL);189 this.classList.toggle(190 'rollback-proposal-view',191 state == this.RESET_SCREEN_UI_STATE.ROLLBACK_PROPOSAL);192 resetOverlay.classList.toggle(193 'rollback-proposal-view',194 state == this.RESET_SCREEN_UI_STATE.ROLLBACK_PROPOSAL);195 },196 setRollbackOptionView: function() {197 if (this.context.get(CONTEXT_KEY_IS_CONFIRMATIONAL_VIEW, false))198 return;199 if (this.context.get(CONTEXT_KEY_SCREEN_STATE) !=200 this.RESET_SCREEN_STATE.POWERWASH_PROPOSAL)201 return;202 if (this.context.get(CONTEXT_KEY_ROLLBACK_AVAILABLE, false) &&203 this.context.get(CONTEXT_KEY_ROLLBACK_CHECKED, false)) {204 // show rollback option205 $('reset-toconfirm-button').textContent = loadTimeData.getString(206 'resetButtonPowerwashAndRollback');207 this.ui_state = this.RESET_SCREEN_UI_STATE.ROLLBACK_PROPOSAL;208 } else {209 // hide rollback option210 $('reset-toconfirm-button').textContent = loadTimeData.getString(211 'resetButtonPowerwash');212 this.ui_state = this.RESET_SCREEN_UI_STATE.POWERWASH_PROPOSAL;213 }214 this.setDialogView_();215 }216 };...

Full Screen

Full Screen

reset.js

Source:reset.js Github

copy

Full Screen

1'use strict';2require('colors');3var path = require('path');4var winston = require('winston');5var async = require('async');6var fs = require('fs');7var db = require('../database');8var events = require('../events');9var meta = require('../meta');10var plugins = require('../plugins');11var widgets = require('../widgets');12var dirname = require('./paths').baseDir;13var themeNamePattern = /^(@.*?\/)?nodebb-theme-.*$/;14var pluginNamePattern = /^(@.*?\/)?nodebb-(theme|plugin|widget|rewards)-.*$/;15exports.reset = function (options, callback) {16 var map = {17 theme: function (next) {18 var themeId = options.theme;19 if (themeId === true) {20 resetThemes(next);21 } else {22 if (!themeNamePattern.test(themeId)) {23 // Allow omission of `nodebb-theme-`24 themeId = 'nodebb-theme-' + themeId;25 }26 resetTheme(themeId, next);27 }28 },29 plugin: function (next) {30 var pluginId = options.plugin;31 if (pluginId === true) {32 resetPlugins(next);33 } else {34 if (!pluginNamePattern.test(pluginId)) {35 // Allow omission of `nodebb-plugin-`36 pluginId = 'nodebb-plugin-' + pluginId;37 }38 resetPlugin(pluginId, next);39 }40 },41 widgets: resetWidgets,42 settings: resetSettings,43 all: function (next) {44 async.series([resetWidgets, resetThemes, resetPlugins, resetSettings], next);45 },46 };47 var tasks = Object.keys(map)48 .filter(function (x) { return options[x]; })49 .map(function (x) { return map[x]; });50 if (!tasks.length) {51 console.log([52 'No arguments passed in, so nothing was reset.\n'.yellow,53 'Use ./nodebb reset ' + '{-t|-p|-w|-s|-a}'.red,54 ' -t\tthemes',55 ' -p\tplugins',56 ' -w\twidgets',57 ' -s\tsettings',58 ' -a\tall of the above',59 '',60 'Plugin and theme reset flags (-p & -t) can take a single argument',61 ' e.g. ./nodebb reset -p nodebb-plugin-mentions, ./nodebb reset -t nodebb-theme-persona',62 ' Prefix is optional, e.g. ./nodebb reset -p markdown, ./nodebb reset -t persona',63 ].join('\n'));64 process.exit(0);65 }66 async.series([db.init].concat(tasks), function (err) {67 if (err) {68 winston.error('[reset] Errors were encountered during reset', err);69 throw err;70 }71 winston.info('[reset] Reset complete');72 callback();73 });74};75function resetSettings(callback) {76 meta.configs.set('allowLocalLogin', 1, function (err) {77 winston.info('[reset] Settings reset to default');78 callback(err);79 });80}81function resetTheme(themeId, callback) {82 fs.access(path.join(dirname, 'node_modules', themeId, 'package.json'), function (err) {83 if (err) {84 winston.warn('[reset] Theme `%s` is not installed on this forum', themeId);85 callback(new Error('theme-not-found'));86 } else {87 meta.themes.set({88 type: 'local',89 id: themeId,90 }, function (err) {91 if (err) {92 winston.warn('[reset] Failed to reset theme to ' + themeId);93 } else {94 winston.info('[reset] Theme reset to ' + themeId);95 }96 callback();97 });98 }99 });100}101function resetThemes(callback) {102 meta.themes.set({103 type: 'local',104 id: 'nodebb-theme-persona',105 }, function (err) {106 winston.info('[reset] Theme reset to Persona');107 callback(err);108 });109}110function resetPlugin(pluginId, callback) {111 var active = false;112 async.waterfall([113 async.apply(db.isSortedSetMember, 'plugins:active', pluginId),114 function (isMember, next) {115 active = isMember;116 if (isMember) {117 db.sortedSetRemove('plugins:active', pluginId, next);118 } else {119 next();120 }121 },122 function (next) {123 events.log({124 type: 'plugin-deactivate',125 text: pluginId,126 }, next);127 },128 ], function (err) {129 if (err) {130 winston.error('[reset] Could not disable plugin: %s encountered error %s', pluginId, err);131 } else if (active) {132 winston.info('[reset] Plugin `%s` disabled', pluginId);133 } else {134 winston.warn('[reset] Plugin `%s` was not active on this forum', pluginId);135 winston.info('[reset] No action taken.');136 err = new Error('plugin-not-active');137 }138 callback(err);139 });140}141function resetPlugins(callback) {142 db.delete('plugins:active', function (err) {143 winston.info('[reset] All Plugins De-activated');144 callback(err);145 });146}147function resetWidgets(callback) {148 async.waterfall([149 plugins.reload,150 widgets.reset,151 function (next) {152 winston.info('[reset] All Widgets moved to Draft Zone');153 next();154 },155 ], callback);...

Full Screen

Full Screen

reset_profile_settings_overlay.js

Source:reset_profile_settings_overlay.js Github

copy

Full Screen

1// Copyright 2013 The Chromium Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4cr.define('options', function() {5 var Page = cr.ui.pageManager.Page;6 var AutomaticSettingsResetBanner = options.AutomaticSettingsResetBanner;7 var ResetProfileSettingsBanner = options.ResetProfileSettingsBanner;8 /**9 * ResetProfileSettingsOverlay class10 * Encapsulated handling of the 'Reset Profile Settings' overlay page.11 * @class12 */13 function ResetProfileSettingsOverlay() {14 Page.call(this, 'resetProfileSettings',15 loadTimeData.getString('resetProfileSettingsOverlayTabTitle'),16 'reset-profile-settings-overlay');17 }18 cr.addSingletonGetter(ResetProfileSettingsOverlay);19 ResetProfileSettingsOverlay.prototype = {20 // Inherit ResetProfileSettingsOverlay from Page.21 __proto__: Page.prototype,22 /** @override */23 initializePage: function() {24 Page.prototype.initializePage.call(this);25 $('reset-profile-settings-dismiss').onclick = function(e) {26 ResetProfileSettingsOverlay.dismiss();27 };28 $('reset-profile-settings-commit').onclick = function(e) {29 ResetProfileSettingsOverlay.setResettingState(true);30 chrome.send('performResetProfileSettings',31 [$('send-settings').checked]);32 };33 $('expand-feedback').onclick = function(e) {34 var feedbackTemplate = $('feedback-template');35 feedbackTemplate.hidden = !feedbackTemplate.hidden;36 e.preventDefault();37 };38 },39 /**40 * @override41 * @suppress {checkTypes}42 * TODO(vitalyp): remove the suppression. See the explanation in43 * chrome/browser/resources/options/automatic_settings_reset_banner.js.44 */45 didShowPage: function() {46 ResetProfileSettingsBanner.dismiss();47 chrome.send('onShowResetProfileDialog');48 },49 /** @override */50 didClosePage: function() {51 chrome.send('onHideResetProfileDialog');52 },53 };54 /**55 * Enables/disables UI elements after/while Chrome is performing a reset.56 * @param {boolean} state If true, UI elements are disabled.57 */58 ResetProfileSettingsOverlay.setResettingState = function(state) {59 $('reset-profile-settings-throbber').style.visibility =60 state ? 'visible' : 'hidden';61 $('reset-profile-settings-dismiss').disabled = state;62 $('reset-profile-settings-commit').disabled = state;63 };64 /**65 * Chrome callback to notify ResetProfileSettingsOverlay that the reset66 * operation has terminated.67 * @suppress {checkTypes}68 * TODO(vitalyp): remove the suppression. See the explanation in69 * chrome/browser/resources/options/automatic_settings_reset_banner.js.70 */71 ResetProfileSettingsOverlay.doneResetting = function() {72 AutomaticSettingsResetBanner.dismiss();73 ResetProfileSettingsOverlay.dismiss();74 };75 /**76 * Dismisses the overlay.77 */78 ResetProfileSettingsOverlay.dismiss = function() {79 PageManager.closeOverlay();80 ResetProfileSettingsOverlay.setResettingState(false);81 };82 ResetProfileSettingsOverlay.setFeedbackInfo = function(feedbackListData) {83 var input = new JsEvalContext(feedbackListData);84 var output = $('feedback-template');85 jstProcess(input, output);86 };87 // Export88 return {89 ResetProfileSettingsOverlay: ResetProfileSettingsOverlay90 };...

Full Screen

Full Screen

automatic_settings_reset_banner.js

Source:automatic_settings_reset_banner.js Github

copy

Full Screen

1// Copyright 2014 The Chromium Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4// Note: the native-side handler for this is AutomaticSettingsResetHandler.5cr.define('options', function() {6 /** @const */ var SettingsBannerBase = options.SettingsBannerBase;7 /** @const */ var PageManager = cr.ui.pageManager.PageManager;8 /**9 * AutomaticSettingsResetBanner class10 * Provides encapsulated handling of the Reset Profile Settings banner.11 * @constructor12 * @extends {options.SettingsBannerBase}13 */14 function AutomaticSettingsResetBanner() {}15 cr.addSingletonGetter(AutomaticSettingsResetBanner);16 AutomaticSettingsResetBanner.prototype = {17 __proto__: SettingsBannerBase.prototype,18 /**19 * Initializes the banner's event handlers.20 * @suppress {checkTypes}21 * TODO(vitalyp): remove the suppression. Suppression is needed because22 * method dismiss() is attached to AutomaticSettingsResetBanner at run-time23 * via "Forward public APIs to protected implementations" pattern (see24 * below). Currently the compiler pass and cr.js handles only forwarding to25 * private implementations using cr.makePublic().26 */27 initialize: function() {28 this.showMetricName = 'AutomaticSettingsReset_WebUIBanner_BannerShown';29 this.dismissNativeCallbackName =30 'onDismissedAutomaticSettingsResetBanner';31 this.visibilityDomElement = $('automatic-settings-reset-banner');32 $('automatic-settings-reset-banner-close').onclick = function(event) {33 chrome.send('metricsHandler:recordAction',34 ['AutomaticSettingsReset_WebUIBanner_ManuallyClosed']);35 AutomaticSettingsResetBanner.dismiss();36 };37 $('automatic-settings-reset-learn-more').onclick = function(event) {38 chrome.send('metricsHandler:recordAction',39 ['AutomaticSettingsReset_WebUIBanner_LearnMoreClicked']);40 };41 $('automatic-settings-reset-banner-activate-reset').onclick =42 function(event) {43 chrome.send('metricsHandler:recordAction',44 ['AutomaticSettingsReset_WebUIBanner_ResetClicked']);45 PageManager.showPageByName('resetProfileSettings');46 };47 },48 };49 // Forward public APIs to protected implementations.50 [51 'show',52 'dismiss',53 ].forEach(function(name) {54 AutomaticSettingsResetBanner[name] = function() {55 var instance = AutomaticSettingsResetBanner.getInstance();56 return instance[name].apply(instance, arguments);57 };58 });59 // Export60 return {61 AutomaticSettingsResetBanner: AutomaticSettingsResetBanner62 };...

Full Screen

Full Screen

reset_profile_settings_banner.js

Source:reset_profile_settings_banner.js Github

copy

Full Screen

1// Copyright 2013 The Chromium Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4// Note: the native-side handler for this is ResetProfileSettingsHandler.5cr.define('options', function() {6 /** @const */ var PageManager = cr.ui.pageManager.PageManager;7 /** @const */ var SettingsBannerBase = options.SettingsBannerBase;8 /**9 * ResetProfileSettingsBanner class10 * Provides encapsulated handling of the Reset Profile Settings banner.11 * @constructor12 * @extends {options.SettingsBannerBase}13 */14 function ResetProfileSettingsBanner() {}15 cr.addSingletonGetter(ResetProfileSettingsBanner);16 ResetProfileSettingsBanner.prototype = {17 __proto__: SettingsBannerBase.prototype,18 /**19 * Initializes the banner's event handlers.20 * @suppress {checkTypes}21 * TODO(vitalyp): remove the suppression. See the explanation in22 * chrome/browser/resources/options/automatic_settings_reset_banner.js.23 */24 initialize: function() {25 this.showMetricName = 'AutomaticReset_WebUIBanner_BannerShown';26 this.dismissNativeCallbackName =27 'onDismissedResetProfileSettingsBanner';28 this.visibilityDomElement = $('reset-profile-settings-banner');29 $('reset-profile-settings-banner-close').onclick = function(event) {30 chrome.send('metricsHandler:recordAction',31 ['AutomaticReset_WebUIBanner_ManuallyClosed']);32 ResetProfileSettingsBanner.dismiss();33 };34 $('reset-profile-settings-banner-activate').onclick = function(event) {35 chrome.send('metricsHandler:recordAction',36 ['AutomaticReset_WebUIBanner_ResetClicked']);37 PageManager.showPageByName('resetProfileSettings');38 };39 },40 };41 // Forward public APIs to protected implementations.42 [43 'show',44 'dismiss',45 ].forEach(function(name) {46 ResetProfileSettingsBanner[name] = function() {47 var instance = ResetProfileSettingsBanner.getInstance();48 return instance[name].apply(instance, arguments);49 };50 });51 // Export52 return {53 ResetProfileSettingsBanner: ResetProfileSettingsBanner54 };...

Full Screen

Full Screen

PasswordResetPage.duck.js

Source:PasswordResetPage.duck.js Github

copy

Full Screen

1import { storableError } from '../../util/errors';2// ================ Action types ================ //3export const RESET_PASSWORD_REQUEST = 'app/PasswordResetPage/RESET_PASSWORD_REQUEST';4export const RESET_PASSWORD_SUCCESS = 'app/PasswordResetPage/RESET_PASSWORD_SUCCESS';5export const RESET_PASSWORD_ERROR = 'app/PasswordResetPage/RESET_PASSWORD_ERROR';6// ================ Reducer ================ //7const initialState = {8 resetPasswordInProgress: false,9 resetPasswordError: null,10};11export default function reducer(state = initialState, action = {}) {12 const { type, payload } = action;13 switch (type) {14 case RESET_PASSWORD_REQUEST:15 return { ...state, resetPasswordInProgress: true, resetPasswordError: null };16 case RESET_PASSWORD_SUCCESS:17 return { ...state, resetPasswordInProgress: false };18 case RESET_PASSWORD_ERROR:19 console.error(payload); // eslint-disable-line no-console20 return { ...state, resetPasswordInProgress: false, resetPasswordError: payload };21 default:22 return state;23 }24}25// ================ Action creators ================ //26export const resetPasswordRequest = () => ({ type: RESET_PASSWORD_REQUEST });27export const resetPasswordSuccess = () => ({ type: RESET_PASSWORD_SUCCESS });28export const resetPasswordError = e => ({29 type: RESET_PASSWORD_ERROR,30 error: true,31 payload: e,32});33// ================ Thunks ================ //34export const resetPassword = (email, passwordResetToken, newPassword) => (35 dispatch,36 getState,37 sdk38) => {39 dispatch(resetPasswordRequest());40 const params = { email, passwordResetToken, newPassword };41 return sdk.passwordReset42 .reset(params)43 .then(() => dispatch(resetPasswordSuccess()))44 .catch(e => dispatch(resetPasswordError(storableError(e))));...

Full Screen

Full Screen

form-reset-mixin.js

Source:form-reset-mixin.js Github

copy

Full Screen

1/*!2 * jQuery UI Form Reset Mixin 1.12.13 * http://jqueryui.com4 *5 * Copyright jQuery Foundation and other contributors6 * Released under the MIT license.7 * http://jquery.org/license8 */9//>>label: Form Reset Mixin10//>>group: Core11//>>description: Refresh input widgets when their form is reset12//>>docs: http://api.jqueryui.com/form-reset-mixin/13( function( factory ) {14 if ( typeof define === "function" && define.amd ) {15 // AMD. Register as an anonymous module.16 define( [17 "jquery",18 "./form",19 "./version"20 ], factory );21 } else {22 // Browser globals23 factory( jQuery );24 }25}( function( $ ) {26return $.ui.formResetMixin = {27 _formResetHandler: function() {28 var form = $( this );29 // Wait for the form reset to actually happen before refreshing30 setTimeout( function() {31 var instances = form.data( "ui-form-reset-instances" );32 $.each( instances, function() {33 this.refresh();34 } );35 } );36 },37 _bindFormResetHandler: function() {38 this.form = this.element.form();39 if ( !this.form.length ) {40 return;41 }42 var instances = this.form.data( "ui-form-reset-instances" ) || [];43 if ( !instances.length ) {44 // We don't use _on() here because we use a single event handler per form45 this.form.on( "reset.ui-form-reset", this._formResetHandler );46 }47 instances.push( this );48 this.form.data( "ui-form-reset-instances", instances );49 },50 _unbindFormResetHandler: function() {51 if ( !this.form.length ) {52 return;53 }54 var instances = this.form.data( "ui-form-reset-instances" );55 instances.splice( $.inArray( this, instances ), 1 );56 if ( instances.length ) {57 this.form.data( "ui-form-reset-instances", instances );58 } else {59 this.form60 .removeData( "ui-form-reset-instances" )61 .off( "reset.ui-form-reset" );62 }63 }64};...

Full Screen

Full Screen

factory_reset_overlay.js

Source:factory_reset_overlay.js Github

copy

Full Screen

1// Copyright (c) 2012 The Chromium Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4cr.define('options', function() {5 var Page = cr.ui.pageManager.Page;6 var PageManager = cr.ui.pageManager.PageManager;7 /**8 * FactoryResetOverlay class9 * Encapsulated handling of the Factory Reset confirmation overlay page.10 * @class11 */12 function FactoryResetOverlay() {13 Page.call(this, 'factoryResetData',14 loadTimeData.getString('factoryResetTitle'),15 'factory-reset-overlay');16 }17 cr.addSingletonGetter(FactoryResetOverlay);18 FactoryResetOverlay.prototype = {19 // Inherit FactoryResetOverlay from Page.20 __proto__: Page.prototype,21 /** @override */22 initializePage: function() {23 Page.prototype.initializePage.call(this);24 $('factory-reset-data-dismiss').onclick = function(event) {25 FactoryResetOverlay.dismiss();26 };27 $('factory-reset-data-restart').onclick = function(event) {28 chrome.send('performFactoryResetRestart');29 };30 },31 };32 FactoryResetOverlay.dismiss = function() {33 PageManager.closeOverlay();34 };35 // Export36 return {37 FactoryResetOverlay: FactoryResetOverlay38 };...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const wd = require('wd');2const chai = require('chai');3const chaiAsPromised = require('chai-as-promised');4chai.use(chaiAsPromised);5chai.should();6chaiAsPromised.transferPromiseness = wd.transferPromiseness;7const { androidCaps, serverConfig } = require('./helpers/caps');8const { APPIUM_SERVER } = require('./helpers/constants');9const { APPIUM_PORT } = require('./helpers/constants');10describe('Appium Base Driver', () => {11 let driver;12 before(async () => {13 driver = await wd.promiseChainRemote(serverConfig);14 await driver.init(androidCaps);15 });16 after(async () => {17 await driver.quit();18 });19 it('should reset the app', async () => {20 await driver.reset();21 });22});23const { APPIUM_SERVER } = require('./constants');24const { APPIUM_PORT } = require('./constants');25const { ANDROID_PLATFORM_VERSION } = require('./constants');26const { ANDROID_DEVICE_NAME } = require('./constants');27const { ANDROID_APP_PACKAGE } = require('./constants');28const { ANDROID_APP_ACTIVITY } = require('./constants');29const androidCaps = {30};31const serverConfig = {32};33module.exports = { androidCaps, serverConfig };

Full Screen

Using AI Code Generation

copy

Full Screen

1const wd = require('wd');2const chai = require('chai');3const chaiAsPromised = require('chai-as-promised');4const chaiShould = chai.should();5const chaiExpect = chai.expect;6chai.use(chaiAsPromised);7const desired = {

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = {3desiredCapabilities: {4}5};6.remote(options)7.init()8.getTitle().then(function(title) {9console.log('Title was: ' + title);10})11.end();12var webdriverio = require('webdriverio');13var options = {14desiredCapabilities: {15}16};17.remote(options)18.init()19.getTitle().then(function(title) {20console.log('Title was: ' + title);21})22.end();23var webdriverio = require('webdriverio');24var options = {25desiredCapabilities: {26}27};28.remote(options)29.init()30.getTitle().then(function(title) {31console.log('Title was: ' + title);32})33.end();34var webdriverio = require('webdriverio');35var options = {36desiredCapabilities: {37}38};39.remote(options)40.init()41.getTitle().then(function(title) {42console.log('Title was: ' + title);43})44.end();45var webdriverio = require('webdriverio');46var options = {47desiredCapabilities: {48}49};50.remote(options)51.init()52.getTitle().then(function(title) {53console.log('Title was: ' + title);54})55.end();56var webdriverio = require('webdriverio');57var options = {58desiredCapabilities: {59}60};61.remote(options)62.init()63.getTitle().then(function(title) {64console.log('Title was: ' + title);65})66.end();67var webdriverio = require('webdriverio');68var options = {69desiredCapabilities: {70}71};72.remote(options)73.init()

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2var driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.android()).build();3driver.reset();4driver.quit();5var webdriverio = require('webdriverio');6var options = {7desiredCapabilities: {8}9};10var client = webdriverio.remote(options);11client.init();12client.reset();13client.init();14client.reset();15client.end();16client.init();17client.reset();18client.end();19client.init();20client.reset();21client.end();22client.init();23client.reset();24client.end();

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Test Appium Base Driver', function() {2 it('should reset Appium Base Driver', function() {3 return driver.reset();4 });5});6describe('Test Appium Base Driver', function() {7 it('should reset Appium Base Driver', function() {8 return driver.reset();9 });10});11describe('Test Appium Base Driver', function() {12 it('should reset Appium Base Driver', function() {13 return driver.reset();14 });15});16describe('Test Appium Base Driver', function() {17 it('should reset Appium Base Driver', function() {18 return driver.reset();19 });20});21describe('Test Appium Base Driver', function() {22 it('should reset Appium Base Driver', function() {23 return driver.reset();24 });25});26describe('Test Appium Base Driver', function() {27 it('should reset Appium Base Driver', function() {28 return driver.reset();29 });30});31describe('Test Appium Base Driver', function() {32 it('should reset Appium Base Driver', function() {33 return driver.reset();34 });35});36describe('Test Appium Base Driver', function() {37 it('should reset Appium Base Driver', function() {38 return driver.reset();39 });40});41describe('Test Appium Base Driver', function() {42 it('should reset Appium Base Driver', function() {43 return driver.reset();44 });45});46describe('Test Appium Base Driver', function() {47 it('should reset Appium Base Driver', function() {48 return driver.reset();49 });50});

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 Appium Base Driver 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