110 Commits
Author SHA1 Message Date
Dan Graham a9650d7c19 Fix broken Proxy logic for W3C (#170)
* Moved 'ProxyRequestError' handling outside of the MJSONWP block.
  * When it's a proxy error, Appium translates the error (based on statusCode) to it's proper Error
  * W3C weren't doing this when ProxyRequestError was being used
  * Now W3C translates proxy errors
* Added tests in `mjsonwp-e2e-specs` that test JWProxy
  * Test successful 200 proxies
  * Tested unsuccessful responses to see that a JSONWP response with status = 6 would return the correct 'NoSuchDriverError' with statusCode = 404
2018-01-16 08:43:00 -08:00
Dan Graham 98251e0b4f Check that W3C capabilities is a plain object (#171)
* If 'capabilities' and 'desiredCapabilities' were provided, and 'capabilities' is NOT a plain object, fall back to 'desiredCapabilities'
* Added more logging to the W3C vs. MJSONWP determination logic
* Rename `createSession` args to be more descriptive
* Added basic W3C unit tests for above fix
2018-01-15 14:49:36 -08:00
Mykola Mokhnach 9229a58ea4 Update parameters list for start_recording_screen/stop_recording_screen endpoints (#168) 2018-01-12 16:41:04 +01:00
Dan Graham 6902a9fc0a Fix problems with W3C responses (#166)
* Make malformed caps return 400 error
  * Add InvalidArgumentTypeError to errors
  * Made 'NotYetImplementedError' the 405 (Method Not Allowed) status code
  * Made errors in 'createSession' return InvalidArgumentTypeError
* Fix incorrect W3C responses
  * Add w3c status for NotImplemted and NotYetImplemented
  * Changed `getResponseForW3CStatusError` so that throws an unknown error if the exception isn't a w3c exception
  * Checks for property `w3cStatus` to confirm if it's a proper protocol-blessed exception
* Moved logic that reassigned errors into MJSONWP blocks; W3C shouldn't reassign errors because they all have proper status codes
* Added endpoint tests that check that you can create sessions in W3C and that subsequent calls to the session return the correct responses
2018-01-11 16:47:46 -08:00
Kazuaki Matsuo 31f16ac92f Fix implicit wait for w3c (#164)
* fix timeouts for w3c

* revert lock file

* add validation for previous timeouts

* implement custom validator for W3C

* improve if condition

* define isW3CProtocol

* rewrite validation a bit

* apply util.hasValue and string protocol

* add tests

* refactor timeouts for mjsonwp and w3c

* use const

* remove previous timeouts

* use undefined

* rename to timeouts again

* wrap some commands

* remove ...args

* define each command
2018-01-12 08:55:38 +09:00
Dan Graham 45e31b15ac Set automations in one file (#167)
* Made an 'automations.js' file that lists all valid automations as an Object instead of hard-coding it
* appium/appium will use this instead of hardcoding automation names
* Make desired-caps pull in the values of those automations for validation instead of hard-coding them
* Expose 'validAutomations' to Driver object
2018-01-11 10:07:33 -08:00
Dan Graham 281916ffee W3C remediations (#165)
* Fixed a defect in 'firstMatch' validation
  * Previously, it was validating the firstMatch capabilities and was failing on the first validation failure, which is a problem if firstMatch has a length > 1 and it fails before finding a potentially passing capabilities set is found
  * Now, it doesn't error-out on the first failure. If it fails, it skips over it to the next one until it finds one that passes and returns that.

* Altered the 'presence' constraint validation
  *  Don't validate 'presence' on 'alwaysMatch' because if a capability isn't present on 'alwaysMatch' it may be present in one of the 'firstMatch' capabilities
  *  Validate presence on all of the 'firstMatch' capabilities, except for the keys that are present in 'alwaysMatch'. If the key is in 'alwaysMatch', strip out the presence constraint because we know that it has passed already

* Changed the default protocol
  * If MJSONWP _and_ W3C are provided, initiate a W3C session by default. If clients are passing in W3C parameters to create a session, we can safely assume that they've implemented the rest of the W3C spec

* Improved error logging
  * If errors were found, show a message saying `Could not find matching capabilities: ${errors}` where `errors` are a list of all the validation error messages for each of the attempts to validate `firstMatch` caps
  * If `firstMatch` caps has a length of one, then don't show the message saying `Could not find matching capabilities` portion of it, just show the errors

* Other remediations
  * Allow `alwaysMatch` and `firstMatch` to be `null` or `undefined`
  * Added single quotes around names of capabilities when showing their errors
2018-01-10 10:37:11 -08:00
Kazuaki Matsuo 1bc64380c5 add getting active element for w3c (#163) 2018-01-04 20:13:27 +09:00
Dan Graham b7a99abc91 w3c CreateSession response (#161) 2017-12-22 13:20:52 -08:00
Dan Graham 376a0d3089 Make it so that 'status' is only returned for MJSONWP (#160)
Also:
* Make the 'fake-driver' a MJSONWP driver
* Fix unit tests that were broken when being called in 'appium-fake-driver'
2017-12-22 12:20:48 -08:00
Dan Graham d41b3629aa Don't validate 'presence' on firstMatch caps (#159)
* Doesn't make sense to validate 'presence' in the firstMatch caps, because the firstMatch caps extend alwaysMatch
* Only 'alwaysMatch' should validate 'presence'
2017-12-21 09:55:27 -08:00
Mykola Mokhnach 1a91bec967 Support pre-W3C element screenshot endpoint (#154) 2017-12-15 16:03:06 -05:00
Dan Graham 53de387100 Handle capabilities prefixes (#153)
* Strip out 'appium:' prefixes
* Reject standard capabilities that contain the 'appium:' prefix
* Expose 'processCapabilities' as API method
2017-12-13 14:53:05 -08:00
Dan Graham 090d94795a Add W3C /actions endpoint (#146) 2017-11-21 04:54:39 -08:00
Dan Graham 4d2a5bd000 w3c routes (#147)
* Add aliased W3C routes
* Implement getTimeouts command
* getTimeouts returns an object containing all the timeouts and their values as key-value pairings
* Added routeHandler too
* Added w3c routes
2017-11-21 04:54:39 -08:00
Dan Graham 308e560ca1 W3C Error Formatting (#145)
* Remember protocol requested in createSession
  * Also renamed 'processCaps' to 'processCapabilities'
  * Checks the parameters in 'createSession' and determines if it's W3C or MJSONWP
* Add W3C error format
  * Add W3C status codes to errors
  * When deciding error format to return in mjsonwp.js, check format and then return eitherJSONWP or W3C format
2017-11-21 04:54:39 -08:00
Stu Duffy 6bda0705b7 Small correction to URI scheme validation (#151) 2017-11-16 07:23:55 -05:00
cschabetsberger-micro-focus b7b0b7b2f3 Detect a non-working chromedriver connection after androidDriver.closeApp() and androidDriver.launchApp() (#136)
* * Make sure to detect a non-working chromedriver connection after calling androidDriver.closeApp() and androidDriver.launchApp() by returning the result body (resBody) only if it does not contain a status code

* Adapted unit test to cover the case when chromedriver responds with http
200 but status code != 0 (which represents an error)
Also fixed a typo in another test description
2017-10-13 09:05:02 -04:00
Isaac A. Murchie 4d47b73c3d Add static page with app banner (#138) 2017-09-11 07:32:29 -04:00
Isaac A. Murchie 6d8a5712a8 Move non-unit tests into e2e tests (#135)
* Move non-unit tests into e2e tests

* Make sure e2e tests are run on travis
2017-08-21 15:11:16 -04:00
Mykola Mokhnach 8481b9ac7c Add 'enabled' parameter to toggle_touch_id_enrollment endpoint (#130)
* Add 'enabled' parameter to toggle_touch_id_enrollment endpoint

* Update the hash
2017-08-16 14:35:52 -04:00
Isaac A. Murchie 01e9914b66 Update linting and add coverage (#131) 2017-08-15 08:53:47 -04:00
Bruno Alassia 8cd54941a3 Add new endpoints (#129)
* add routes for new emulator methods

* add networkSpeed method

* update hash
2017-08-08 16:47:25 -04:00
Isaac A. Murchie 3bffc168b8 Allow downloaded app urls to have query strings (#125)
* Allow downloaded app urls to have query strings

* Readjust some of the work
2017-07-07 07:24:59 -04:00
Jonathan Lipps acd890bb20 fix bug in DeviceSettings where we could mutate external object 2017-06-15 14:35:33 -07:00
Isaac A. Murchie 190a896d9c Add route to get current package (#123) 2017-06-15 07:07:25 -04:00
Jonathan Lipps 1991379a00 allow both 'value' and 'text' params for setValue (#121)
* allow both 'value' and 'text' params for setValue

this introduces a 'makeArgs' option for the spec which allows handling of more complex scenarios.

* clarify some variable names and add fuller commentary
2017-05-30 11:13:17 -04:00
Dan Graham 0bf5acbd52 Removed adm-zip (#118)
* Added a test for unzipFile (which uses adm-zip)
* Tested that it worked with adm-zip and then failed once adm-zip was taken out
* Replaced 'adm-zip' with zip.extractAllTo from appium-supprt
2017-04-26 17:55:46 -07:00
Dan Graham 9d1b2cedae Implemented capabilities spec (#117)
* Update  hash

* Add validateCapabilities and parseCapabilities

* Added merge capabilities

* Moved capabilities into it's own file

* Added capabilities as a possible required param

* Can pass desiredCapabilities or capabilities into createSession

* Remove 'required' desiredCapabilities

* desiredCapabilities isn't required any more because we can provide capabilities as well
* Will need to  update validation logic in 'driver.createSession' to do the validation there instead

* Code cleanup

* Skip presence constraint in parseCapabilities

* We don't need to check that items are present until after we've formed the matched capabilities

* Added validation function to routes

* Function 'validate' takes params as an arg and then returns a message if the validation fails
* Uses this to validate that either "capabilities" or "desiredCapabilities" was provided

* Renamed capabilities to caps

* Move caps required validator from process to parse

* Removed InvalidParametersError

* Update BadParametersError so that if a message is added as the 3rd argument it shows a different error message

* Made validation re-usable
2017-04-07 15:12:12 -07:00
Isaac A. Murchie 1a34f6b989 Fix casing on record screen endpoints (#115) 2017-03-29 13:00:15 -04:00
heeseon hwang 363fdacbf7 record the screen while testing (#114)
* record the screen while testing

* Update routes-specs.js
2017-03-23 07:31:18 -04:00
Dan Graham 684ca3621b Add toggle_touch_id_enrollment endpoint (#112)
* Add toggle_touch_id_enrollment endpoint

* Update  hash
2017-03-22 18:54:12 -04:00
Jonathan Lipps d75bde2a0e add event timing framework to base driver 2017-03-03 13:41:02 -08:00
Mykola Mokhnach a6e522d619 Add helper method for matching endpoints and method names to command names (#104) 2017-02-15 07:39:07 -05:00
Kazuaki MATSUO 24842637b1 update hash 2017-02-01 22:44:45 +09:00
Jonathan Lipps 0ad8e49b8e error out if someone tries to use both fullReset and noReset together 2017-01-31 14:17:36 -08:00
Max Hawkins 4b62dac30b Default to application/json when no Content-Type is supplied
The webdriver spec specifies that requests where the method is POST
should be parsed as JSON (see https://www.w3.org/TR/webdriver/#processing-model step 6).

Appium is too restrictive. It only parses as JSON if the application/json
Content-Type is provided, making it incompatible with some Webdriver clients
that follow the spec but don't send a Content-Type header.

This commit makes Appium less restrictive by defaulting to the application/json
Content-Type if none is provided.
2017-01-21 14:46:11 -06:00
Isaac A. Murchie eb5abb8878 Merge pull request #97 from appium/isaac-logger
Remove logger, and start using one from appium-support
2016-12-21 15:20:56 -05:00
Isaac Murchie 1de1af6b0c Remove logger, and start using one from appium-support 2016-12-20 12:55:23 -05:00
Isaac Murchie 65807af9fc Do not keep adding sessionId and id to optional parameters 2016-12-20 10:37:23 -05:00
Jonathan Lipps 55fa89153e Merge pull request #93 from appium/isaac-logger
Move appium-logger into base driver
2016-11-24 11:01:40 -08:00
Isaac Murchie d2c5caafd4 Move appium-logger into base driver 2016-11-23 09:15:38 -08:00
황희선 0fd67e4efb add apis to read capability data 2016-11-19 03:09:49 +09:00
Isaac A. Murchie f09b0eb2de Merge pull request #88 from midopa/fix-zip-urls
Fix handling non-ZIP files
2016-11-14 14:41:21 -05:00
Sam Park 71be0dad1a Add routes and docs for device commands
For: https://github.com/appium/appium-android-driver/pull/192
2016-11-14 10:50:29 -08:00
Sam Park 40a9538321 Fix handling non-ZIP files
APK files were not being installed because they were being written to a file without an "apk" extension. So added back the appExt suffix logic. If it's given and the downloaded file is not a ZIP file, then everything behaves normally. If the downloaded file is a ZIP file, then regardless of what we thought initially, it will be unzipped and placed into another temp location.
2016-11-11 23:21:02 -08:00
Isaac Murchie e1f1883363 Add capabilities to create session 2016-10-28 09:10:29 +02:00
Ali Kia 725d12ec2d adding fingerprint to routes 2016-09-12 10:32:09 +08:00
Isaac A. Murchie 8bd05f3e76 Merge pull request #73 from wfanforever/master
adding rect routes
2016-09-09 14:05:10 -04:00
Wen Fan d4e5b45544 adding new endpoint 2016-09-09 10:21:20 -07:00