Commit Graph
8634 Commits
Author SHA1 Message Date
Dan Graham a14aa5f428 Convert JSONWP proxy errors (#188)
* Convert JSONWP proxy errors
  * Previously, if a proxied response has a status code >= 0 but http status code 200, the error is thrown but it's an unknown error because the 'getResponseForW3CError' function doesn't translate the error
  * Now, it translates the JSONWP error using logic we already have that accomplishes this
  * Added E2E test that tests a proxy that returns 200 but status 7 to check that it throws the correct ElementNotFoundError
  * Added unit test to handle the new case in 'getResponseForW3CError'
2018-02-19 09:22:01 -08:00
Mykola Mokhnach d47d597731 Add urls caching logic (#187)
* Add urls caching logic

* Tune date verification

* Fix dictionary access

* tune try/catch scope

* simplify the condition
2018-02-16 14:51:16 +01:00
Dan Graham 373c62de4d Go back to using nodeca/argparse (#10205) 2018-02-16 08:14:03 -05:00
Dan Graham 9650d66a67 Fix customSSLCert documentation error (#10155)
Should be Sim only, not Sim/Emu
2018-02-15 08:41:50 -05:00
Isaac Murchie 9c994e85c9 Bump appium-ios-driver to 2.0 2018-02-15 08:37:03 -05:00
Kazuaki Matsuo 829aafcd25 Update settings.md (#10196)
* Update settings.md

* fix review
2018-02-15 07:32:52 -05:00
Isaac Murchie b7299c420c 2.22.1 v2.22.1 2018-02-14 08:02:52 -05:00
Mykola Mokhnach d9ee071707 Properly handle unexpected socket errors (#186) 2018-02-13 16:21:57 -08:00
Dan Graham 9f9f132649 Use appium argparse (#10191) 2018-02-13 10:54:58 -08:00
Isaac A. Murchie 348eacf3d1 Move to minimum node 6 (#10180) 2018-02-12 15:03:11 -05:00
Isaac A. Murchie be2acb207c Update Contributing Docs (#10165)
* Update contributing docs

* Fix some links and examples

* Address comments
2018-02-12 07:58:15 -05:00
Daniel Graham 6a1bb47e86 2.22.0 v2.22.0 2018-02-09 13:48:11 -08:00
Isaac A. Murchie 77fe650dd6 Update android driver version (#10163) 2018-02-08 16:02:28 -05:00
Dan Graham 1c6aa98a53 Fix outdated test (#10162) 2018-02-08 15:06:48 -05:00
Mykola Mokhnach c679d534e4 Change the request type of queryAppState to POST (#185)
* Change the request type of queryAppState to POST

* Keep GET template
2018-02-08 14:38:26 +01:00
dan@saucelabs.com a5adc116d8 2.21.2 v2.21.2 2018-02-07 10:42:08 -08:00
Dan Graham b00cc4489b Parse strings for W3C and JSON (#184) 2018-02-07 10:39:15 -08:00
Dan Graham d580282b2a Reassign 'errorFromCode' to 'errorFromW3CJSONCode' (#183)
* When doing refactoring, erroFromCode was split into 'errorFromMJSONWPStatusCode' and 'errorFromW3CJsonCode'
* 'errorFromCode' was being exported as an alias for 'errorFromW3CJSONCode' to avoid breaking changes
* Should have been an alias for 'errorFromMJSONWPStatusCode' though
2018-02-06 14:19:52 -08:00
dan@saucelabs.com 361d6f1c59 2.21.1 v2.21.1 2018-02-05 11:56:38 -08:00
Dan Graham 7ffda66813 Fixed W3C error messaging (#182)
* Do proxying for W3C responses
  * If a W3C Response is provided by a proxy, map to the correct error
  * Checks if `value` is an object and `value.error` and maps it based on that (`value.error` is the W3C error code)
  * Broke off `errorFromCode` into `errorFromMJSONWPStatusCode` and `errorFromW3CJsonCode`
* Rename '.error' property to correct W3C property
  * The error property in the ProtocolError objects should match up with https://www.w3.org/TR/webdriver/#handling-errors under the 'JSON Error Code' column
  * Added tests for all of these
* Make ProxyRequestError work for W3C
  * Added an arg called `.w3c` that passes in the proxied W3C error
  * Fixed the `getActualError` function that looks for the .w3c variable and parses error from the code
2018-02-05 11:55:56 -08:00
Nick Fox b9d56049a3 Update migrating-to-xcuitest.md (#10112) 2018-02-01 11:52:49 -05:00
Isaac Murchie 2933fe45ec 2.21.0 v2.21.0 2018-02-01 08:38:13 -05:00
Mykola Mokhnach c8d1a1f7da Add an endpoint for application activation (#181) 2018-01-31 14:47:40 +01:00
Isaac Murchie 074697f061 More readable caps in docs 2018-01-30 07:22:20 -05:00
dan@saucelabs.com 1a6b05e6c1 2.20.3 v2.20.3 2018-01-29 12:54:02 -08:00
Dan Graham dc662f5181 Update protocol documentation (#180) 2018-01-29 12:44:23 -08:00
Dan Graham 97c02c8af0 Rename 'mjsonwp' to 'protocol' (#178)
* Rename 'mjsonwp' to 'protocol'
  * Renamed folder from 'mjsonwp' to 'protocol' in `lib/` and `test/`
  * Renamed 'mjsonwp.js' to 'protocol.js'
  * Renamed any import statements that use 'mjsonwp'
  * _Possible breaking change_: MJSONWireProtocol class exposed in index was renamed to just Protocol.... checked Appium repo and found no libraries that use MJSONWireProtocol
* Lint fix
2018-01-29 12:41:14 -08:00
Dan Graham 85c0085292 Renamed MJSONWPError to ProtocolError (#177)
* Changed the logger to be 'W3C' when it's W3C protocol and 'MJSONWP' when it's MJSONWP protocol
2018-01-29 11:34:33 -08:00
Mykola Mokhnach 8093a35121 Use uia2 backend by default if platform version is greater or equal to 6 (#10073)
* Use uia2 backend by default if platform version is greater or equal to 6

* Allow to force set the backend to UIA1

* Add unit tests

* Tune the log message

* Print a warning message instead of changing the driver type

* Remove redundant imports

* Tune the message

* Address PR comments
2018-01-29 17:14:52 +01:00
Mykola Mokhnach 240961ecdd Tune application management endpoints (#179)
* Tune endpoints for applications management

* Add options param to terminateApp
2018-01-29 14:44:08 +01:00
Dan Graham 47e8955bf4 Test content-type in errors (#10077) 2018-01-25 13:10:45 -08:00
Dan Graham 35135a6ee5 Remove unnecessary 'finally' block (#10076)
* Shouldn't have had finally block because then it does two checks to fall back to MJSONWP
* Also fixed outdated tests
2018-01-25 12:45:02 -08:00
dan@saucelabs.com 2681b4d990 2.20.2 v2.20.2 2018-01-25 10:51:38 -08:00
Dan Graham b2a7c5e73f Add W3C Error Response (#176)
* Fixed HTTPResponseBody for W3C error
  * Refactored `getResponseForW3CError` into errors.js file
  * Changed method so that it returns `{value: {stack: '...', message: '...', error: '...'}}`
    * Message is the same as the JSONWP error message
    * Error is a static message indicating the type of error
    * 'stack' is the callstack provided in the error
  * Added W3C 'error' messages to all of the errors
* Make 'getResponseForW3CError' handle BadParametersError
* Refactor 'getResponseForJsonwpError' to errors.js
2018-01-25 10:50:50 -08:00
Dan Graham 129dd86976 Rename ELEMENT key to W3C format (#175)
* If server encounters a response that has the wrong key name (ELEMENT when it should be 'element-6066-11e4-a52e-4f735466cecf'), rename all instances of that key
* Added a helper method (with tests) that recursively finds instances of a 'key' and renames it
* Added e2e test that mocks `findElements`, calls `/elements` endpoint and verifies that the payload was correctly renamed
2018-01-19 11:43:24 -08:00
Dan Graham 050db9880a Fall back to MJSONWP if W3C is invalid (#10034)
* If processCapabilities throws error, then log a warning that it was invalid and log the message and fall back to using jsonwpCaps
2018-01-18 18:07:56 -08:00
Dan Graham ee569cbed1 Use MJSONWP if dcaps have extraneous params (#10019)
* Update `parseCapsForInnerDriver` so that now if it finds extraneous keys in `jsonwpCaps`, fall back to using MJSONWP instead of W3C
* After getting processed caps, check the protocol again because if `processedW3CCapabilities` was set to null, it should be JWP
* Removed tests that tested for capabilities being merged together (those are no longer needed)
* Added tests (unit test and e2e test) that check that creation of a new session will fall back to JSONWP when there are extraneous keys
2018-01-18 13:02:09 -08:00
Dan Graham 9ac3bdd634 Consolidate non-prefixed caps warnings (#174)
* Previously, it was going through alwaysMatch and all of the firstMatch caps and individually logging when any of them had unprefixed, non-standard caps
* Now it does them all at once
  * Made a helper function that takes a caps object ({alwaysMatch, firstMatch}) and finds all of the non-prefixed caps in all of them
  * Calls that function and logs warning
2018-01-18 12:50:57 -08:00
Isaac A. Murchie fff1edfe3b Get rid of arrow functions in mocha aparatus (#173) 2018-01-18 07:27:05 -05:00
Mykola Mokhnach 5308c4a47e Assume a file is located on SMB server if the path starts with double backslash (#172)
* Assume a file is located on SMB server if the path starts with double backslash

* Add more logging

* Update the test
2018-01-18 07:27:54 +01:00
Isaac A. Murchie ac8be0076c Get rid of arrow functions in mocha aparatus (#10013) 2018-01-17 15:34:50 -05:00
Isaac A. Murchie 909694b39d Add 2.34 and 2.35 to Chromedriver compatibility doc (#10012) 2018-01-17 13:57:42 -05:00
Isaac Murchie 086c8c3ddd Prepare for v1.8.0-beta v1.8.0-beta 2018-01-17 10:10:53 -05:00
Isaac Murchie 8e551ab985 Stop making package-lock.json file 2018-01-17 10:04:34 -05:00
Dan Graham fb7280da32 No hardcoded automation names (#10002) 2018-01-17 07:48:30 -05:00
Dan Graham f27d6565d0 W3C Full Implementation (#9972)
* Refactored code from createSession into parseCapsForInnerDriver()
  * parseCapsForInnerDriver() takes jsonwp and w3c capabilities and translates them into objects that can be accepted by the "inner driver" that it proxies to
  * It adds defaultCapabilities to capabilities.firstMatch and jsonwp caps
  * It finds matching caps for W3C and then creates a new W3C capabilities object that only has the valid matching one
  * After parseCapsForInnerDriver() parses the JSONWP and W3C it passes the results along to the inner-driver and it's up to the inner driver to create a W3C or JSONWP session

* Add validation to W3C session creation
  * Call to 'processCapabilities' does validation now so that it will match an object that passes Appium's validation rules (e.g.: platformName, deviceName required; automation name must be valid, etc...)
  * Test that it accepts combo of W3C and JSONWP capabilities
  * Test that it rejects invalid W3C capabilities with 400 error
  * Also added 'createSession' unit test
  * Stripped out unnecessary async/await from driver-specs

* Insert Appium prefixes into W3C caps
  * Previously, Appium just took the W3C capabilities, processed them into a caps object and 
  passed them into the inner driver as

  ```
  {
    alwaysMatch: parsedCaps,
    firstMatch: [{}],
  }
  ```

  * The problem with this is that all of the parsedCaps were unprefixed, and therefore the Inner 
  Driver complained about it

  * Now, it takes the parsedCaps and calls a new method called 'insertAppiumPrefixes' on the 
  parsed caps like this:

  ```
  {
    alwaysMatch: {...insertAppiumPrefixes(parsedCaps)},
    firstMatch: [{}],
  }
  ```

  * Refactored tests that were affected by this change
  * Added tests to test insertAppiumPrefixes function
2018-01-16 10:26:44 -08:00
dan@saucelabs.com ccee5f59b9 2.20.1 v2.20.1 2018-01-16 08:59:13 -08:00
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
Jonathan Lipps 48eabd2831 include new uiautomator2 driver 1.x 2018-01-15 12:56:48 -08:00