AppiumTestDistribution / appium-flutter-integration-driver

MIT License
32 stars 10 forks source link

Unable to run appium flutter tests locally #94

Closed rohitbhoite closed 1 month ago

rohitbhoite commented 1 month ago

I am trying to run Flutter appium tests locally but I am getting TypeError: browser.flutterByValueKey$ is not a function error. What could be the cause of this issue.

appium-flutter-integration-driver is installled.App is created as per the instructions and verified that appium server is running properly.

// @ts-ignore
import { browser, expect } from '@wdio/globals';
import "jest"

// Importing FlutterIntergrationDriverService from 'wdio-flutter-by-service'
// to extend browser capabilities with Flutter-specific methods.
// @ts-ignore
import FlutterIntergrationDriverService from 'wdio-flutter-by-service';

describe('1st AppiumFlutterIntegrationDriver test using appium latest', () => {
  it('Flutter counter demo app', async () => {
    const incrementButton = await browser
         .flutterByValueKey$('incrementButton');
  });
});
image image
saikrishna321 commented 1 month ago

@rohitbhoite Please refer the sample here - https://github.com/AppiumTestDistribution/appium-flutter-integration-driver/blob/main/test/specs/test.e2e.js

rohitbhoite commented 1 month ago

Actually I am able to run these scripts on saucelab cloud but why its giving error if i try to run these tests locally. TypeError: browser.flutterByValueKey$ is not a function. I thinkimport FlutterIntergrationDriverService from 'wdio-flutter-by-service'; is a necessary import to use these functions which I have already added

rohitbhoite commented 1 month ago

Any idea what could be the cause of this issue while running the tests locally?

sudharsan-selvaraj commented 1 month ago

It looks like there might be a problem with how you're importing the Flutter service. Instead of importing it directly into the spec file, you should add it to the WebdriverIO configuration file.

{
 "services" : ["flutter-by"]
}