Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when taping or clicking on Appium + expo #4618

Open
dohainamhn opened this issue Nov 27, 2024 · 2 comments
Open

Error when taping or clicking on Appium + expo #4618

dohainamhn opened this issue Nov 27, 2024 · 2 comments

Comments

@dohainamhn
Copy link

dohainamhn commented Nov 27, 2024

Provide console output if related. Use --verbose mode for more details.

**************************************
nodeInfo:  20.11.0
osInfo:  macOS 14.6.1
cpuInfo:  (12) arm64 Apple M2 Pro
chromeInfo:  131.0.6778.86
edgeInfo:  Not Found
firefoxInfo:  undefined
safariInfo:  17.6
If you need more detailed info, just run this: npx codeceptjs info
***************************************
CodeceptJS v3.6.7 #StandWithUkraine
Using test root "/Users/dohainam/Desktop/Projects/react-native/Test.xyz"
Helpers: Appium
Plugins: screenshotOnFail, tryTo, retryFailedStep, retryTo, eachElement

login --
    [1]  Starting recording promises
    Timeouts: 
  test something
    I see app is installed "com.anonymous.Test"
    I wait for element "//android.widget.Button[@content-desc="TEST"]"
    I tap "~TEST"
    [1]  Error (Non-Terminated) | Error: WebDriverError: Request with GET/HEAD method cannot have body. when running "touch/perform" with method "GET" and args "{"actions":[{"action":"tap","options":{"element":"00000000-0000-00a8-ffff-ffff0000000c"}}]}" | (err) => { step.status = 'failed'; step.endTime = ...
    [1] Error | Error: WebDriverError: Request with GET/HEAD method cannot have body. when running "touch/perform" with method "GET" and args "{"actions":[{"action":"tap","options":{"element":"00000000-0000-00a8-ffff-ffff0000000c"}}]}" undefined...
    [1] <teardown>  Stopping recording promises
 › <screenshotOnFail> Test failed, try to save a screenshot
 › Screenshot has been saved to /Users/dohainam/Desktop/Projects/react-native/test.xyz/output/test_something.failed.png
  ✖ FAILED in 1054ms

    [2]  Starting recording promises

-- FAILURES:

  1) login
       test something:
     WebDriverError: Request with GET/HEAD method cannot have body. when running "touch/perform" with method "GET" and args "{"actions":[{"action":"tap","options":{"element":"00000000-0000-00a8-ffff-ffff0000000c"}}]}"
      at FetchRequest._libRequest (file:///Users/dohainam/Desktop/Projects/react-native/test.xyz/node_modules/webdriver/build/index.js:1480:13)
      at processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async FetchRequest._request (file:///Users/dohainam/Desktop/Projects/react-native/test.xyz/node_modules/webdriver/build/index.js:1381:20)
      at async Browser.wrapCommandFn (file:///Users/dohainam/Desktop/Projects/react-native/test.xyz/node_modules/@wdio/utils/build/index.js:884:23)
      at async Browser.wrapCommandFn (file:///Users/dohainam/Desktop/Projects/react-native/test.xyz/node_modules/@wdio/utils/build/index.js:884:23)
  

Provide test source code if related

Feature("login");

Scenario("test something", ({ I }) => {
  I.seeAppIsInstalled("com.anonymous.Test");
  I.waitForElement('//android.widget.Button[@content-desc="TEST"]');

  I.tap('//android.widget.Button[@content-desc="TEST"]');
});

Details

  • CodeceptJS version:^3.6.7
  • NodeJS Version:v20.11.0
  • Operating System: MacOS
  • webdriverio: ^9.3.1
  • Configuration file:
# paste config here 

import { setHeadlessWhen, setCommonPlugins } from "@codeceptjs/configure";
// turn on headless mode when running with HEADLESS=true environment variable
// export HEADLESS=true && npx codeceptjs run
setHeadlessWhen(process.env.HEADLESS);

// enable all common plugins https://github.com/codeceptjs/configure#setcommonplugins
setCommonPlugins();

export const config = {
  tests: "./*_test.ts",
  output: "./output",
  helpers: {
    Appium: {
      platform: "Android",
      desiredCapabilities: {
        app: "./android/app/build/outputs/apk/release/app-release.apk",
        platformName: "android",
        "appium:deviceName": "Android_phone", // Change to the name of the AVD you're using
        "appium:automationName": "UiAutomator2",
        "appium:platformVersion": "12",
        "appium:appPackage": "com.anonymous.Test",
        // "appium:appActivity": "com.anonymous.Test.activities.MainActivity"
      },
      appiumV2: true,
    },
  },
  include: {
    I: "./steps_file",
  },
  name: "hello.xyz",
};
@jprodriguez-sw
Copy link

wdio touchPerform is deprecated. You have to use action instead. https://webdriver.io/docs/api/browser/action/
I was having the same issue with this code.

driver.touchPerform([
      {
        action: 'press',
        options: {
          x: ini_x,
          y: ini_y,
        },
      },
      {
        action: 'wait',
        options: {
          ms: 100,
        },
      },
      {
        action: 'moveTo',
        options: {
          x: ini_x,
          y: y,
        },
      },
      {
        action: 'release',
        options: {},
      },
    ]);

So I had to replace it with this:

driver.action('pointer', {
        parameters: { pointerType: 'touch' }
      })
      .move({ x: ini_x, y: ini_y })
      .down()
      .pause(100)
      .move({ duration: 500, x: ini_x, y: y })
      .up()
      .perform();

Btw I'm using wdio + appium + uiautomator2

@jurecotic
Copy link

Got the same issue. Tried with webdriver 8 and 9. @jprodriguez-sw yeah that works, but we are not doing a touchPerform action. We are doing a tap action in Codecept. At least updating the documentation that tap action is not supported anymore would save me some time...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants