41 Commits
Author SHA1 Message Date
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
Isaac A. Murchie 8624a8061f refactor: move to new timing API (#377) 2019-12-19 11:28:28 -05:00
Mykola Mokhnach da0f5f3ed0 fix: make sure the listener gets removed after the command executor is completed (#371) 2019-11-26 21:15:29 +01:00
Mykola Mokhnach 1931e778ad refactor: Prefer event emitting to promises cancelation (#370)
BREAKING CHANGE: The current refactoring is breaking and changes `onUnexpectedShutdown` property to a function, which accepts a handler that is invoked by the driver when it gets shut down unexpectedly
2019-11-25 19:01:38 +01:00
Mykola Mokhnach 445b180f77 refactor: Replace custom commands queue implementation with async lock (#362) 2019-10-16 18:34:52 +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
Jonathan Lipps 23d6ecf949 Add endpoint that receives a webdriver script for batch command execution (#328)
* add executeDriverScript route, command, tests

* allow driver scripts to write and collect console logs

* ensure driver script protocol is set to same protocol as driver, and also includes all appium commands

* implement isFeatureEnabled to check for insecure feature

* add tests for isFeatureEnabled

* update feature flag name to match style of other flags

* add ensureFeatureEnabled method for use by other drivers

* move driver script execution into a child process so we can kill it if necessary

* use this.opts.address instead of this.opts.host

* ensure driver script timeout is a number in the child proc as well

* ensure we get webdriverio without issues
2019-06-25 12:12:27 -07:00
Kazuaki Matsuo e3caf43337 add getting result image by find by image (#327)
* add getMatchedImageResult and return the result if it is true

* add tests

* tweak error case
2019-05-29 13:00:17 +09:00
Isaac A. Murchie d214a0d1f2 Be more explicit about unrecognized caps (#317) 2019-04-09 13:02:46 -04:00
Jonathan Lipps 98e11b68e4 factor out image element registration to helper function (#312)
...so the function can be used by other drivers / plugins
2019-04-08 09:05:50 -07:00
Isaac A. Murchie b0d7e2e77b Update bluebird (#310)
* Upgrade bluebird

* Remove catch for CancellationError

* Make image command cancellable too
2019-03-26 15:58:11 -04:00
Mykola Mokhnach a969967a26 Apply command timeout only if queuing is enabled (#298) 2019-01-28 20:04:39 +01:00
greenkeeper[bot] 4eab674f92 Update eslint-config-appium to the latest version 🚀 (#295)
* chore(package): update eslint-config-appium to version 4.0.1

* chore: fix linting
2019-01-07 13:11:57 -06:00
Dan Graham 6f565760df Do not use static yet. Still experimental. (#286) 2018-11-22 13:51:01 -08:00
Isaac Murchie 2f4366187a Fix exports for new Babel 2018-10-03 09:17:26 -04:00
Isaac A. Murchie 04af064564 Update appium-gulp-plugins (#266) 2018-10-03 09:00:58 -04:00
Kazuaki Matsuo b90ed154d9 fix raising NotYetImplementedError against commands which exist in image-element (#245)
* fix raising NotYetImplementedError when the element is image-element
2018-08-05 22:37:59 +09: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 5f318b4eef Remove list of valid automation names (#229) 2018-06-29 11:02:08 -04:00
Dan Graham f72dc5a3ac Fix: Make 'reset' re-use same protocol (#219)
* Before, reset was creating a new session and using the processed caps
* The problem with is, if it was W3C it would create a MJSONWP
* Now it checks the protocol before resetting and passes in the appropriate args to createSession depending on the protocol type
2018-06-07 13:15:28 -07:00
greenkeeper[bot] 8439803500 Update dependencies to enable Greenkeeper 🌴 (#216)
* chore(package): update dependencies

* docs(readme): add Greenkeeper badge

* chore: adapt code to updated dependencies
2018-06-04 14:48:50 -04:00
Dan Graham da4f28f7d9 Fix: Determine protocol in createSession (#194)
* Previously, we were only checking the HTTP payload to see what protocol should be
* This is inadequate, in the case of drivers that don't proxy W3C Capabilities yet
* The fix now is to set the protocol in `createSession` to see if the W3C caps were proxied through, if they're not, set protocol to MJSONWP
* Added unit test and one e2e test to confirm that this works
2018-03-14 15:44:50 -07: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 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 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
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
Mykola Mokhnach 7f01fb001d Add a possibility to execute commands without queueing them 2017-08-18 14:29:03 +02:00
Isaac A. Murchie 01e9914b66 Update linting and add coverage (#131) 2017-08-15 08:53:47 -04:00
Mykola Mokhnach a693ac4796 Add driverData property to the base driver class (#132) 2017-08-14 08:29:54 -04:00
cool-firer f72c61c071 exchange deleteSession and curCommandCancellable (#126)
session should be closed firstly if some unexpected happens, so the following request can be responsed immediately.
2017-07-19 07:35:48 -04: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
Jonathan Lipps 9a7c6de17d ensure we log events in a debug fashion at least 2017-03-03 14:37:38 -08:00
Jonathan Lipps d75bde2a0e add event timing framework to base driver 2017-03-03 13:41:02 -08:00
Isaac Murchie d2c5caafd4 Move appium-logger into base driver 2016-11-23 09:15:38 -08:00
Isaac Murchie 5f84cc8cf1 Make use of os.tmpdir instead of os.tmpDir 2016-10-31 12:07:03 -07:00
Isaac Murchie 0df402b1b2 Add linting and pre-commit hooks 2016-07-12 09:48:01 -07:00
Isaac Murchie b883d8601b Add basic getStatus method 2016-07-08 09:21:29 -07:00
Isaac Murchie e44ed397f6 Add ability to manage delegated drivers 2016-07-01 09:15:33 -07:00
Isaac Murchie d534bb151f Make sure async is there, and add logging 2016-06-28 13:00:47 -07:00
Jonathan Lipps 48113db62a merge node-mobile-json-wire protocol project into basedriver (and bump package to denote breaking changes) 2016-05-04 21:28:25 -07:00