I followed the steps from https://medium.com/@dabit3/testing-mobile-applications-across-hundreds-of-real-devices-with-appium-node-js-aws-device-farm-b749aefd651a and created a zip file and uploaded the same to aws device farm in device run. However, when i start the run, i get the error,
[DeviceFarm] echo "Start Appium Node test"
Start Appium Node test
[DeviceFarm] node autoappium.js
internal/modules/cjs/loader.js:605
throw err;
^
Error: Cannot find module '/tmp/scratch_91u_u.scratch/test-packageRAeuW_/autoappium.js'
I am not sure how the device farm tries to identify my autoappium.js file. The folder structure of the tar file is, package --node_modules --package.json --autoappium.js
can someone please explain how the folder is structured during test run in device farm.
Thanks in advance
I work on the Device Farm team.
From the output you have shared there could be a few possible reasons.
The default test spec file used in Device Farm has a command in the test phase which is:
"- cd $DEVICEFARM_TEST_PACKAGE_PATH/node_modules/*"
Since it is not finding the file autoappium.js you want to check if this line was removed from your test spec file.
Check installation of node modules in the test spec file under the "install" phase. This looks like:
echo "Navigate to test package directory
cd $DEVICEFARM_TEST_PACKAGE_PATH
npm install *.tgz
If the modules are not installed then the files would not be picked up.
Do you run the test using the same command locally? "node autoappium.js"
If not, then you should use the same command in place of "- ./node_modules/mocha/bin/mocha test_native_ios.js" as shown in the test spec file comment.
Hope this helps. If this does not resolve, please share the run URL of from the console and I should be able to help you forward with it.