29 Commits
Author SHA1 Message Date
Jonathan Lipps f1833e33a6 feat: allow plugins to modify the server and method map (#422) 2020-07-22 10:16:36 -07:00
Mykola Mokhnach faf0fb2a7c refactor: Move common constants to a separate file to avoid unnecessary cross-imports (#411) 2020-05-20 20:06:04 +02:00
Mykola Mokhnach 5b5d6dde28 fix: Adjust the validation of proxied requests (#410) 2020-05-05 21:02:32 +02:00
Isaac A. Murchie 8784face21 fix: add another condition for terminating socket 2020-01-10 15:54:08 -05:00
Isaac A. Murchie 1d350ebb17 fix: terminate socket on DELETE and NoSuchDriverError (#382) 2020-01-10 13:34:55 -05:00
Mykola Mokhnach e2b4fb3570 fix: Tune status presence verification for generic protocol (#355) 2019-09-05 20:09:15 +02:00
Jonathan Lipps cc8b879da2 feat: stop hardcoding /wd/hub and make route prefix configurable [BREAKING CHANGE] (#346) 2019-08-27 09:23:10 -07:00
Mykola Mokhnach f64d116e2c Update response handling for proxyReqRes call (#344) 2019-08-10 19:29:51 +02:00
Isaac A. Murchie 5b12eebcf0 Add function names (#309) 2019-03-21 14:38:22 -04:00
Dan Graham 644208fe60 Copy W3C/Element keys instead of renaming them (#290) 2018-12-10 13:24:36 -08:00
Mykola Mokhnach 27a2d45e38 Avoid TypeError if stacktrace is undefined (#269) 2018-10-16 07:13:39 +02:00
Isaac A. Murchie 04af064564 Update appium-gulp-plugins (#266) 2018-10-03 09:00:58 -04:00
Mykola Mokhnach d176cda10c Append the current session identifier to the protocol name prefix (#259) 2018-09-18 13:53:33 +02:00
Mykola Mokhnach 16e2852a1b Fix the way current protocol is determined from execute response (#258) 2018-09-11 18:27:27 +02:00
Mykola Mokhnach d80a78a615 Fix protocol detection inside the routing function (#257) 2018-09-08 20:39:08 +02:00
Mykola Mokhnach e6218fb4b1 Replace isError lodash verification as it is not reliable (#256) 2018-09-07 16:18:13 +02:00
Mykola Mokhnach 50e4c04805 Change logging level to debug for internal errors (#255) 2018-09-06 18:00:23 +02:00
Isaac A. Murchie 5e9df93eeb Clean up error message from protocol (#249) 2018-08-15 08:04:14 -04:00
Jonathan Lipps ec72948de2 add -image locator strategy and related logic (#235)
* add -image locator strategy and related logic

* use appium-support jimp helper

* handle find multiple elements by image

* update staleness check variable name

* ensure that a settings object always exists so we can rely on global settings always existing too

* only fix template size if user requests it in settings

* add note about implicit wait error handling

* only automatically update image element position if user turns on an appropriate setting

* add setting to control whether we check for image element staleness

* add setting to determine the image element tap strategy (w3c or mjsonwp)

* prefer single quotes

* add setting to turn off screenshot resizing if not desired

* add docstrings (except for cache class which we may not keep)

* address additional review comments

* add better jsdoc arg info

* use lru-cache npm package instead of rolling our own

* use new versino of appium-support

* make sure the lru cache is checking element size correctly

* give better names and tighten up logic around image el tap strategies

* add some unit tests for image elements

* ensure DeviceSettings has a default no-op update method

* check that driver implements action strategies and fall back / throw as appropriate

* finish out image element unit tests

* have basedriver set noop onSettingsUpdate rather than doing it in DeviceSettings

* move route avoidance detection from protocol to driver

* handle proxying actions to downstream drivers during image tap

* tighten up logic for deciding whether to proxy based on presence of image element

* add find by image specs and fix issues that arose in the process

* clean up regexes

* don't try to be smart and proxy actions for drivers; let them set it up themselves to support image elements

* change default match threshold based on experimentation

* export which settings are handled by basedriver so downstream drivers can utilize this information

* make sure to include a duration for the initial pointerMove action

* add docstring to proxyRouteIsAvoided
2018-07-30 13:17:54 -07:00
Isaac A. Murchie 855ebe15de Add method to check for unknown error (#242)
* Add method to check for unknown error

* Do not catch and re-throw proxied error

* Fix isUnknownError function and clean up handling
2018-07-26 13:11:47 -04:00
Mykola Mokhnach 165543e16d Avoid throwing proxy request error inside command call (#220)
* Avoid throwing proxy request error inside command call

* Tune stacktrace handling for W3C

* Fix var name

* Apply safer check

* Tune the verification
2018-06-08 19:49:41 +02:00
Isaac A. Murchie 2e0b162331 Check for proxied error (#212)
* Check for proxied error

* Fix issue
2018-05-22 09:00:02 -04:00
Dan Graham a74d25cb1e Fix: Throw error after parsing protocol from proxied response (#211)
* Before it was throwing immediately which meant we weren't parsing the protocol and weren't showing the proper error responses
* If proxied W3C error doesn't have an error, make it `Unknown Error`
2018-05-14 08:36:49 -07:00
Dan Graham 8890bef9f1 Use protocol-specific logger (#209) 2018-05-12 11:20:21 -07:00
Dan Graham 7bf5a3e6d7 Fix protocol parsing (#201)
* Some problems with parsing `{protocol: <protocol>, value: <value>}`
  * `(!_.isNil(driverRes.value)` was incorrect check because `value` can be undefined or null; replaced it with `_.has(driverRes, 'value')` to check that the `value` property was set
  *  ```
       if (driverRes.value) {
          driverRes = driverRes.value;
        } 
      ``` 

      was also incorrect because `driverRes.value` may be false-y

* Moved logic into it's own function and then added tests to cover the problem cases
2018-04-04 09:54:21 -07:00
Dan Graham f7f822611c Parse protocol from executeCommand (#195)
* If`executeCommand` returns an object that has a property 'protocol' and either a 'value' property or an 'error' property, respond with the provided protocol
* If the object is of this form, than it came from another driver that knows what protocol is being used so we re-assign the protocol to whatever was reported
* Added to delay in the 'unexpected exits' test because I was getting a race condition
2018-03-27 14:00:36 -07:00
Linda_pp bd5b5379a0 fix the default value of payload parameters (#190) 2018-02-23 05:53:28 -05: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
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