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

fix: use specific android driver for now to fix the build (for now) #975

Closed
wants to merge 1 commit into from

Conversation

KazuCocoa
Copy link
Member

it looks like android driver 8.1.8+ start causing below build error:

lib/commands/app-management.js:30:16 - error TS2684: The 'this' context of type 'EspressoDriver' is not assignable to method's 'this' of type 'AndroidDriver'.
  Types of property 'suspendChromedriverProxy' are incompatible.
    Type 'typeof import("/Users/kazu/GitHub/appium-espresso-driver/lib/commands/context").suspendChromedriverProxy' is not assignable to type 'typeof import("/Users/kazu/GitHub/appium-espresso-driver/node_modules/appium-android-driver/build/lib/commands/context/exports").suspendChromedriverProxy'.

30   return await this.background(seconds);
                  ~~~~

lib/driver.ts:219:25 - error TS2684: The 'this' context of type 'this' is not assignable to method's 'this' of type 'AndroidDriver'.
  Type 'EspressoDriver' is not assignable to type 'AndroidDriver'.
    Types of property 'suspendChromedriverProxy' are incompatible.
      Type 'typeof import("/Users/kazu/GitHub/appium-espresso-driver/lib/commands/context").suspendChromedriverProxy' is not assignable to type 'typeof import("/Users/kazu/GitHub/appium-espresso-driver/node_modules/appium-android-driver/build/lib/commands/context/exports").suspendChromedriverProxy'.

219       this.curContext = this.defaultContextName();
                            ~~~~

lib/driver.ts:244:36 - error TS2684: The 'this' context of type 'this' is not assignable to method's 'this' of type 'AndroidDriver'.

244       const {udid, emPort} = await this.getDeviceInfoFromCaps();
                                       ~~~~

lib/driver.ts:250:24 - error TS2684: The 'this' context of type 'this' is not assignable to method's 'this' of type 'AndroidDriver'.

250       this.adb = await this.createADB();
                           ~~~~

lib/driver.ts:397:25 - error TS2684: The 'this' context of type 'this' is not assignable to method's 'this' of type 'AndroidDriver'.

397     let appInfo = await this.getLaunchInfo();
                            ~~~~

lib/driver.ts:409:11 - error TS2684: The 'this' context of type 'this' is not assignable to method's 'this' of type 'AndroidDriver'.

409     await this.initDevice();
              ~~~~

lib/driver.ts:500:22 - error TS2684: The 'this' context of type 'this' is not assignable to method's 'this' of type 'AndroidDriver'.

500     const viewName = this.defaultWebviewName();
                         ~~~~

lib/driver.ts:556:13 - error TS2684: The 'this' context of type 'this' is not assignable to method's 'this' of type 'AndroidDriver'.

556       await this.uninstallOtherPackages(
                ~~~~

lib/driver.ts:568:15 - error TS2684: The 'this' context of type 'this' is not assignable to method's 'this' of type 'AndroidDriver'.

568         await this.resetAUT();
                  ~~~~

lib/driver.ts:576:13 - error TS2684: The 'this' context of type 'this' is not assignable to method's 'this' of type 'AndroidDriver'.

576       await this.installAUT();
                ~~~~

lib/driver.ts:596:15 - error TS2684: The 'this' context of type 'this' is not assignable to method's 'this' of type 'AndroidDriver'.

596         await this.stopRecordingScreen();
                  ~~~~

lib/driver.ts:599:17 - error TS2684: The 'this' context of type 'this' is not assignable to method's 'this' of type 'AndroidDriver'.

599       if (await this.mobileIsMediaProjectionRecordingRunning()) {
                    ~~~~

lib/driver.ts:600:15 - error TS2684: The 'this' context of type 'this' is not assignable to method's 'this' of type 'AndroidDriver'.

600         await this.mobileStopMediaProjectionRecording();
                  ~~~~

lib/driver.ts:604:15 - error TS2684: The 'this' context of type 'this' is not assignable to method's 'this' of type 'AndroidDriver'.

604         await this.mobileStopScreenStreaming();
                  ~~~~

lib/driver.ts:700:12 - error TS2416: Property 'executeMobile' in type 'EspressoDriver' is not assignable to the same property in base type 'AndroidDriver'.
  Type '(this: EspressoDriver, mobileCommand: string, opts?: Record<string, any> | undefined) => Promise<any>' is not assignable to type '(this: AndroidDriver, mobileCommand: string, opts?: StringRecord<any> | undefined) => Promise<any>'.
    The 'this' types of each signature are incompatible.
      Type 'AndroidDriver' is missing the following properties from type 'EspressoDriver': _originalIme, espresso, unzipApp, onPostConfigureApp, and 34 more.

700   override executeMobile = executeCmds.executeMobile;
               ~~~~~~~~~~~~~

lib/driver.ts:711:3 - error TS2416: Property 'suspendChromedriverProxy' in type 'EspressoDriver' is not assignable to the same property in base type 'AndroidDriver'.
  Type 'typeof import("/Users/kazu/GitHub/appium-espresso-driver/lib/commands/context").suspendChromedriverProxy' is not assignable to type 'typeof import("/Users/kazu/GitHub/appium-espresso-driver/node_modules/appium-android-driver/build/lib/commands/context/exports").suspendChromedriverProxy'.
    The 'this' types of each signature are incompatible.
      Type 'AndroidDriver' is not assignable to type 'EspressoDriver'.

711   suspendChromedriverProxy = contextCmds.suspendChromedriverProxy;
      ~~~~~~~~~~~~~~~~~~~~~~~~

lib/driver.ts:713:3 - error TS2416: Property 'mobilePerformEditorAction' in type 'EspressoDriver' is not assignable to the same property in base type 'AndroidDriver'.
  Type '(this: EspressoDriver, opts: PerformEditorActionOpts) => Promise<void>' is not assignable to type '(this: AndroidDriver, opts: PerformEditorActionOpts) => Promise<void>'.
    The 'this' types of each signature are incompatible.
      Type 'AndroidDriver' is not assignable to type 'EspressoDriver'.

713   mobilePerformEditorAction = elementCmds.mobilePerformEditorAction;
      ~~~~~~~~~~~~~~~~~~~~~~~~~

lib/driver.ts:729:3 - error TS2416: Property 'getDisplayDensity' in type 'EspressoDriver' is not assignable to the same property in base type 'AndroidDriver'.
  Type '(this: EspressoDriver) => Promise<number>' is not assignable to type '(this: AndroidDriver) => Promise<number>'.
    The 'this' types of each signature are incompatible.
      Type 'AndroidDriver' is not assignable to type 'EspressoDriver'.

729   getDisplayDensity = miscCmds.getDisplayDensity;
      ~~~~~~~~~~~~~~~~~

lib/driver.ts:736:3 - error TS2416: Property 'mobileStartService' in type 'EspressoDriver' is not assignable to the same property in base type 'AndroidDriver'.
  Type '(this: EspressoDriver, opts: StartServiceOptions) => Promise<string>' is not assignable to type '(this: AndroidDriver, opts?: StartServiceOpts | undefined) => Promise<string>'.
    The 'this' types of each signature are incompatible.
      Type 'AndroidDriver' is not assignable to type 'EspressoDriver'.

736   mobileStartService = servicesCmds.mobileStartService;
      ~~~~~~~~~~~~~~~~~~

lib/driver.ts:737:3 - error TS2416: Property 'mobileStopService' in type 'EspressoDriver' is not assignable to the same property in base type 'AndroidDriver'.
  Type '(this: EspressoDriver, opts: StopServiceOptions) => Promise<string>' is not assignable to type '(this: AndroidDriver, opts?: IntentOpts | undefined) => Promise<string>'.
    The 'this' types of each signature are incompatible.
      Type 'AndroidDriver' is not assignable to type 'EspressoDriver'.

737   mobileStopService = servicesCmds.mobileStopService;
      ~~~~~~~~~~~~~~~~~


Found 20 errors.

npm ERR! code 1
npm ERR! path /Users/kazu/GitHub/appium-espresso-driver
npm ERR! command failed
npm ERR! command sh -c npm run rebuild

npm ERR! A complete log of this run can be found in:

lets use 8.1.7 right now, and see how can i fix them..

@KazuCocoa KazuCocoa changed the title fix: use specific android driver for now to fix the build fix: use specific android driver for now to fix the build (for now) Feb 2, 2024
@KazuCocoa
Copy link
Member Author

hm, actually this version had no issue in the CI as well...

@KazuCocoa
Copy link
Member Author

with/without this type in the android-driver changed the result... mm

* @param {import('./types').StartActivityOpts} [opts={}]

@KazuCocoa KazuCocoa closed this Feb 2, 2024
@KazuCocoa KazuCocoa deleted the fix-android-driver branch February 2, 2024 07:55
@KazuCocoa
Copy link
Member Author

the issue was

/**
 * @this {import('../driver').AndroidDriver}
 * @param {import('./types').StartActivityOpts} [opts={}]
 * @returns {Promise<string>}
 */
export async function mobileStartActivity(opts = {}) {
  const {user, wait, stop, windowingMode, activityType, display} = opts;
  const cmd = [
    'am',
    (await this.adb.getApiLevel()) < API_LEVEL_ANDROID_8 ? 'start' : 'start-activity',
  ];
  if (!_.isNil(user)) {
    cmd.push('--user', String(user));
  }
  if (wait) {
    cmd.push('-W');
  }
  if (stop) {
    cmd.push('-S');
  }
  if (!_.isNil(windowingMode)) {
    cmd.push('--windowingMode', String(windowingMode));
  }
  if (!_.isNil(activityType)) {
    cmd.push('--activityType', String(activityType));
  }
  if (!_.isNil(display)) {
    cmd.push('--display', String(display));
  }
  cmd.push(...parseIntentSpec(opts));
  return await this.adb.shell(cmd);
}

defined in the appium-driver has different type used in this espresso driver. So we may need to define this method in uia2 and remove it from appium-android-driver, or find "override".

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

Successfully merging this pull request may close these issues.

1 participant