Commit Graph

48 Commits

Author SHA1 Message Date
sebv d971f72c46 stricter jshint rules enforcable from editor 2014-01-29 14:03:34 +08:00
Romain Criton 1b488f74e0 Add mobile: methods on Android: toggleData, toggleFlightMode, toggleWiFi, toggleLocationServices
Original commit message: didLaunch flag is set at the end of launch sequence

"Ping" ADB to check whether we're still connected

On Android Emulator, ADB is disconnected when we toggle Airplane Mode
or mobile Data. However, the problem does not manifest itself when
querying the list of devices via adb devices: the emulator is still
listed. After attempting to ping the emulator via a shell command, the
emulator is no longer listed and a kill-server is necessary to get ADB
back up and running

Partial recovery from a loss of ADB connection caused by turning off the data connection in the emulator

Conditionnally restart UI Automator in case of unexpected exit, mainly to address the use case of disconnecting the netwok on Android Emulator, which triggers a loss of ADB connection, and subsequently UI Automator connection

New method mobile: toggleData on Android

toggleData method on iOS

toggleFlightMode method

Make toggleData and toggleFlightMode mobile methods available for Selendroid

Fix indentation

Make sure we recover from ADB connection loss on Selendroid when disabling data on emulator

On Android emulator the ADB connection is lost when we disable the data
connection. On Android the ADB connection loss is handled by the UI
Automator exit handler, on Selendroid it must be handled in the toggle
method

Fixed indentation

Fixed ping method

Do not look for exact match in stdout

Reset uiautomatorRestartOnExit flag after we've disabled data connection

Refactor UI Automator exit handler and add a flag to completely ignore UI Automator exit

When we disconnect the network (via either disabling 3G or enabling
Flight Mode), the official Android emulator loses the ADB connection.
However, sometimes the UI Automator exit handler is not called until
the next attempt to send an ADB command. So we introduce a flag to tell
the UI automator exit handler to do nothing, i.e. neither restart UI
Automator nor uninstall the app, we take care of ADB and UI automator
reconnection before sending the next ADB command

Refactor toggleSetting code and handle ADB reconnection

Refactored the toggleSetting code in order to separate the code common
to both Android subplatforms, and code specific to either platforms
(UIAutomator and Selendroid)
Made sure UI Automator restart is handled in the toggleSetting code and
not in the UI Automator exit handler

Selendroid method for handling ADB disconnection in Emulator when turning network connection off

Right keyevent combination to position the focus on Airplane Mode checkbox for API <= 15

On Android 4.1+ (API 16+) there's a "Parent" button in the
AIRPLANE_MODE_SETTINGS Activity's ActionBar, whereas on earlier
versions there's no "Parent" button, so we need to take this into
account when performing the key sequence to position the focus on the
Airplane Mode checkbox

Generic mechanism to let each "toggle" method provide the sequence of key to position the focus

Each "toggle" mobile method may require a different sequence of keys in
order to position the focus within the corresponding Settings Activity.
Now this sequence is dynamically provided by each "toggle" method

mobile: toggleWiFi implementation

Remove blank line

mobile: toggleLocationServices implementation

When toggling LocationServices ON there's a dialog asking for user
confirmation, so we introduce a mechanism that lokks for this dialog
and acknowledge it, but if the dialog doesn't show up we proceed to
exit the settings activity

Adapt key sequence for toggleLocationServices on Android API 16

Fix bug on Kitkat when re-enabling Location Services

On Kitkat when re-entering the Location Services Activity after
disabling it, no UI element has the focus and no key press can let the
target switch grab the focus. The workaround is to make sure an element
has the focus by issuing a key press prior to opening the Location
Services activity.

Fix lint error (mixed tabs and spaces)

Fix lint error (mixed tabs and spaces)

Add comments

Spaces after if

Move variable definition

Shorten variable names

Remove dead code

Move restartAdb method to ADB (and rename to restart)

Rename rr variable to err

Android Test app for "mobile: toggle…" methods

Test script for "mobile: toggle…" methods

Refactoring of toggle test script to avoid code duplication

Adding other toggle methods

Fix lint warning

Handle an unexpected exit of logcat (for instance if ADB itself exits unexpectedly)

Make sure we can restart logcat after stoping it

Stop and restart logcat when restarting ADB

Fix UiAutomator state variable to prevent blocking when restarting UiAutomator

Refactored toggle test to allow testing on both Android and Selendroid

Get rid of the arbitrary timeout to account for ADB disconnection on emulator

When disconnecting the network connection through the "mobile: toggle"
methods, we no longer wait for an arbitrary period of time for the ADB
connection to go down.
Instead, we forcibly shut down ADB and restart it
2014-01-21 22:42:40 +00:00
Payman Delshad f4a1b6fcaf Implemented drag for iOS.
- Use same drag API on iOS and Android.
- Fixed some indentations.
2014-01-21 10:49:18 +01:00
Jonathan Lipps b67440ad0b if we have trouble proxying, best to actually error to the client 2014-01-08 10:02:27 -08:00
Dan Cuellar 82d49d0c7d Adding flag to show simulator logs 2014-01-07 14:09:18 -08:00
Jonathan Lipps 27d482074c Merge pull request #1679 from bootstraponline/shell
Fix appium shell
2014-01-03 01:14:46 -08:00
bootstraponline f603af0684 Fix appium shell
node appium.js --shell
2013-12-26 21:09:30 -05:00
Jonathan Lipps 31bd697cf4 add ability to set launch timeout from the command line so it can be used in conjunction with pre-launch 2013-12-20 10:57:42 -08:00
Jonathan Lipps 42bd48bc36 actually, selendroid does need to support a few mobile methods as it turns out! cc @rockbot 2013-12-19 15:43:48 -08:00
Jonathan Lipps e08970b75d Merge pull request #1657 from jlipps/safari7
Safari on iOS 7
2013-12-19 13:36:21 -08:00
Jonathan Lipps eefb31edfc Merge pull request #1634 from grz0/master
Catch SyntaxError exception and log nice error message
2013-12-18 15:56:27 -08:00
Jonathan Lipps c9b6f55739 Merge pull request #1645 from rockbot/master
politely informs user that mobile commands don't work in selenium
2013-12-18 15:56:02 -08:00
grz0 f23748c29d Catch SyntaxError exception and log nice error message 2013-12-19 00:01:50 +01:00
Jonathan Lipps a4f82c31cd remove safari launcher as strategy for safari + sim 2013-12-18 14:03:30 -08:00
Jonathan Lipps 4a1cc2580c refactor instruments and add appium-internal flake support
This commit constitutes a pretty big refactor of the instruments
process handler. It also introduces a server flag, '--backend-retries',
with a default of '3', which specifies how many times Appium will retry
launching instruments before giving up and saying that it crashed or
timed out. This works in concert with launchTimeout, of course.

I think this refactor also fixes some longstanding callback reasoning
errors and maybe some other bugs.

It might also introduce some bugs of its own though :-)
2013-12-18 13:34:49 -08:00
rockbot 91caf798f7 politely informs user that mobile commands don't work in selenium
adds extra test to ensure it's the mobile: error message that's getting sent
2013-12-18 11:43:29 -08:00
Jonathan Lipps 24e899bdca make sure show-config works with npm (fix #1630) 2013-12-17 11:10:48 -08:00
Jonathan Lipps 1ebc3dd655 make sure we don't start FQInstruments on non-mac or mac < 10.9 (fix #1585) 2013-12-10 13:36:43 -08:00
Jonathan Lipps abe22334b1 refactor server/main
and add --merciful flag to avoid the force quit instruments watcher
2013-12-10 13:25:58 -08:00
Jonathan Lipps 4e3caf7043 Merge pull request #1602 from bootstraponline/master
Pipe force quit logs to console
2013-12-10 12:30:18 -08:00
bootstraponline 5181bb90dd Pipe force quit logs to console
info: [ForceQuitUnresponsiveApps] 2013-12-10 15:11:16.424 ForceQuitUnresponsiveApps[56799:507] Force quit unresponsive instruments v0.0.1
info: [ForceQuitUnresponsiveApps] 2013-12-10 15:11:42.708 ForceQuitUnresponsiveApps[56799:507] Force quitting: 'freeze2' at 'file:///Users/user/ForceQuitUnresponsiveApps/freeze2/./bin/freeze2.app/Contents/MacOS/instruments'
2013-12-10 15:12:11 -05:00
Jonathan Lipps 7b770c8411 add lots more tests for command timeout
testing setting via desired caps as well
also, make it so passing in 'false' also disables timeout
2013-12-10 11:46:07 -08:00
Matt Isaacs d0a1968fd0 Setting newCommandTimeout capability to 0 disables timeout. 2013-12-10 12:31:27 -05:00
Jonathan Lipps 6319f734b8 allow user to let instruments launch device with --default-device 2013-12-09 14:44:23 -08:00
Jonathan Lipps 0edd3a629d make sure --show-config doesn't crash main server :-) 2013-12-09 14:39:51 -08:00
Jonathan Lipps 52bb752773 add --show-config flag to show appium config, and include server build time 2013-12-09 14:13:42 -08:00
Jonathan Lipps 99f0c16d9a make sure we don't discount web locators in webviews 2013-12-04 12:24:31 -08:00
Jonathan Lipps f4477adfd1 fail sooner if user passes in a bad locator strategy (fix #1539) 2013-12-04 09:48:55 -08:00
bootstraponline eaa6cb3d18 Recover from unresponsive instruments process
Register for kCGSNotificationAppUnresponsive and if the process is Instruments then terminate it.
This enables Appium to continue even when instruments is unresponsive. The current behavior is to wait forever.

To test this feature works properly, run ./instruments.sh from https://github.com/appium/ForceQuitUnresponsiveApps

instruments.sh will launch a process that's unresponsive and appium will force quit the process. The unresponsive process can be visually confirmed by using OS X Activity Monitor.
2013-12-03 14:07:38 -05:00
Dan Cuellar 94f4e3eb69 select your iOS Simulator Device 2013-11-18 14:46:11 -08:00
Curtis Siemens 3d58646824 Adding the ability to get node path out of .appiumconfig (for users who modify .appiumconfig) 2013-11-14 17:37:00 -08:00
bootstraponline 338c54664f Merge pull request #1467 from paymand/log_no_colors
Make sure there's no color in the console output when --log-no-colors is used.
2013-11-14 13:18:48 -08:00
Payman Delshad 0c85864f43 Make sure there's no color in the console output when --log-no-colors is used. 2013-11-13 20:26:18 +01:00
Dan Cuellar 7b1e1badce Set iOS Simulator Language using ios-sim-locale from https://code.google.com/p/ios-sim-locale/ 2013-11-11 13:01:10 -08:00
Jonathan Lipps 1209d4b22a make sure command timeout is reset for proxied devices too (fix #1404) 2013-11-01 10:19:45 -07:00
Jonathan Lipps f73a030ad9 add logging initialization in bin/appium so npm will work (fix #1381) 2013-10-29 14:40:15 -07:00
Jonathan Lipps 3ba0e3f0c6 add --log-timestamp and --log-no-colors options
also clean up and consolidate logging code
2013-10-28 16:36:32 -07:00
Jonathan Lipps 805c55d464 command timeouts should be handled centrally by appium, not by each device 2013-10-28 11:39:50 -07:00
Jonathan Lipps b537c4ae71 remove confusing multiple session handling code
it doesn't actually do anything and was cruft
also, make session overriding non-default based on the mobile
JSONWP discussions
2013-10-28 11:39:50 -07:00
Payman Delshad 6aeb26574f Don't set Content-Length header for http POSTs with empty body. 2013-10-25 19:20:28 +02:00
Jonathan Lipps 4ae0cd9c28 upgrade express so we don't get warning messages 2013-10-24 10:49:33 -07:00
Payman Delshad 85f0b3aa73 (Android) Don't uninstall the app on fast reset. 2013-10-24 14:58:09 +02:00
Jonathan Lipps 64f5619331 move uiauto stuff into ios/ and extract status and xpath libs 2013-10-17 12:33:48 -07:00
Jonathan Lipps 3373f2ec46 upgrade npm packages 2013-10-17 10:30:12 -07:00
Jonathan Lipps 8a4641bb83 grid register belongs with server 2013-10-17 10:30:11 -07:00
Jonathan Lipps 9d323a3a35 move logic common to devices into devices dir 2013-10-17 10:30:11 -07:00
Jonathan Lipps 2878e62aa5 move more functionality into server/ 2013-10-17 10:30:11 -07:00
Jonathan Lipps 31c49f590d move server-related stuff into lib/server 2013-10-17 10:30:11 -07:00