How to run one test on two iOS devices, and check if message sent by device A can be received on device B

The test used one Appium Desktop server(4723), launched app on device A with iOSDriver driver1 using device A’s udid, and logged into home page.

Using WDA agent: ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj’

Then in the same test method, it tried to launch the app on Device B with device B’s udid using another Appium server(port:4725) with driver2, and logged into home page with different id/pw.

When I tired to go back device A using driver1, to send a message, then I got message – [WD Proxy] Got an unexpected response: {“value”:“Session does not exist”,“sessionId”:“F2A795F2-70E8-4A18-9B67-2AB02B86BF6B”,“status”:6}

Using WDA agent: ‘/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj’

Both appium servers are using the same WD Proxy port: 8100. Should I use a different WD Proxy port?

The question: how can I setup my appium correctly to run a test over two devices, or how to use different WD Proxy port.

I can use Xcode/XCTest to run tests on multiple devices at the same time. But each device is for one test. (I can only pickup one device from top device/simulator list. The reason I use Appium iOSDriver is to try to run one test on two devices at the same time. This is not a traditional TestNG parallel test.

Environment

  • Appium version (or git revision) that exhibits the issue: 1.13.0
  • Last Appium version that did not exhibit the issue (if applicable):
  • Desktop OS/version used to run Appium: MacOS 10.14.5
  • Node.js version (unless using Appium.app|exe): v11.2.0
  • Npm or Yarn package manager: 6.4.1
  • Mobile platform/version under test: 12.2, 12.1.4
  • Real device or emulator/simulator: iPhone 6, and iPhone 8
  • Appium CLI or Appium.app|exe: 1.13.0