How to use shutdown method in Appium Android Driver

Best JavaScript code snippet using appium-android-driver

test_simple_pref_policies.js

Source:test_simple_pref_policies.js Github

copy

Full Screen

1/* Any copyright is dedicated to the Public Domain.2 * http://creativecommons.org/publicdomain/zero/1.0/ */3"use strict";4/*5 * Use this file to add tests to policies that are6 * simple pref flips.7 *8 * It's best to make a test to actually test the feature9 * instead of the pref flip, but if that feature is well10 * covered by tests, including that its pref actually works,11 * it's OK to have the policy test here just to ensure12 * that the right pref values are set.13 */14const POLICIES_TESTS = [15  /*16   * Example:17   * {18   *   // Policies to be set at once through the engine19   *   policies: { "DisableFoo": true, "ConfigureBar": 42 },20   *21   *   // Locked prefs to check22   *   lockedPrefs: { "feature.foo": false },23   *24   *   // Unlocked prefs to check25   *   unlockedPrefs: { "bar.baz": 42 }26   * },27   */28  // POLICY: RememberPasswords29  {30    policies: { OfferToSaveLogins: false },31    lockedPrefs: { "signon.rememberSignons": false },32  },33  {34    policies: { OfferToSaveLogins: true },35    lockedPrefs: { "signon.rememberSignons": true },36  },37  // POLICY: DisableSecurityBypass38  {39    policies: {40      DisableSecurityBypass: {41        InvalidCertificate: true,42        SafeBrowsing: true,43      },44    },45    lockedPrefs: {46      "security.certerror.hideAddException": true,47      "browser.safebrowsing.allowOverride": false,48    },49  },50  // POLICY: DisableBuiltinPDFViewer51  {52    policies: { DisableBuiltinPDFViewer: true },53    lockedPrefs: { "pdfjs.disabled": true },54  },55  // POLICY: DisableFormHistory56  {57    policies: { DisableFormHistory: true },58    lockedPrefs: { "browser.formfill.enable": false },59  },60  // POLICY: EnableTrackingProtection61  {62    policies: {63      EnableTrackingProtection: {64        Value: true,65      },66    },67    unlockedPrefs: {68      "privacy.trackingprotection.enabled": true,69      "privacy.trackingprotection.pbmode.enabled": true,70    },71  },72  {73    policies: {74      EnableTrackingProtection: {75        Value: false,76        Locked: true,77      },78    },79    lockedPrefs: {80      "privacy.trackingprotection.enabled": false,81      "privacy.trackingprotection.pbmode.enabled": false,82    },83  },84  {85    policies: {86      EnableTrackingProtection: {87        Cryptomining: true,88        Fingerprinting: true,89        Locked: true,90      },91    },92    lockedPrefs: {93      "privacy.trackingprotection.cryptomining.enabled": true,94      "privacy.trackingprotection.fingerprinting.enabled": true,95    },96  },97  // POLICY: OverrideFirstRunPage98  {99    policies: { OverrideFirstRunPage: "https://www.example.com/" },100    lockedPrefs: { "startup.homepage_welcome_url": "https://www.example.com/" },101  },102  // POLICY: Authentication103  {104    policies: {105      Authentication: {106        SPNEGO: ["a.com", "b.com"],107        Delegated: ["a.com", "b.com"],108        NTLM: ["a.com", "b.com"],109        AllowNonFQDN: {110          SPNEGO: true,111          NTLM: true,112        },113        AllowProxies: {114          SPNEGO: false,115          NTLM: false,116        },117        PrivateBrowsing: true,118      },119    },120    lockedPrefs: {121      "network.negotiate-auth.trusted-uris": "a.com, b.com",122      "network.negotiate-auth.delegation-uris": "a.com, b.com",123      "network.automatic-ntlm-auth.trusted-uris": "a.com, b.com",124      "network.automatic-ntlm-auth.allow-non-fqdn": true,125      "network.negotiate-auth.allow-non-fqdn": true,126      "network.automatic-ntlm-auth.allow-proxies": false,127      "network.negotiate-auth.allow-proxies": false,128      "network.auth.private-browsing-sso": true,129    },130  },131  // POLICY: Authentication (unlocked)132  {133    policies: {134      Authentication: {135        SPNEGO: ["a.com", "b.com"],136        Delegated: ["a.com", "b.com"],137        NTLM: ["a.com", "b.com"],138        AllowNonFQDN: {139          SPNEGO: true,140          NTLM: true,141        },142        AllowProxies: {143          SPNEGO: false,144          NTLM: false,145        },146        PrivateBrowsing: true,147        Locked: false,148      },149    },150    unlockedPrefs: {151      "network.negotiate-auth.trusted-uris": "a.com, b.com",152      "network.negotiate-auth.delegation-uris": "a.com, b.com",153      "network.automatic-ntlm-auth.trusted-uris": "a.com, b.com",154      "network.automatic-ntlm-auth.allow-non-fqdn": true,155      "network.negotiate-auth.allow-non-fqdn": true,156      "network.automatic-ntlm-auth.allow-proxies": false,157      "network.negotiate-auth.allow-proxies": false,158      "network.auth.private-browsing-sso": true,159    },160  },161  // POLICY: Certificates (true)162  {163    policies: {164      Certificates: {165        ImportEnterpriseRoots: true,166      },167    },168    lockedPrefs: {169      "security.enterprise_roots.enabled": true,170    },171  },172  // POLICY: Certificates (false)173  {174    policies: {175      Certificates: {176        ImportEnterpriseRoots: false,177      },178    },179    lockedPrefs: {180      "security.enterprise_roots.enabled": false,181    },182  },183  // POLICY: InstallAddons.Default (block addon installs)184  {185    policies: {186      InstallAddonsPermission: {187        Default: false,188      },189    },190    lockedPrefs: {191      "xpinstall.enabled": false,192      "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons": false,193      "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features": false,194    },195  },196  // POLICY: SanitizeOnShutdown197  {198    policies: {199      SanitizeOnShutdown: true,200    },201    lockedPrefs: {202      "privacy.sanitize.sanitizeOnShutdown": true,203      "privacy.clearOnShutdown.cache": true,204      "privacy.clearOnShutdown.cookies": true,205      "privacy.clearOnShutdown.downloads": true,206      "privacy.clearOnShutdown.formdata": true,207      "privacy.clearOnShutdown.history": true,208      "privacy.clearOnShutdown.sessions": true,209      "privacy.clearOnShutdown.siteSettings": true,210      "privacy.clearOnShutdown.offlineApps": true,211    },212  },213  {214    policies: {215      SanitizeOnShutdown: {216        Cache: true,217      },218    },219    lockedPrefs: {220      "privacy.sanitize.sanitizeOnShutdown": true,221      "privacy.clearOnShutdown.cache": true,222      "privacy.clearOnShutdown.cookies": false,223      "privacy.clearOnShutdown.downloads": false,224      "privacy.clearOnShutdown.formdata": false,225      "privacy.clearOnShutdown.history": false,226      "privacy.clearOnShutdown.sessions": false,227    },228  },229  {230    policies: {231      SanitizeOnShutdown: {232        Cookies: true,233      },234    },235    lockedPrefs: {236      "privacy.sanitize.sanitizeOnShutdown": true,237      "privacy.clearOnShutdown.cache": false,238      "privacy.clearOnShutdown.cookies": true,239      "privacy.clearOnShutdown.downloads": false,240      "privacy.clearOnShutdown.formdata": false,241      "privacy.clearOnShutdown.history": false,242      "privacy.clearOnShutdown.sessions": false,243    },244  },245  {246    policies: {247      SanitizeOnShutdown: {248        Downloads: true,249      },250    },251    lockedPrefs: {252      "privacy.sanitize.sanitizeOnShutdown": true,253      "privacy.clearOnShutdown.cache": false,254      "privacy.clearOnShutdown.cookies": false,255      "privacy.clearOnShutdown.downloads": true,256      "privacy.clearOnShutdown.formdata": false,257      "privacy.clearOnShutdown.history": false,258      "privacy.clearOnShutdown.sessions": false,259    },260  },261  {262    policies: {263      SanitizeOnShutdown: {264        FormData: true,265      },266    },267    lockedPrefs: {268      "privacy.sanitize.sanitizeOnShutdown": true,269      "privacy.clearOnShutdown.cache": false,270      "privacy.clearOnShutdown.cookies": false,271      "privacy.clearOnShutdown.downloads": false,272      "privacy.clearOnShutdown.formdata": true,273      "privacy.clearOnShutdown.history": false,274      "privacy.clearOnShutdown.sessions": false,275    },276  },277  {278    policies: {279      SanitizeOnShutdown: {280        History: true,281      },282    },283    lockedPrefs: {284      "privacy.sanitize.sanitizeOnShutdown": true,285      "privacy.clearOnShutdown.cache": false,286      "privacy.clearOnShutdown.cookies": false,287      "privacy.clearOnShutdown.downloads": false,288      "privacy.clearOnShutdown.formdata": false,289      "privacy.clearOnShutdown.history": true,290      "privacy.clearOnShutdown.sessions": false,291    },292  },293  {294    policies: {295      SanitizeOnShutdown: {296        Sessions: true,297      },298    },299    lockedPrefs: {300      "privacy.sanitize.sanitizeOnShutdown": true,301      "privacy.clearOnShutdown.cache": false,302      "privacy.clearOnShutdown.cookies": false,303      "privacy.clearOnShutdown.downloads": false,304      "privacy.clearOnShutdown.formdata": false,305      "privacy.clearOnShutdown.history": false,306      "privacy.clearOnShutdown.sessions": true,307    },308  },309  {310    policies: {311      SanitizeOnShutdown: {312        SiteSettings: true,313      },314    },315    lockedPrefs: {316      "privacy.sanitize.sanitizeOnShutdown": true,317      "privacy.clearOnShutdown.cache": false,318      "privacy.clearOnShutdown.cookies": false,319      "privacy.clearOnShutdown.downloads": false,320      "privacy.clearOnShutdown.formdata": false,321      "privacy.clearOnShutdown.history": false,322      "privacy.clearOnShutdown.sessions": false,323      "privacy.clearOnShutdown.siteSettings": true,324    },325  },326  {327    policies: {328      SanitizeOnShutdown: {329        OfflineApps: true,330      },331    },332    lockedPrefs: {333      "privacy.sanitize.sanitizeOnShutdown": true,334      "privacy.clearOnShutdown.cache": false,335      "privacy.clearOnShutdown.cookies": false,336      "privacy.clearOnShutdown.downloads": false,337      "privacy.clearOnShutdown.formdata": false,338      "privacy.clearOnShutdown.history": false,339      "privacy.clearOnShutdown.sessions": false,340      "privacy.clearOnShutdown.offlineApps": true,341    },342  },343  // POLICY: SanitizeOnShutdown using Locked344  {345    policies: {346      SanitizeOnShutdown: {347        Cache: true,348        Locked: true,349      },350    },351    lockedPrefs: {352      "privacy.sanitize.sanitizeOnShutdown": true,353      "privacy.clearOnShutdown.cache": true,354    },355    unlockedPrefs: {356      "privacy.clearOnShutdown.cookies": false,357      "privacy.clearOnShutdown.downloads": false,358      "privacy.clearOnShutdown.formdata": false,359      "privacy.clearOnShutdown.history": false,360      "privacy.clearOnShutdown.sessions": false,361    },362  },363  {364    policies: {365      SanitizeOnShutdown: {366        Cache: true,367        Cookies: false,368        Locked: true,369      },370    },371    lockedPrefs: {372      "privacy.sanitize.sanitizeOnShutdown": true,373      "privacy.clearOnShutdown.cache": true,374      "privacy.clearOnShutdown.cookies": false,375    },376    unlockedPrefs: {377      "privacy.clearOnShutdown.downloads": false,378      "privacy.clearOnShutdown.formdata": false,379      "privacy.clearOnShutdown.history": false,380      "privacy.clearOnShutdown.sessions": false,381    },382  },383  {384    policies: {385      SanitizeOnShutdown: {386        Cache: true,387        Locked: false,388      },389    },390    unlockedPrefs: {391      "privacy.sanitize.sanitizeOnShutdown": true,392      "privacy.clearOnShutdown.cache": true,393      "privacy.clearOnShutdown.cookies": false,394      "privacy.clearOnShutdown.downloads": false,395      "privacy.clearOnShutdown.formdata": false,396      "privacy.clearOnShutdown.history": false,397      "privacy.clearOnShutdown.sessions": false,398    },399  },400  // POLICY: DNSOverHTTPS Locked401  {402    policies: {403      DNSOverHTTPS: {404        Enabled: true,405        ProviderURL: "http://example.com/provider",406        ExcludedDomains: ["example.com", "example.org"],407        Locked: true,408      },409    },410    lockedPrefs: {411      "network.trr.mode": 2,412      "network.trr.uri": "http://example.com/provider",413      "network.trr.excluded-domains": "example.com,example.org",414    },415  },416  // POLICY: DNSOverHTTPS Unlocked417  {418    policies: {419      DNSOverHTTPS: {420        Enabled: false,421        ProviderURL: "http://example.com/provider",422        ExcludedDomains: ["example.com", "example.org"],423      },424    },425    unlockedPrefs: {426      "network.trr.mode": 5,427      "network.trr.uri": "http://example.com/provider",428      "network.trr.excluded-domains": "example.com,example.org",429    },430  },431  // POLICY: SSLVersionMin/SSLVersionMax (1)432  {433    policies: {434      SSLVersionMin: "tls1",435      SSLVersionMax: "tls1.1",436    },437    lockedPrefs: {438      "security.tls.version.min": 1,439      "security.tls.version.max": 2,440    },441  },442  // POLICY: SSLVersionMin/SSLVersionMax (2)443  {444    policies: {445      SSLVersionMin: "tls1.2",446      SSLVersionMax: "tls1.3",447    },448    lockedPrefs: {449      "security.tls.version.min": 3,450      "security.tls.version.max": 4,451    },452  },453  // POLICY: CaptivePortal454  {455    policies: {456      CaptivePortal: false,457    },458    lockedPrefs: {459      "network.captive-portal-service.enabled": false,460    },461  },462  // POLICY: NetworkPrediction463  {464    policies: {465      NetworkPrediction: false,466    },467    lockedPrefs: {468      "network.dns.disablePrefetch": true,469      "network.dns.disablePrefetchFromHTTPS": true,470    },471  },472  // POLICY: ExtensionUpdate473  {474    policies: {475      ExtensionUpdate: false,476    },477    lockedPrefs: {478      "extensions.update.enabled": false,479    },480  },481  // POLICY: DisableShield482  {483    policies: {484      DisableFirefoxStudies: true,485    },486    lockedPrefs: {487      "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons": false,488      "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features": false,489    },490  },491  // POLICY: NewTabPage492  {493    policies: {494      NewTabPage: false,495    },496    lockedPrefs: {497      "browser.newtabpage.enabled": false,498    },499  },500  // POLICY: SearchSuggestEnabled501  {502    policies: {503      SearchSuggestEnabled: false,504    },505    lockedPrefs: {506      "browser.urlbar.suggest.searches": false,507      "browser.search.suggest.enabled": false,508    },509  },510  // POLICY: FirefoxHome511  {512    policies: {513      FirefoxHome: {514        Pocket: false,515        Snippets: false,516        Locked: true,517      },518    },519    lockedPrefs: {520      "browser.newtabpage.activity-stream.feeds.snippets": false,521      "browser.newtabpage.activity-stream.feeds.section.topstories": false,522    },523  },524  // POLICY: OfferToSaveLoginsDefault525  {526    policies: {527      OfferToSaveLoginsDefault: false,528    },529    unlockedPrefs: {530      "signon.rememberSignons": false,531    },532  },533  // POLICY: UserMessaging534  {535    policies: {536      UserMessaging: {537        WhatsNew: false,538        Locked: true,539      },540    },541    lockedPrefs: {542      "browser.messaging-system.whatsNewPanel.enabled": false,543    },544  },545  {546    policies: {547      UserMessaging: {548        ExtensionRecommendations: false,549      },550    },551    unlockedPrefs: {552      "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons": false,553    },554  },555  {556    policies: {557      UserMessaging: {558        FeatureRecommendations: false,559      },560    },561    unlockedPrefs: {562      "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features": false,563    },564  },565  // POLICY: Permissions->Autoplay566  {567    policies: {568      Permissions: {569        Autoplay: {570          Default: "allow-audio-video",571          Locked: true,572        },573      },574    },575    lockedPrefs: {576      "media.autoplay.default": 0,577    },578  },579  {580    policies: {581      Permissions: {582        Autoplay: {583          Default: "block-audio",584        },585      },586    },587    unlockedPrefs: {588      "media.autoplay.default": 1,589    },590  },591  {592    policies: {593      Permissions: {594        Autoplay: {595          Default: "block-audio-video",596        },597      },598    },599    unlockedPrefs: {600      "media.autoplay.default": 5,601    },602  },603  // POLICY: LegacySameSiteCookieBehaviorEnabled604  {605    policies: {606      LegacySameSiteCookieBehaviorEnabled: true,607    },608    unlockedPrefs: {609      "network.cookie.sameSite.laxByDefault": false,610    },611  },612  // POLICY: LegacySameSiteCookieBehaviorEnabledForDomainList613  {614    policies: {615      LegacySameSiteCookieBehaviorEnabledForDomainList: [616        "example.com",617        "example.org",618      ],619    },620    unlockedPrefs: {621      "network.cookie.sameSite.laxByDefault.disabledHosts":622        "example.com,example.org",623    },624  },625  // POLICY: EncryptedMediaExtensions626  {627    policies: {628      EncryptedMediaExtensions: {629        Enabled: false,630        Locked: true,631      },632    },633    lockedPrefs: {634      "media.eme.enabled": false,635    },636  },637  // POLICY: PDFjs638  {639    policies: {640      PDFjs: {641        Enabled: false,642        EnablePermissions: true,643      },644    },645    lockedPrefs: {646      "pdfjs.disabled": true,647      "pdfjs.enablePermissions": true,648    },649  },650  // POLICY: PictureInPicture651  {652    policies: {653      PictureInPicture: {654        Enabled: false,655        Locked: true,656      },657    },658    lockedPrefs: {659      "media.videocontrols.picture-in-picture.video-toggle.enabled": false,660    },661  },662  // POLICY: DisabledCiphers663  {664    policies: {665      DisabledCiphers: {666        TLS_DHE_RSA_WITH_AES_128_CBC_SHA: false,667        TLS_DHE_RSA_WITH_AES_256_CBC_SHA: false,668        TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA: false,669        TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: false,670        TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256: false,671        TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256: false,672        TLS_RSA_WITH_AES_128_CBC_SHA: false,673        TLS_RSA_WITH_AES_256_CBC_SHA: false,674        TLS_RSA_WITH_3DES_EDE_CBC_SHA: false,675        TLS_RSA_WITH_AES_128_GCM_SHA256: false,676        TLS_RSA_WITH_AES_256_GCM_SHA384: false,677      },678    },679    lockedPrefs: {680      "security.ssl3.dhe_rsa_aes_128_sha": true,681      "security.ssl3.dhe_rsa_aes_256_sha": true,682      "security.ssl3.ecdhe_rsa_aes_128_sha": true,683      "security.ssl3.ecdhe_rsa_aes_256_sha": true,684      "security.ssl3.ecdhe_rsa_aes_128_gcm_sha256": true,685      "security.ssl3.ecdhe_ecdsa_aes_128_gcm_sha256": true,686      "security.ssl3.rsa_aes_128_sha": true,687      "security.ssl3.rsa_aes_256_sha": true,688      "security.ssl3.rsa_des_ede3_sha": true,689      "security.ssl3.rsa_aes_128_gcm_sha256": true,690      "security.ssl3.rsa_aes_256_gcm_sha384": true,691    },692  },693  {694    policies: {695      DisabledCiphers: {696        TLS_DHE_RSA_WITH_AES_128_CBC_SHA: true,697        TLS_DHE_RSA_WITH_AES_256_CBC_SHA: true,698        TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA: true,699        TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: true,700        TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256: true,701        TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256: true,702        TLS_RSA_WITH_AES_128_CBC_SHA: true,703        TLS_RSA_WITH_AES_256_CBC_SHA: true,704        TLS_RSA_WITH_3DES_EDE_CBC_SHA: true,705        TLS_RSA_WITH_AES_128_GCM_SHA256: true,706        TLS_RSA_WITH_AES_256_GCM_SHA384: true,707      },708    },709    lockedPrefs: {710      "security.ssl3.dhe_rsa_aes_128_sha": false,711      "security.ssl3.dhe_rsa_aes_256_sha": false,712      "security.ssl3.ecdhe_rsa_aes_128_sha": false,713      "security.ssl3.ecdhe_rsa_aes_256_sha": false,714      "security.ssl3.ecdhe_rsa_aes_128_gcm_sha256": false,715      "security.ssl3.ecdhe_ecdsa_aes_128_gcm_sha256": false,716      "security.ssl3.rsa_aes_128_sha": false,717      "security.ssl3.rsa_aes_256_sha": false,718      "security.ssl3.rsa_des_ede3_sha": false,719      "security.ssl3.rsa_aes_128_gcm_sha256": false,720      "security.ssl3.rsa_aes_256_gcm_sha384": false,721    },722  },723];724add_task(async function test_policy_simple_prefs() {725  for (let test of POLICIES_TESTS) {726    await setupPolicyEngineWithJson({727      policies: test.policies,728    });729    info("Checking policy: " + Object.keys(test.policies)[0]);730    for (let [prefName, prefValue] of Object.entries(test.lockedPrefs || {})) {731      checkLockedPref(prefName, prefValue);732    }733    for (let [prefName, prefValue] of Object.entries(734      test.unlockedPrefs || {}735    )) {736      checkUnlockedPref(prefName, prefValue);737    }738  }...

Full Screen

Full Screen

findMatchingSimulator-test.js

Source:findMatchingSimulator-test.js Github

copy

Full Screen

1/**2/**3 * Copyright (c) 2015-present, Facebook, Inc.4 * All rights reserved.5 *6 * This source code is licensed under the BSD-style license found in the7 * LICENSE file in the root directory of this source tree. An additional grant8 * of patent rights can be found in the PATENTS file in the same directory.9 */10'use strict';11jest.dontMock('../findMatchingSimulator');12const findMatchingSimulator = require('../findMatchingSimulator');13describe('findMatchingSimulator', () => {14  it('should find simulator', () => {15    expect(findMatchingSimulator({16        "devices": {17          "iOS 9.2": [18            {19              "state": "Shutdown",20              "availability": "(available)",21              "name": "iPhone 4s",22              "udid": "B9B5E161-416B-43C4-A78F-729CB96CC8C6"23            },24            {25              "state": "Shutdown",26              "availability": "(available)",27              "name": "iPhone 5",28              "udid": "1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB"29            },30            {31              "state": "Shutdown",32              "availability": "(available)",33              "name": "iPhone 6",34              "udid": "BA0D93BD-07E6-4182-9B0A-F60A2474139C"35            },36            {37              "state": "Shutdown",38              "availability": "(available)",39              "name": "iPhone 6 (Plus)",40              "udid": "9564ABEE-9EC2-4B4A-B443-D3710929A45A"41            },42            {43              "state": "Shutdown",44              "availability": "(available)",45              "name": "iPhone 6s",46              "udid": "D0F29BE7-CC3C-4976-888D-C739B4F50508"47            }48          ]49        }50      },51      'iPhone 6'52    )).toEqual({53      udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C',54      name: 'iPhone 6',55      version: 'iOS 9.2'56    });57  });58  it('should return null if no simulators available', () => {59    expect(findMatchingSimulator({60        "devices": {61          "iOS 9.2": [62            {63              "state": "Shutdown",64              "availability": "(unavailable, runtime profile not found)",65              "name": "iPhone 4s",66              "udid": "B9B5E161-416B-43C4-A78F-729CB96CC8C6"67            },68            {69              "state": "Shutdown",70              "availability": "(unavailable, runtime profile not found)",71              "name": "iPhone 5",72              "udid": "1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB"73            },74            {75              "state": "Shutdown",76              "availability": "(unavailable, runtime profile not found)",77              "name": "iPhone 6",78              "udid": "BA0D93BD-07E6-4182-9B0A-F60A2474139C"79            },80            {81              "state": "Shutdown",82              "availability": "(unavailable, runtime profile not found)",83              "name": "iPhone 6 (Plus)",84              "udid": "9564ABEE-9EC2-4B4A-B443-D3710929A45A"85            },86            {87              "state": "Shutdown",88              "availability": "(unavailable, runtime profile not found)",89              "name": "iPhone 6s",90              "udid": "D0F29BE7-CC3C-4976-888D-C739B4F50508"91            }92          ]93        }94      },95      'iPhone 6'96    )).toEqual(null);97  });98  it('should return null if an odd input', () => {99    expect(findMatchingSimulator('random string input', 'iPhone 6')).toEqual(null);100  });101  it('should return the first simulator in list if none is defined', () => {102    expect(findMatchingSimulator({103        "devices": {104          "iOS 9.2": [105            {106              "state": "Shutdown",107              "availability": "(unavailable, runtime profile not found)",108              "name": "iPhone 4s",109              "udid": "B9B5E161-416B-43C4-A78F-729CB96CC8C6"110            },111            {112              "state": "Shutdown",113              "availability": "(available)",114              "name": "iPhone 5",115              "udid": "1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB"116            },117            {118              "state": "Shutdown",119              "availability": "(available)",120              "name": "iPhone 6",121              "udid": "BA0D93BD-07E6-4182-9B0A-F60A2474139C"122            },123            {124              "state": "Shutdown",125              "availability": "(available)",126              "name": "iPhone 6 (Plus)",127              "udid": "9564ABEE-9EC2-4B4A-B443-D3710929A45A"128            },129            {130              "state": "Shutdown",131              "availability": "(unavailable, runtime profile not found)",132              "name": "iPhone 6s",133              "udid": "D0F29BE7-CC3C-4976-888D-C739B4F50508"134            }135          ]136        }137      },138      null139    )).toEqual({140      udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB',141      name: 'iPhone 5',142      version: 'iOS 9.2'143    });144  });145  it('should return the first simulator in list if none is defined', () => {146    expect(findMatchingSimulator({147        "devices": {148          "iOS 9.2": [149            {150              "state": "Shutdown",151              "availability": "(unavailable, runtime profile not found)",152              "name": "iPhone 4s",153              "udid": "B9B5E161-416B-43C4-A78F-729CB96CC8C6"154            },155            {156              "state": "Shutdown",157              "availability": "(available)",158              "name": "iPhone 5",159              "udid": "1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB"160            },161            {162              "state": "Shutdown",163              "availability": "(available)",164              "name": "iPhone 6",165              "udid": "BA0D93BD-07E6-4182-9B0A-F60A2474139C"166            },167            {168              "state": "Shutdown",169              "availability": "(available)",170              "name": "iPhone 6 (Plus)",171              "udid": "9564ABEE-9EC2-4B4A-B443-D3710929A45A"172            },173            {174              "state": "Shutdown",175              "availability": "(unavailable, runtime profile not found)",176              "name": "iPhone 6s",177              "udid": "D0F29BE7-CC3C-4976-888D-C739B4F50508"178            }179          ],180          "iOS 10.0": [181            {182              "state": "Shutdown",183              "availability": "(available)",184              "name": "iPhone 6",185              "udid": "2FF48AE5-CC3B-4C80-8D25-48966A6BE2C0"186            },187            {188              "state": "Shutdown",189              "availability": "(available)",190              "name": "iPhone 6 (Plus)",191              "udid": "841E33FE-E8A1-4B65-9FF8-6EAA6442A3FC"192            },193            {194              "state": "Shutdown",195              "availability": "(available)",196              "name": "iPhone 6s",197              "udid": "CBBB8FB8-77AB-49A9-8297-4CCFE3189C22"198            },199            {200              "state": "Shutdown",201              "availability": "(available)",202              "name": "iPhone 7",203              "udid": "3A409DC5-5188-42A6-8598-3AA6F34607A5"204            }205          ]206        }207      },208      null209    )).toEqual({210      udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB',211      name: 'iPhone 5',212      version: 'iOS 9.2'213    });214  });215  it('should return the booted simulator in list if none is defined', () => {216    expect(findMatchingSimulator({217        "devices": {218          "iOS 9.2": [219            {220              "state": "Shutdown",221              "availability": "(unavailable, runtime profile not found)",222              "name": "iPhone 4s",223              "udid": "B9B5E161-416B-43C4-A78F-729CB96CC8C6"224            },225            {226              "state": "Shutdown",227              "availability": "(available)",228              "name": "iPhone 5",229              "udid": "1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB"230            },231            {232              "state": "Shutdown",233              "availability": "(available)",234              "name": "iPhone 6",235              "udid": "BA0D93BD-07E6-4182-9B0A-F60A2474139C"236            },237            {238              "state": "Shutdown",239              "availability": "(available)",240              "name": "iPhone 6 (Plus)",241              "udid": "9564ABEE-9EC2-4B4A-B443-D3710929A45A"242            },243            {244              "state": "Booted",245              "availability": "(available)",246              "name": "iPhone 6s",247              "udid": "D0F29BE7-CC3C-4976-888D-C739B4F50508"248            }249          ]250        }251      },252      null253    )).toEqual({254      udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508',255      name: 'iPhone 6s',256      version: 'iOS 9.2'257    });258  });259  it('should return the booted simulator in list even if another device is defined', () => {260    expect(findMatchingSimulator({261        "devices": {262          "iOS 9.2": [263            {264              "state": "Shutdown",265              "availability": "(unavailable, runtime profile not found)",266              "name": "iPhone 4s",267              "udid": "B9B5E161-416B-43C4-A78F-729CB96CC8C6"268            },269            {270              "state": "Shutdown",271              "availability": "(available)",272              "name": "iPhone 5",273              "udid": "1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB"274            },275            {276              "state": "Shutdown",277              "availability": "(available)",278              "name": "iPhone 6",279              "udid": "BA0D93BD-07E6-4182-9B0A-F60A2474139C"280            },281            {282              "state": "Shutdown",283              "availability": "(available)",284              "name": "iPhone 6 (Plus)",285              "udid": "9564ABEE-9EC2-4B4A-B443-D3710929A45A"286            },287            {288              "state": "Booted",289              "availability": "(available)",290              "name": "iPhone 6s",291              "udid": "D0F29BE7-CC3C-4976-888D-C739B4F50508"292            }293          ]294        }295      },296      "iPhone 6"297    )).toEqual({298      udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508',299      name: 'iPhone 6s',300      version: 'iOS 9.2'301    });302  });303  it('should return the booted simulator in list if none is defined (multi ios versions)', () => {304    expect(findMatchingSimulator({305        "devices": {306          "iOS 9.2": [307            {308              "state": "Shutdown",309              "availability": "(unavailable, runtime profile not found)",310              "name": "iPhone 4s",311              "udid": "B9B5E161-416B-43C4-A78F-729CB96CC8C6"312            },313            {314              "state": "Shutdown",315              "availability": "(available)",316              "name": "iPhone 5",317              "udid": "1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB"318            },319            {320              "state": "Shutdown",321              "availability": "(available)",322              "name": "iPhone 6",323              "udid": "BA0D93BD-07E6-4182-9B0A-F60A2474139C"324            },325            {326              "state": "Shutdown",327              "availability": "(available)",328              "name": "iPhone 6 (Plus)",329              "udid": "9564ABEE-9EC2-4B4A-B443-D3710929A45A"330            },331            {332              "state": "Shutdown",333              "availability": "(available)",334              "name": "iPhone 6s",335              "udid": "D0F29BE7-CC3C-4976-888D-C739B4F50508"336            }337          ],338          "iOS 10.0": [339            {340              "state": "Shutdown",341              "availability": "(available)",342              "name": "iPhone 6",343              "udid": "2FF48AE5-CC3B-4C80-8D25-48966A6BE2C0"344            },345            {346              "state": "Shutdown",347              "availability": "(available)",348              "name": "iPhone 6 (Plus)",349              "udid": "841E33FE-E8A1-4B65-9FF8-6EAA6442A3FC"350            },351            {352              "state": "Shutdown",353              "availability": "(available)",354              "name": "iPhone 6s",355              "udid": "CBBB8FB8-77AB-49A9-8297-4CCFE3189C22"356            },357            {358              "state": "Booted",359              "availability": "(available)",360              "name": "iPhone 7",361              "udid": "3A409DC5-5188-42A6-8598-3AA6F34607A5"362            }363          ]364        }365      },366      null367    )).toEqual({368      udid: '3A409DC5-5188-42A6-8598-3AA6F34607A5',369      name: 'iPhone 7',370      version: 'iOS 10.0'371    });372  });373  it('should return the booted simulator in list even if another device is defined (multi ios versions)', () => {374    expect(findMatchingSimulator({375        "devices": {376          "iOS 9.2": [377            {378              "state": "Shutdown",379              "availability": "(unavailable, runtime profile not found)",380              "name": "iPhone 4s",381              "udid": "B9B5E161-416B-43C4-A78F-729CB96CC8C6"382            },383            {384              "state": "Shutdown",385              "availability": "(available)",386              "name": "iPhone 5",387              "udid": "1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB"388            },389            {390              "state": "Shutdown",391              "availability": "(available)",392              "name": "iPhone 6",393              "udid": "BA0D93BD-07E6-4182-9B0A-F60A2474139C"394            },395            {396              "state": "Shutdown",397              "availability": "(available)",398              "name": "iPhone 6 (Plus)",399              "udid": "9564ABEE-9EC2-4B4A-B443-D3710929A45A"400            },401            {402              "state": "Shutdown",403              "availability": "(available)",404              "name": "iPhone 6s",405              "udid": "D0F29BE7-CC3C-4976-888D-C739B4F50508"406            }407          ],408          "iOS 10.0": [409            {410              "state": "Shutdown",411              "availability": "(available)",412              "name": "iPhone 6",413              "udid": "2FF48AE5-CC3B-4C80-8D25-48966A6BE2C0"414            },415            {416              "state": "Shutdown",417              "availability": "(available)",418              "name": "iPhone 6 (Plus)",419              "udid": "841E33FE-E8A1-4B65-9FF8-6EAA6442A3FC"420            },421            {422              "state": "Shutdown",423              "availability": "(available)",424              "name": "iPhone 6s",425              "udid": "CBBB8FB8-77AB-49A9-8297-4CCFE3189C22"426            },427            {428              "state": "Booted",429              "availability": "(available)",430              "name": "iPhone 7",431              "udid": "3A409DC5-5188-42A6-8598-3AA6F34607A5"432            }433          ]434        }435      },436      "iPhone 6s"437    )).toEqual({438      udid: '3A409DC5-5188-42A6-8598-3AA6F34607A5',439      name: 'iPhone 7',440      version: 'iOS 10.0'441    });442  });...

Full Screen

Full Screen

log4js.js

Source:log4js.js Github

copy

Full Screen

...65 * @params {Function} cb - The callback to be invoked once all appenders have66 *  shutdown. If an error occurs, the callback will be given the error object67 *  as the first argument.68 */69function shutdown(cb) {70  debug('Shutdown called. Disabling all log writing.');71  // First, disable all writing to appenders. This prevents appenders from72  // not being able to be drained because of run-away log writes.73  enabled = false;74  // Call each of the shutdown functions in parallel75  const appendersToCheck = Array.from(appenders.values());76  const shutdownFunctions = appendersToCheck.reduceRight((accum, next) => (next.shutdown ? accum + 1 : accum), 0);77  let completed = 0;78  let error;79  debug(`Found ${shutdownFunctions} appenders with shutdown functions.`);80  function complete(err) {81    error = error || err;82    completed += 1;83    debug(`Appender shutdowns complete: ${completed} / ${shutdownFunctions}`);84    if (completed >= shutdownFunctions) {85      debug('All shutdown functions completed.');86      cb(error);87    }88  }89  if (shutdownFunctions === 0) {90    debug('No appenders with shutdown functions found.');91    return cb();92  }93  appendersToCheck.filter(a => a.shutdown).forEach(a => a.shutdown(complete));94  return null;95}96/**97 * Get a logger instance.98 * @static99 * @param loggerCategoryName100 * @return {Logger} instance of logger for the category101 */102function getLogger(category) {103  if (!enabled) {104    configure(process.env.LOG4JS_CONFIG || {105      appenders: { out: { type: 'stdout' } },106      categories: { default: { appenders: ['out'], level: 'OFF' } }107    });...

Full Screen

Full Screen

shutdownManager.js

Source:shutdownManager.js Github

copy

Full Screen

1const fetch = require('node-fetch')2const path = require('path')3const { EXIT_CODES } = require('./utils/constants')4const { watchdog } = require('./utils/utils')5const logger = require('./services/logger')6const { redis } = require('./services/redisClient')7const { web3Side } = require('./services/web3')8const { getShutdownFlag, setShutdownFlag } = require('./services/shutdownState')9if (process.argv.length < 3) {10  logger.error('Please check the number of arguments, config file was not provided')11  process.exit(EXIT_CODES.GENERAL_ERROR)12}13const config = require(path.join('../config/', process.argv[2]))14if (config.shutdownContractAddress && !web3Side) {15  logger.error(16    'ORACLE_SHUTDOWN_CONTRACT_ADDRESS was provided but not side chain provider was registered.' +17      ' Please, specify ORACLE_SIDE_RPC_URL as well.'18  )19  process.exit(EXIT_CODES.GENERAL_ERROR)20}21let shutdownCount = 022let okCount = 023async function fetchShutdownFlag() {24  if (config.shutdownServiceURL) {25    logger.debug({ url: config.shutdownServiceURL }, 'Fetching shutdown status from external URL')26    const result = await fetch(config.shutdownServiceURL, {27      headers: {28        'Content-type': 'application/json'29      },30      method: 'GET',31      timeout: config.requestTimeout32    }).then(res => res.json())33    if (result.shutdown === true) {34      return true35    }36  }37  if (config.shutdownContractAddress) {38    const shutdownSelector = web3Side.eth.abi.encodeEventSignature(config.shutdownMethod)39    logger.debug(40      { contract: config.shutdownContractAddress, method: config.shutdownMethod, data: shutdownSelector },41      'Fetching shutdown status from contract'42    )43    const result = await web3Side.eth.call({44      to: config.shutdownContractAddress,45      data: shutdownSelector46    })47    logger.debug({ result }, 'Obtained result from the side RPC endpoint')48    if (result.length > 2 && web3Side.eth.abi.decodeParameter('bool', result)) {49      return true50    }51  }52  return false53}54async function checkShutdownFlag() {55  const isShutdownFlag = await fetchShutdownFlag()56  const isShutdown = await getShutdownFlag(logger, config.shutdownKey)57  if (isShutdownFlag === true && isShutdown === false) {58    shutdownCount += 159    okCount = 060    logger.info(61      { shutdownCount, remainingChecks: config.checksBeforeStop - shutdownCount },62      'Received positive shutdown flag'63    )64  } else if (isShutdownFlag === false && isShutdown === true) {65    okCount += 166    shutdownCount = 067    logger.info({ okCount, remainingChecks: config.checksBeforeResume - okCount }, 'Received negative shutdown flag')68  } else {69    shutdownCount = 070    okCount = 071    logger.debug({ isShutdown, isShutdownFlag }, 'Received shutdown flag that is equal to the current state')72  }73  if (shutdownCount >= config.checksBeforeStop) {74    await setShutdownFlag(logger, config.shutdownKey, true)75  } else if (okCount >= config.checksBeforeResume) {76    await setShutdownFlag(logger, config.shutdownKey, false)77  }78}79async function initialize() {80  logger.info('Starting shutdown flag watcher')81  redis.on('connect', async () => {82    await getShutdownFlag(logger, config.shutdownKey, true)83    await main()84  })85}86async function main() {87  try {88    await watchdog(checkShutdownFlag, config.maxProcessingTime, () => {89      logger.fatal('Max processing time reached')90      process.exit(EXIT_CODES.MAX_TIME_REACHED)91    })92  } catch (e) {93    logger.error(e)94  }95  setTimeout(main, config.pollingInterval)96}...

Full Screen

Full Screen

test_provider_shutdown.js

Source:test_provider_shutdown.js Github

copy

Full Screen

...16    shutdownResolve: null,17    get name() {18      return aName;19    },20    shutdown() {21      this.shutdownResolve();22      return this.donePromise;23    },24  };25  mockProvider.donePromise = new Promise((resolve, reject) => {26    mockProvider.doneResolve = resolve;27    mockProvider.doneReject = reject;28  });29  mockProvider.shutdownPromise = new Promise((resolve, reject) => {30    mockProvider.shutdownResolve = resolve;31  });32  return mockProvider;33}34function run_test() {...

Full Screen

Full Screen

bootstrap.js

Source:bootstrap.js Github

copy

Full Screen

...58    });59    onShutdown.add(() => unload(loader, "disable"))60    main(loader, "child/main");61  };;62  function shutdown(message)63  {64    if (message.data == Components.stack.filename)65    {66      onShutdown.done = true;67      for (let i = shutdownHandlers.length - 1; i >= 0; i --)68      {69        try70        {71          shutdownHandlers[i]();72        }73        catch (e)74        {75          Cu.reportError(e);76        }...

Full Screen

Full Screen

shutdown.js

Source:shutdown.js Github

copy

Full Screen

1'use strict';2const { curry, forEach } = require('ramda');3const log = require('../core/logger');4/**5 * System signals the app will listen to for initiating a shutdown.6 * @type {NodeJS.Signals[]}7 */8const SHUTDOWN_SIGNALS = ['SIGINT', 'SIGTERM'];9/**10 * Time in milliseconds to wait before forcing shutdown.11 * @type {number}12 */13const SHUTDOWN_TIMEOUT = 15000;14/**15 * Logs a message and exits the process with a positive status code.16 * @param {number} timeout Timeout before force exiting17 * @return {Function} A function that logs and exits18 */19const exitAfter = timeout => () => {20  log.warn(`Could not close resources gracefully after ${timeout}ms: forcing shutdown`);21  return process.exit(1);22};23/**24 * Warns about receiving a shutdown signals and sets a forced shutdown mechanism.25 * @param timeout Time to wait before forcing shutdown (milliseconds)26 * @param signal Signal received on shutdown27 * @return {*}28 */29const beforeShutdown = curry(30  /** @type {(timeout: number, signal: NodeJS.Signals) => void} */31  (timeout, signal) => {32    log.warn(`Shutting down: received [${signal}] signal`);33    // Force shutdown after timeout34    // @ts-ignore35    setTimeout(exitAfter(timeout), timeout).unref();36  }37);38/**39 * Listen for TERM (e.g. kill) and INT (e.g. Ctrl+C) signals40 * and execute given function once.41 * @param signals System signals to listen to42 * @param fn Function to execute on shutdown43 * @return A curried function that takes in an array of `signals` and a44 *  function that takes them one at a time and performs some clean up operation.45 */46const processOnce = curry(47  /** @type {(signals: NodeJS.Signals[], fn: (sig: string) => any) => string[]} */48  (signals, fn) => forEach(sig => process.once(sig, () => fn(sig)), signals)49);50const onShutdown = processOnce(SHUTDOWN_SIGNALS);51onShutdown(beforeShutdown(SHUTDOWN_TIMEOUT));...

Full Screen

Full Screen

test_provider_unsafe_access_shutdown.js

Source:test_provider_unsafe_access_shutdown.js Github

copy

Full Screen

...5    hasShutdown: false,6    unsafeAccess: false,7    shutdownCallback: null,8    startup() { },9    shutdown() {10      this.hasShutdown = true;11      shutdownOrder.push(this.name);12      if (this.shutdownCallback)13        return this.shutdownCallback();14      return undefined;15    },16    getAddonByID(id, callback) {17      if (this.hasShutdown) {18        this.unsafeAccess = true;19      }20      callback(null);21    },22    get name() {23      return name;...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var serverConfig = {4};5var desiredCaps = {6};7var driver = wd.promiseChainRemote(serverConfig);8    .init(desiredCaps)9    .sleep(10000)10    .then(function() {11        return driver.execute('mobile: shell', {12        });13    })14    .then(function() {15        return driver.execute('mobile: shell', {16        });17    })18    .then(function() {19        return driver.execute('mobile: shell', {20        });21    })22    .then(function() {23        return driver.execute('mobile: shell', {24        });25    })26    .then(function() {27        return driver.execute('mobile: shell', {28        });29    })30    .then(function() {31        return driver.execute('mobile: shell', {32        });33    })34    .then(function() {35        return driver.execute('mobile: shell', {36        });37    })38    .then(function() {39        return driver.execute('mobile: shell', {40        });41    })42    .then(function() {43        return driver.execute('mobile: shell', {44        });45    })46    .then(function() {47        return driver.execute('mobile: shell

Full Screen

Using AI Code Generation

copy

Full Screen

1driver.quit();2driver.quit();3driver.quit();4driver.quit();5driver.quit();6driver.quit();7driver.quit();8driver.quit();9driver.quit();10driver.quit();11driver.quit();12driver.quit();13driver.quit();14driver.quit();15driver.quit();16driver.quit();17driver.quit();18driver.quit();19driver.quit();20driver.quit();21driver.quit();22driver.quit();23driver.quit();24driver.quit();25driver.quit();26driver.quit();27driver.quit();28driver.quit();29driver.quit();30driver.quit();31driver.quit();32driver.quit();33driver.quit();

Full Screen

Using AI Code Generation

copy

Full Screen

1driver.quit();2driver.quit();3driver.quit();4driver.quit();5driver.quit();6driver.quit();7driver.quit();8driver.quit();9driver.quit();10driver.quit();11driver.quit();

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var caps = {4};5driver.init(caps, function() {6    driver.sleep(5000);7    driver.quit();8    driver.sleep(5000);9    driver.init(caps, function() {10        driver.sleep(5000);11        driver.quit();12        driver.sleep(5000);13        driver.init(caps, function() {14            driver.sleep(5000);15            driver.quit();16            driver.sleep(5000);17            driver.init(caps, function() {18                driver.sleep(5000);19                driver.quit();20                driver.sleep(5000);21                driver.init(caps, function() {22                    driver.sleep(5000);23                    driver.quit();24                    driver.sleep(5000);25                    driver.init(caps, function() {26                        driver.sleep(5000);27                        driver.quit();28                        driver.sleep(5000);29                        driver.init(caps, function() {30                            driver.sleep(5000);31                            driver.quit();32                            driver.sleep(5000);33                            driver.init(caps, function() {34                                driver.sleep(5000);35                                driver.quit();36                                driver.sleep(5000);37                                driver.init(caps, function() {38                                    driver.sleep(5000);39                                    driver.quit();40                                    driver.sleep(5000);41                                    driver.init(caps, function() {42                                        driver.sleep(5000);43                                        driver.quit();44                                        driver.sleep(5000);45                                        driver.init(caps, function() {46                                            driver.sleep(5000);47                                            driver.quit();48                                            driver.sleep(5000);49                                            driver.init(caps, function() {50                                                driver.sleep(5000);51                                                driver.quit();52                                                driver.sleep(5000);53                                                driver.init(caps, function() {54                                                    driver.sleep(5000);55                                                    driver.quit();56                                                    driver.sleep(5000);57                                                    driver.init(caps, function() {58                                                        driver.sleep(5000);59                                                        driver.quit();60                                                        driver.sleep(5000);61                                                        driver.init(caps, function() {62                                                            driver.sleep(5000);63                                                            driver.quit();

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var app = require('appium');4var caps = {5};6app.build(caps, function(err, appium) {7    if (err) throw err;8    appium.start(function(err, appium) {9        if (err) throw err;10        var driver = wd.remote("localhost", 4723);11        driver.init(caps, function() {12            driver.quit(function() {13                appium.stop(function(err) {14                    if (err) throw err;15                });16            });17        });18    });19});20var wd = require('wd');21var assert = require('assert');22var app = require('appium');23var caps = {24};25app.build(caps, function(err, appium) {26    if (err) throw err;27    appium.start(function(err, appium) {28        if (err) throw err;29        var driver = wd.remote("localhost", 4723);30        driver.init(caps, function() {31            driver.quit(function() {32                appium.stop(function(err) {33                    if (err) throw err;34                });35            });36        });37    });38});39var wd = require('wd');40var assert = require('assert');41var app = require('appium');42var caps = {43};

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 Android 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