How to use the appium-flutter-finder.byValueKey function in appium-flutter-finder

To help you get started, we’ve selected a few appium-flutter-finder examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github truongsinh / appium-flutter-driver / example / nodejs / src / index.js View on Github external
/* new example
  if (process.env.APPIUM_OS === 'android') {
    await driver.switchContext('NATIVE_APP');
    await (await driver.$('~fab')).click();
    await driver.switchContext('FLUTTER');
  } else {
    console.log(
      'Switching context to `NATIVE_APP` is currently only applicable to Android demo app.'
    );
  }
  */

  assert.strictEqual(await driver.getElementText(counterTextFinder), '0');
  
  //Long Press using flutter command on Increment button, it should visible 'increment' tooltip after longTap
  await driver.execute('flutter:longTap', find.byValueKey('increment'), {durationMilliseconds: 10000, frequency: 30});
  
  //Long Press using TouchAction with wait
  await driver.touchAction([
    {
     action: 'longPress',
     element: { elementId: buttonFinder }
    },
    {
     action: 'wait',
     ms: 10000
    },
    {
     action: 'release'
    }
  ]);
github truongsinh / appium-flutter-driver / example / nodejs / src / index.js View on Github external
await driver.elementClick(buttonFinder);
  await driver.touchAction({
    action: 'tap',
    element: { elementId: buttonFinder }
  });

  assert.strictEqual(await driver.getElementText(counterTextFinder), '2');

  await driver.elementClick(find.byTooltip('Increment'));

  assert.strictEqual(
    await driver.getElementText(
      find.descendant({
        of: find.byTooltip('counter_tooltip'),
        matching: find.byValueKey('counter')
      })
    ),
    '3'
  );

  await driver.elementClick(find.byType('FlatButton'));
  await driver.execute(
    'flutter:waitForAbsent',
    buttonFinder
  );

  assert.strictEqual(
    await driver.getElementText(find.byText('This is 2nd route')),
    'This is 2nd route'
  );
github truongsinh / appium-flutter-driver / example / nodejs / src / index.js View on Github external
(async () => {
  const counterTextFinder = find.byValueKey('counter');
  const buttonFinder = find.byValueKey('increment');

  const driver = await wdio.remote(opts);

  await validateElementPosition(driver, buttonFinder);

  assert.strictEqual(await driver.execute('flutter:checkHealth'), 'ok');
  await driver.execute('flutter:clearTimeline');
  await driver.execute('flutter:forceGC');

  const renderObjectDiagnostics = await driver.execute(
    'flutter:getRenderObjectDiagnostics',
    counterTextFinder,
    { includeProperties: true, subtreeDepth: 2 }
  );
  assert.strictEqual(renderObjectDiagnostics.type, 'DiagnosticableTreeNode');
  assert.strictEqual(renderObjectDiagnostics.children.length, 1);
github truongsinh / appium-flutter-driver / example / nodejs / src / index.js View on Github external
(async () => {
  const counterTextFinder = find.byValueKey('counter');
  const buttonFinder = find.byValueKey('increment');

  const driver = await wdio.remote(opts);

  await validateElementPosition(driver, buttonFinder);

  assert.strictEqual(await driver.execute('flutter:checkHealth'), 'ok');
  await driver.execute('flutter:clearTimeline');
  await driver.execute('flutter:forceGC');

  const renderObjectDiagnostics = await driver.execute(
    'flutter:getRenderObjectDiagnostics',
    counterTextFinder,
    { includeProperties: true, subtreeDepth: 2 }
  );
  assert.strictEqual(renderObjectDiagnostics.type, 'DiagnosticableTreeNode');