Closed JacquesN16 closed 2 years ago
The endpoint which Nightwatch uses is not supported by the Appium XCUITest driver. You can switch to Nightwatch v2 which uses W3C Actions API which could be used with all platforms (Android, IOS, etc). Here is the example code of using Nightwatch with Appium.
Thank @gravityvi for your answer. So basically, I need to switch to Nightwatch v2 with the new function for swipe action and all the moveTo() and mouseButton() commands are deprecated now. I will follow your example to fix my test.
Describe the bug
I'm trying to make a test on a web-app for a "swipe" function. So I used a combination of mouseToElement() then mouseButtonDown() and finally mouseToElement(). I ran the test on an AVD (Android Virtual Device) and it worked perfectly. However, when I switched to an iOS Simulator Device ( I used Appium with XCUITest as automation system), I had an error for an "Unhandled endpoint". I would like to know if this is an error from Appium and XCUITest or there is a way to work around for this problem. Thank you for your answer
scratch_card.js
```js client .url(url) .assert.visible('.ScratchCard__Canvas') // .wait('.ScratchCard__Canvas') .moveToElement('.ScratchCard__Canvas',100,100) .mouseButtonDown('left') .moveToElement('.ScratchCard__Canvas',0,100) .mouseButtonUp('left') .pause(2000) ```
Verbose output
debug.log
```txt [debug] [WD Proxy] Matched '/wd/hub/session/d033457a-e51c-4195-9d57-36976f50508a/buttondown' to command name 'buttonDown' [debug] [WD Proxy] Proxying [POST /wd/hub/session/d033457a-e51c-4195-9d57-36976f50508a/buttondown] to [POST http://127.0.0.1:8100/session/680ECC16-09F1-472D-8D31-1C032771CC88/buttondown] with body: {"button":0} [WD Proxy] Got response with status 404: {"value":{"error":"unknown command","message":"Unhandled endpoint: /session/680ECC16-09F1-472D-8D31-1C032771CC88/buttondown -- http://127.0.0.1:8100/ with parameters {\n wildcards = (\n \"session/680ECC16-09F1-472D-8D31-1C032771CC88/buttondown\"\n );\n}","traceback":""},"sessionId":"680ECC16-09F1-472D-8D31-1C032771CC88"} [debug] [W3C] Matched W3C error code 'unknown command' to UnknownCommandError [HTTP] <-- POST /wd/hub/session/d033457a-e51c-4195-9d57-36976f50508a/buttondown 500 3 ms - `309` ```
Configuration
nightwatch.json
```js { live_output: false, globals_path: "nightwatch.globals.js", test_settings: { default: { launch_url: 'https://nightwatchjs.org', selenium_port: 4723, selenium_host: "127.0.0.1", silent: true, selenium_start_process: false, }, ios : { desiredCapabilities : { automationName: "XCUITest", browserName : "safari", platformName : "iOS", platformVersion : "14.5", deviceName : "iPhone 12 Pro Max", real_mobile : false, connectHardwareKeyboard: false } }, } } ```
Your Environment
nightwatch --version
npm --version
yarn --version
node --version
appium