title: AWS device farm react native appium nodejs webdriverio test's not working
body: <p>I have created test for React Native application using Appium and WebdriverIO, it&#39;s working fine locally on an android emulator and on a real device, but its not working on AWS device farm.
  This tutorial <a href="https://medium.com/jetclosing-engineering/react-native-device-testing-w-appium-node-and-aws-device-farm-295081129790" rel="nofollow noreferrer">https://medium.com/jetclosing-engineering/react-native-device-testing-w-appium-node-and-aws-device-farm-295081129790</a> I followed to create a test.</p>
  
  <p><strong>Issue is</strong></p>
  
  <pre><code>[0-0] 2020-05-06T14:01:27.360Z INFO webdriver: COMMAND findElement("accessibility id", "app-root")
  [0-0] 2020-05-06T14:01:27.370Z INFO webdriver: [POST] http://127.0.0.1:4723/wd/hub/session/5a7350a3-e8c2-4c9e-b31a-347ea4defcdb/element
  [0-0] 2020-05-06T14:01:27.370Z INFO webdriver: DATA { using: 'accessibility id', value: 'app-root' }
  [0-0] 2020-05-06T14:01:27.378Z INFO webdriver: COMMAND findElement("accessibility id", "loginEmail")
  [0-0] 2020-05-06T14:01:27.388Z INFO webdriver: [POST] http://127.0.0.1:4723/wd/hub/session/5a7350a3-e8c2-4c9e-b31a-347ea4defcdb/element
  2020-05-06T14:01:27.388Z INFO webdriver: DATA { using: 'accessibility id', value: 'loginEmail' }
  2020-05-06T14:01:27.390Z INFO webdriver: COMMAND findElement("accessibility id", "app-root")
  2020-05-06T14:01:27.393Z INFO webdriver: [POST] http://127.0.0.1:4723/wd/hub/session/5a7350a3-e8c2-4c9e-b31a-347ea4defcdb/element
  2020-05-06T14:01:27.393Z INFO webdriver: DATA { using: 'accessibility id', value: 'app-root' }
  [0-0] TypeError in "Simple App testing Valid Login Test"
  $(...).setValue is not a function
  [0-0] 2020-05-06T14:01:27.426Z INFO webdriver: COMMAND deleteSession()
  [0-0] 2020-05-06T14:01:27.426Z INFO webdriver: [DELETE] http://127.0.0.1:4723/wd/hub/session/5a7350a3-e8c2-4c9e-b31a-347ea4defcdb
  [0-0] 2020-05-06T14:01:28.306Z WARN webdriver: Request failed with status 500 due to An unknown server-side error occurred while processing the command. Original error: Could not proxy command to remote server. Original error: Error: socket hang up
  </code></pre>
  
  <p>The same issue is for waitForDisplayed <strong>$(...).waitForDisplayed is not a function</strong></p>
  
  <p>Test file</p>
  
  <pre class="lang-js prettyprint-override"><code>var expect = require('chai').expect;
  
  describe('Simple App testing', () =&gt; {
  
    it('App is loaded', async function () {
      expect($("~app-root")).to.exist;    
  });
  
    it('Valid Login Test', async =&gt; {
      $("~app-root");
      $('~loginEmail').setValue("customer11@yopmail.com");
      $('~loginPassword').setValue("123456");
  
      $("~login").click();
      //$("~app-root").waitForDisplayed(11000, false);
  
      expect(true).to.equal(true);
    });
  });
  </code></pre>
  
  
  
  <p>Package.json file</p>
  
  <pre class="lang-js prettyprint-override"><code>{
    "name": "tests",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
      "test": "npm install &amp;&amp; npx wdio ./wdio.conf.local.js",
      "package": "npm install &amp;&amp; npm-pack-zip"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "dependencies": {
      "@wdio/cli": "^6.1.2",
      "@wdio/local-runner": "^6.1.2",
      "@wdio/mocha-framework": "^6.1.0",
      "@wdio/spec-reporter": "^6.0.16",
      "@wdio/sync": "^6.1.0",
      "wdio-chromedriver-service": "^6.0.2",
      "chromedriver": "^81.0.0",
      "chai": "^4.2.0",
      "webdriverio": "^6.1.2"
    },
    "devDependencies": {
      "npm-bundle": "^3.0.3",
      "npm-pack-zip": "^1.2.7"
    },
    "bundledDependencies": [
      "@wdio/cli",
      "@wdio/mocha-framework",
      "@wdio/local-runner",
      "@wdio/spec-reporter",
      "@wdio/sync",
      "webdriverio",
      "chai",
      "chromedriver",
      "wdio-chromedriver-service"
    ]
  }
  </code></pre>
  
  
  
  <p>wdio.config.js file</p>
  
  <pre class="lang-js prettyprint-override"><code>exports.config = {
  
      runner: 'local',
  
      specs: [
          './test/specs/**/*.js'
      ],
      exclude: [
          // 'path/to/excluded/files'
      ]
      maxInstances: 1,
      capabilities: [{    
          maxInstances: 1,
          appWaitDuration: 100000,
          appWaitActivity: '*'
      }],
      logLevel: 'info',
      bail: 0,
      baseUrl: 'http://localhost',
      path: '/wd/hub',
      waitforTimeout: 10000,
      connectionRetryTimeout: 120000,
      connectionRetryCount: 3,
      services: ['appium'],
      port: 4723,
      framework: 'mocha',
  
      reporters: ['spec'],
  
      mochaOpts: {
          ui: 'bdd',
          timeout: 60000
      },
  }
  </code></pre>
  
  
  
  <p>Yml file install and test phases</p>
  
  <pre class="lang-js prettyprint-override"><code>phases:
    install:
      commands:
        - npm install -g appium
        - export APPIUM_VERSION=1.17.0
        - avm $APPIUM_VERSION
        - ln -s /usr/local/avm/versions/$APPIUM_VERSION/node_modules/.bin/appium  /usr/local/avm/versions/$APPIUM_VERSION/node_modules/appium/bin/appium.js
  
        - cd $DEVICEFARM_TEST_PACKAGE_PATH
        - echo $DEVICEFARM_TEST_PACKAGE_PATH
        - npm install
  
    test:
      commands:
        - echo "Navigate to test source code"
        - cd $DEVICEFARM_TEST_PACKAGE_PATH/node_modules/*
        - echo "Start Appium Node test for Qbunk Android"
        - ls
        - echo $DEVICEFARM_TEST_PACKAGE_PATH
        - npm install
        - echo "Installing wdio"
        - npm install --save webdriverio @wdio/cli
        - echo "Installing chai"
        - npm install --save chai
        - npx wdio $DEVICEFARM_TEST_PACKAGE_PATH/wdio.conf.js --spec $DEVICEFARM_TEST_PACKAGE_PATH/test/specs/*.js          
  </code></pre>
  
  
  
  <p>Interesting thing is that this <a href="https://aws.amazon.com/blogs/mobile/testing-mobile-apps-across-hundreds-of-real-devices-with-appium-node-js-and-aws-device-farm/" rel="nofollow noreferrer">https://aws.amazon.com/blogs/mobile/testing-mobile-apps-across-hundreds-of-real-devices-with-appium-node-js-and-aws-device-farm/</a> AWS tutorial I followed and write my test with <strong>wd</strong> working fine on AWS Device farm.</p>
  
  <p>Kindly let me know if you need more information.
  Thanks</p>