Code Monkey home page Code Monkey logo

mcloud's Introduction

Zebrunner MCloud

Zebrunner MCloud is a Device Farm for automated test execution (Appium) and remote web access by humans to physical devices (Android and iOS) including phones, tablets, and TVs. It is fully integrated into the Zebrunner (Community Edition) ecosystem and can be used both for manual and automated testing.

  • It is built on top of OpenSTF and supports iOS devices remote control.

Feel free to support the development with a donation for the next improvements.

Zebrunner

System requirements

Hardware requirements

Requirements
Operating System Ubuntu 16.04 - 21.10
Linux CentOS 7+
Amazon Linux 2
MacOS
CPU 4+ Cores
Memory 16 Gb RAM
Free space SSD 32Gb+ of free space

Software requirements

  • Installed Docker v19+

  • Installed Docker compose as a plugin

  • Installed git 2.20.0+

Usage

  1. Clone mcloud and set up:
    git clone https://github.com/zebrunner/mcloud.git && cd mcloud && ./zebrunner.sh setup
    

    Provide valid protocol, hostname, and port

  2. Start services ./zebrunner.sh start
  3. Open http://hostname:80/stf
  4. Log in using any name/email values as auth-mock is configured by default
  5. Goto Settings->Keys and generate new Access Token
  6. Paste generated token into the variables.env for STF_TOKEN var
  7. Restart services using ./zebrunner.sh restart
  8. Set up the servers with Android and iOS devices according to mcloud-agent

    mcloud-ios is deprecated. Use the same mcloud-agent to setup on MacOS too!

  9. Use http://hostname:80/mcloud/grid/console to see connected devices and http://hostname:80/mcloud/wd/hub as Selenium/Appium hub url for test automation.

Follow the installation and configuration guide in Zebrunner CE to reuse MCloud components effectively for Test Automation.

Components

  • mcloud-agent - Device Farm agent for connecting physical Android and iOS devices including phones, tablets, and TVs via Linux or MacOS.
  • mcloud-device - Dockerized STF provider image for Android and iOS devices.
  • mcloud-grid - Enhanced Selenium Grid for automating physical devices and emulators/simulators via Appium.
  • appium - Enhanced Appium image with low-level video recording and local storage for ipa/apk artifacts.
  • mcloud-redroid - GPU accelerated Android In Cloud solution

Documentation and free support

License

Code - Apache Software License v2.0

Documentation and Site - Creative Commons Attribution 4.0 International License

mcloud's People

Contributors

avabishchevich avatar dimagrinevich avatar ezequielomar avatar ilya-varchenya avatar vdelendik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mcloud's Issues

Impossible run ansible-playbook without error on mac

Execute:
ansible-playbook -vvv -i hosts devices.yml --tags "registerDevice"

Error message appears:
fatal: [localhost]: FAILED! => {
"ansible_facts": {},
"changed": false,
"failed_modules": {
"setup": {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"deprecations": [
{
"msg": "Distribution Ubuntu 16.04 on host localhost should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information",
"version": "2.12"
}
],
"failed": true,
"module_stderr": "sudo: a password is required\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
},
"msg": "The following modules failed to execute: setup\n"
}

iOS: improve syncAppium doing devices/simulators verification at once

we do verification onto the connected devices per each device in device.txt, for example:
device=instruments -s devices | grep $udid

but it make sense to move outside the while cycle and export to any temp text file all devices/simulators. Inside cycle just verify presence of the concrete uuid

iOS: improve start WDA process

in caase someone connected and whitelisted devices with newer OS version which is currently non-supported by XCode we have zombie process which always tries to start WDA.
Investigate if we can organize any exclusion list based on conditions.

Example of the implementation:

  1. improve WDA startup script to track failures like
The requested device could not be found because no available devices matched the request.
Testing failed:
        WebDriverAgentRunner:
                testRunner encountered an error (Encountered a problem with the test runner after launch. (Underlying error: Lost connection to DTServiceHub))

** TEST FAILED **

or

** TEST FAILED **
  1. as only failure detected exit from startNodeWDA.sh script and put message into the log
  2. in several cases add current device id into the exclusion list (extra metadata file or files!). No sense to start WDA if XCode doesn't support it!

increase default timeout for mcloud selenium-hub

as we have 5 min timeout on NGiNX level for mcloud we have to configure less time out for selenium-hub: GRID_NEW_SESSION_WAIT_TIMEOUT, for example 4 min, i.e. 240000

Example
selenium-hub:
image: "qaprosoft/selenium-hub:${TAG_SELENIUM_HUB}"
container_name: selenium-hub
env_file:
- variables.env
environment:
# 4min session wait timeout as 5 min is configured on NGiNX
- GRID_NEW_SESSION_WAIT_TIMEOUT=240000
- GRID_TIMEOUT=30000
ports:
- "4446:4444"
depends_on:
- stf-app
restart: always

At startup mcloud redirects to localhost

Test scenario:

1.Clone mcloud
2.Nano mcloud/docker-compose.yml
3.Change port to "80:80"
4.Open browser and enter ip instance:80/stf

Actual result: At startup mcloud redirects to localhost
Please see screenshot:

Screen Shot 2020-10-07 at 17 52 19

rename startNode* shell scripts

there is no sense to have startNodeAppium.sh in shell scripts. Current naming was born when we had single node script for everything

improve iOS services dependencies and use iSTF as the main brain

For now we implemented killing of Appium when WDA is crashed/not unavailabe/not started.
But that produce a lot of forwarding to node crashes on test layer.

So we have to make WDA verification as part of STF sync and kill STF when no appropriate wda service is detected

Command CodeSign failed with a nonzero exit code

Hello dear friends,) again have some problem on start,

Prepared all prerequisites

  • Installed XCode 12.0.1
  • Install Appium 1.18.3 - done
  • Install node v13.14.0 (npm v6.14.4) - done
  • Choose WebDriverAgentRunner and your device( iphone 7) - done
  • Choose your dev certificate - done
  • Write my phone UUID to devices.txt

Now if i start Test from xcode, i have no errors, everything fine build success and i see icon on phone. (Then i click Product -> Stop)

If i start ./startNodeWDA.sh 00e1c6ef02e0bce60a363f74a0d94a431d3000000
i will get error in log iPhone_7_wda.log

....
.......
.......
/usr/bin/codesign --force --sign 239551D2306160A055160DF32988B35984674756 --timestamp\=none /Users/myfarmacc/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu/Build/Products/Debug-iphoneos/WebDriverAgentLib.framework
/Users/myfarmacc/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu/Build/Products/Debug-iphoneos/WebDriverAgentLib.framework: replacing existing signature
/Users/myfarmacc/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu/Build/Products/Debug-iphoneos/WebDriverAgentLib.framework: errSecInternalComponent
Command CodeSign failed with a nonzero exit code


Test session results, code coverage, and logs:
    /Users/myfarmacc/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu/Logs/Test/Test-WebDriverAgentRunner-2020.10.13_21-22-11-+0300.xcresult

Testing failed:
    Command CodeSign failed with a nonzero exit code
    Testing cancelled because the build failed.

** TEST FAILED **


The following build commands failed:
    CodeSign /Users/myfarmacc/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu/Build/Products/Debug-iphoneos/WebDriverAgentLib.framework
(1 failure)
iPhone_7 device wasn't connected yet. waiting 1 sec...
iPhone_7 device wasn't connected yet. waiting 1 sec...

On top of the log see run command, there is nothing extra:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project /usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=00e1c6ef02e0bce60a363f74a0d94a431d3000000 USE_PORT=20001 MJPEG_SERVER_PORT=20002 test

tried all this solutions:
First one
Second one

  • tried to clean reboot, nothing :(

image

Hope for any help,
Thank's
Mark.

iOS: handle negative scenario for WDA startup

in caase someone connected and whitelisted devices with newer OS version which is currently non-supported by XCode we have zombie process which always tries to start WDA.
Investigate if we can organize any exclusion list based on conditions.

Example of the implementation:

  1. improve WDA startup script to track failures like
The requested device could not be found because no available devices matched the request.
Testing failed:
        WebDriverAgentRunner:
                testRunner encountered an error (Encountered a problem with the test runner after launch. (Underlying error: Lost connection to DTServiceHub))

** TEST FAILED **

or

** TEST FAILED **
  1. as only failure detected exit from startNodeWDA.sh script and put message into the log
  2. in several cases add current device id into the exclusion list (extra metadata file or files!). No sense to start WDA if XCode doesn't support it!

handle appium urls location via general nginx

Each device service register as appium url:
http://${publicIp}/stf/appium/${host}/${port}/wd/hub

So using /stf general NGiNX will redirect to stf-proxy service.
stf-proxy service should parse host and port and proxy pass to appium using private network connection

reuse bash replace instead of sed call

sed -i is not supported on mac platforms. we have to reuse replace bash functiona instead. Later it should allow to support Mac platforms for MCloud master host (for now only Linux)

investigate possibility to use locked devices

issue with unlocking iOS device is fixed: zebrunner/stf#145

in scope of this ticket let's do a research if we can organize device farm for manual and automation usage with locked screens.
benefits: not used devices sleep and lock display, i.e. no battery use

When we occupy device via STF we have to wake it up.
Also investigate how can we unlock via pin automatically by appium

'CocoaAsyncSocket/GCDAsyncSocket.h' file not found

Hello dear friends,

trying to setup IOS farm, but stack on step

Sign WebDriverAgent using your Dev Apple certificate and install WDA on each device manually

  • Install Appium 1.18.3 - done
  • Install node v13.14.0 (npm v6.14.4) - done
  • Choose WebDriverAgentRunner and your device( iphone 7) - done
  • Choose your dev certificate - done

When i try to run test i get error
'CocoaAsyncSocket/GCDAsyncSocket.h' file not found

/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgentLib/Vendor/RoutingHTTPServer/RoutingHTTPServer.m:1:9: In file included from /usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgentLib/Vendor/RoutingHTTPServer/RoutingHTTPServer.m:1:

image

Hope for any help,
Thank's
Mark.

Error at startup device

Test scenario:

1.Open ec2 instance link/stf
2.Tap to any device

Actual result: Error: Service is currently unavailable.Try to attempt later after open device

Screenshot 2021-02-24 at 17 10 20

Impossible run ansible-playbook without error on mac

Execute:
ansible-playbook -vvv -i hosts devices.yml --tags "registerDevice"

Error message appears:
fatal: [localhost]: FAILED! => {
"ansible_facts": {},
"changed": false,
"failed_modules": {
"setup": {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"deprecations": [
{
"msg": "Distribution Ubuntu 16.04 on host localhost should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information",
"version": "2.12"
}
],
"failed": true,
"module_stderr": "sudo: a password is required\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
},
"msg": "The following modules failed to execute: setup\n"
}

iOS: minimize synchronization log messages

Every sync script write into the log that it was started, finished and even "Nothing to do for..."
To minimize disk usage :) let's keep only started and actual actions...

so we have to remove in every sync script
else echo "Nothing to do for ${udid} - device name : ${name}"

and
echo date +"%T" Script finished

restarting selenium mcloud-grid too often recreate rethinkdb

during any chane in variables.env and restarting let's say mcloud-grid docker recreates rethinkdb.
STF itself is very sensitive to rethinkdb so it will be better to keep it up&running as much as possible.

Solution:
remove sharing of variables.env to rethinkdb as not needed. That's suppose to minimize number of db restarts

ios-slave set_selenium_properties values

I'm trying to run stf in iOS but I did not get the real values in the set_selenium_properties.sh file. Can someone explain me what should I set those variables?
-STF_PUBLIC_HOST
-STF_PRIVATE_HOST
-WEBSOCKET_PROTOCOL
-WEB_PROTOCOL
-hubHost
-hubPort
-STF_PUBLIC_NODE_HOST
-STF_PRIVATE_NODE_HOST

Unable to interact with some devices via STF

OS: android 7.0-9

Description:
While working with different devices sometimes we couldn't use them manually in STF due to grey screen issue. Meanwhile, all automation tests could be executed properly on the same devices.

P.S. From personal observations, this issue is actual, when device's docker container wasn't restarted for a long period of time (2+ weeks)
greyScreen

iOS: combined all agents logs in the single file

For example:
<key>StandardErrorPath</key> <string>/Users/build/tools/mcloud/logs/agent_appium.log</string> <key>StandardOutPath</key> <string>/Users/build/tools/mcloud/logs/agent_appium.log</string>

<string>/Users/build/tools/mcloud/logs/agent_appium.log</string>

Let's combine all stdout and stderr in the same file. Ideally relative one like agents.log or mcloud-agetns.log etc.
It is ok even if it will be generated inside ~/Library/LaunchAgents folder

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.