What is the best way to control two separate applications simultaneously on two distinct emulators using WebdriverIO?

Two applications are in play here – one for customers and the other for pickers. After a customer submits an order, the picker app should get a notification. Once approved, the status of the customer's order will change. I am attempting to automate this process, but I am facing issues running both apps simultaneously on separate emulators.

When I run the apps, they open on a single emulator and fail consecutively without respecting the order in which they should launch. Additionally, the apps should not open on the same emulator. Moreover, I encountered the following error:

`in "0: Given A user is on the toters app home tab"invalid session id: The session identified by 6bb7ce21-dcdd-49ee-b5b3-bd9b56abb8a1 is not knownat getErrorFromResponseBody (file:///C:/Users/Toters/Desktop/toters-automated-tests/node_modules/webdriver/build/utils.js:195:12)at NodeJSRequest._request (file:///C:/Users/Toters/Desktop/toters-automated-tests/node_modules/webdriver/build/request/index.js:193:23)at processTicksAndRejections (node:internal/process/task_queues:95:5)at async Browser.wrapCommandFn (file:///C:/Users/Toters/Desktop/toters-automated-tests/node_modules/@wdio/utils/build/shim.js:90:29)at async Browser.$ (file:///C:/Users/Toters/Desktop/toters-automated-tests/node_modules/webdriverio/build/commands/browser/$.js:74:17)at async Browser.wrapCommandFn (file:///C:/Users/Toters/Desktop/toters-automated-tests/node_modules/@wdio/utils/build/shim.js:90:29)at async Common.accessHomePage (file:///C:/Users/Toters/Desktop/toters-automated-tests/features/pageobjects/mobile/android/common/common.ts:29:18)at async World.<anonymous> (file:///C:/Users/Toters/Desktop/toters-automated-tests/features/step-definitions/mobile/android/dark-store/order.ts:10:5)at async wrapPromiseWithTimeout (C:\Users\Toters\Desktop\toters-automated-tests\node_modules@cucumber\cucumber\src\time.ts:55:10)at async Object.run (C:\Users\Toters\Desktop\toters-automated-tests\node_modules@cucumber\cucumber\src\user_code_runner.ts:86:16)[0-0] 2024-05-02T16:01:33.285Z INFO webdriver: COMMAND deleteSession()[0-0] 2024-05-02T16:01:33.285Z INFO webdriver: COMMAND deleteSession()[0-0] 2024-05-02T16:01:33.286Z INFO webdriver: [DELETE] http://0.0.0.0:4723/session/9bf0b941-f990-41bb-804e-afca003d57fe[0-0] 2024-05-02T16:01:33.286Z INFO webdriver: [DELETE] http://0.0.0.0:4723/session/de7d06d8-b0e7-4752-9021-ecd7dd50ebee[0-0] 2024-05-02T16:01:33.786Z INFO webdriver: RESULT null[0-0] 2024-05-02T16:01:33.863Z INFO webdriver: RESULT null[0-0] FAILED in MultiRemote - file:///C:/Users/Toters/Desktop/toters-automated-tests/features/features/mobile/dark-store/place.order.feature2024-05-02T16:01:33.987Z INFO @wdio/cli:launcher: Run onWorkerEnd hook2024-05-02T16:01:33.987Z INFO @wdio/cli:launcher: Run onComplete hook

I have two Android emulators up and running:

customer-app, picker-app

I have executed the appium command in my terminal to boot the appium server on port 4723

Ports 4728 and 4729 are available for use.

The android.conf.ts file contains the following capabilities:

capabilities: {
    customerApp: {
      capabilities: {
        platformName: "Android",
        "appium:app":
          "/Users/Toters/Desktop/toters-automated-tests/apps/app-staging-debug.apk",
        "appium:platformVersion": "11",
        "appium:deviceName": "customer-app",
        "appium:automationName": "UIAutomator2",
        "appium:systemPort": 4728,
      },
    },
    pickerApp: {
      capabilities: {
        platformName: "Android",
        "appium:app":
          "/Users/Toters/Desktop/toters-automated-tests/apps/picker-staging-build.apk",
        "appium:platformVersion": "11",
        "appium:deviceName": "picker-app",
        "appium:automationName": "UIAutomator2",
        "appium:systemPort": 4729,
      },
    },
  },

In addition, changes have been made to the index.d.ts and types.d.ts files to incorporate the capabilities globally and within the multiRemoteBrowser respectively.

A common.ts file has been created to house the code and includes a function to initialize both devices.

const { customerApp, pickerApp } = multiremotebrowser;

async accessHomePage() {
    while (
      !(await customerApp
        .$("[resource-id = 'com.toters.customer.staging:id/btnGetStarted']")
        .isExisting())
    ) {
      console.log("waiting for get started button to appear");
    }
    while (
      !(await pickerApp
        .$("[resource-id = 'com.toters.customer.staging:id/btnGetStarted']")
        .isExisting())
    ) {
      console.log("waiting for get started button to appear");
    }
  }

Answer №1

It seems that using 2 Appium servers for one device may not be possible. For more information, you can check out the comments in this thread:

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Create a visual representation after inserting

I have created an input feature that allows me to paste images by using CTRL-V. The process involves copying an image from the browser and pasting it into the input field using CTRL-V. The result is an image in base64 format. Is there a way to manipulate ...

Importing TweenLite in Typescript is a breeze

After downloading the GSAP package via npm, I am keen on importing the TweenLite class to my TypeScript app. While importing all of GSAP can be achieved by using require('gsap'); and it functions correctly, this method does not work in TypeScript ...

Implementing Firebase as an Authentication Middle Layer for Express.js

I am currently working on developing an authentication middleware to verify the presence of a valid firebase token in the request header. Here's the code snippet: auth.ts import * as firebase from 'firebase-admin'; import { NextFunction, Re ...

Extract particular "set" from JSON retrieval

For instance, here is a sample output, but the JSON response will be much longer. I am only interested in filtering out NFTs with a specific contract address (collection) from this response. Currently utilizing axios and typescript in React. { "own ...

Using Angular 2 to convert and display data as a particular object type in

I have recently developed a basic application using the Angular2 tutorial as my guide. Initially, I established a straightforward "Book" model: /** * Definition of book model */ export class Book { public data; /** * Constructor for Book ...

Discovering the best way to organize and sort information retrieved from the backend within an Angular

How can I restrict a user to only search for data that has been provided from the backend and prevent them from creating new data? In my backend, there are two words: "Chart" and "Map". I am looking for a way to limit the user's search to only these ...

Classbased Typescript implementation for managing state with a Vuex store

Hey everyone, I'm currently working on a Vue project with Vuex using decorators for strong typing in my template. As someone new to the concept of stores, I am struggling to understand how to properly configure my store to work as expected in my comp ...

Tips on incorporating a child component into a parent component using React and TypeScript

I am trying to conditionally render a child component within a parent component using React and TypeScript. Here is the code I have: const Parent = ({ prop1, prop2 }: { prop1: Prop1, prop2: Prop2; }) => { const isChecked = true; return ( ...

Use Vue 2 with TypeScript to prevent directly changing Props in a class-based component using vue-property-decorator

Is there a way to declare a Prop using vue-property-decorator in a class-based component without the need to initialize it? Currently, I'm facing a dilemma: If I don't provide an initializer, TypeScript throws an error during compilation: ...

Convert an object to nested JSON in Angular 5

I am struggling with using Angular 5 HttpClient to send a post request because I am having trouble casting an object to nested JSON. For instance, I have the following class: export class Team { members: Person[]; constructor(members: Person[]) ...

Typescript is encountering errors indicating that it is unable to locate modules for imported assets, such as images

Having trouble with TS not recognizing image imports. Although the site runs fine, TypeScript seems to have an issue identifying them: import React, { Component } from 'react'; import SlackIcon from './assets/social/slack-icon-thumb.png&apos ...

The type does not meet the requirements set by the class it is inheriting from

Currently, I am in the process of working on a WebSocket Secure (WSS) server utilizing the Node ws library which can be found here. More specifically, I am following the approach outlined in this particular question, although its relevance is yet to be det ...

A different approach to handling multiple constructors in Angular 4

Angular 4 does not support having multiple constructors, so I need to find a cleaner way to instantiate my object. This is what my model looks like: export class SrcFilter { constructor(public firstList?: Array<String>, public secondList?: Arra ...

Customize the text displayed in a dropdown menu in Angular Material based on the selection made

I am working with a multi-select dropdown menu that includes an option labeled "ALL" which, when selected, chooses all available options in the list. My goal is to display "ALL" in the view when this option is chosen or when the user manually selects all t ...

Creating mock objects with Jest

I am currently delving into the world of jest testing. Here is a snippet from an implementation class I'm working with: import { ExternalObject } from 'external-library'; export class MyClass { public createInstance(settings : ISettings) ...

Strategies for Resolving Circular Dependencies in NestJS with GraphQL

Imagine having two different entities: // user.entity.ts @ObjectType() @Entity() export class User { @Field() @PrimaryGeneratedColumn('uuid') id: string; @Field() @Column({ unique: true }) username: string; @Column({ select: fals ...

Retrieving the value of an object using an array of keys

Consider the following object: const obj = { A:{ a1:'vala1', a2:'vala2' }, B:{ b1: 'valb1', b2: 'valb2' }, C:{ c1:{ c11:'valc11' }, c2:'valc2' } } We also have an array: const ...

Create collaborative documents with serverless TypeScript extension

Utilizing Amazon Lambda AWS along with Serverless and the Serverless Plugin TypeScript to develop my TypeScript files has been quite a challenge. I have implemented shared code in my project, organized within folders such as: /shared: shared1.ts, shared2. ...

Error message stating: "Form control with the name does not have a value accessor in Angular's reactive forms."

I have a specific input setup in the following way: <form [formGroup]="loginForm""> <ion-input [formControlName]="'email'"></ion-input> In my component, I've defined the form as: this.log ...

Guide on Validating Several Email Addresses in a React Form using Angular 4

I need to input 50 email addresses with the same domain name (gmail.com). Currently, I am using a Reactive form but the code I have implemented is not working as expected. https://stackblitz.com/edit/angular-wfwfow If anyone could assist me with this, I ...