mobile-dev-inc / maestro

Painless Mobile UI Automation
https://maestro.mobile.dev/
Apache License 2.0
5.35k stars 248 forks source link

Biometrics? #282

Open nealsanche opened 1 year ago

nealsanche commented 1 year ago

I have an app that I want to automate that performs some fingerprint biometric checks. We really only need to test on one platform, so can restrict it to Android emulators. Would it be possible to add execution of something like:

adb -e emu finger touch 1

In Maestro so that the script can provide the necessary fingerprint when needed? I've only just started looking at Maestro and find it promising. Thanks.

peterferguson commented 1 year ago

+1 for biometrics

We are implementing passkeys as a auth mechanism & cannot accept the passkey request in the maestro test without fingerpint

xuanmai-agilityio commented 1 year ago

Having the same problem and just grab a workaround from the Maestro Slack channel. We can achieve it by running the localhost server and accessing it via Maestro JavaScript. The localhost can get a request and execute any command in the file system (e.g.: xcrun simctl push …) Hope this help.

peterferguson commented 1 year ago

@xuanmai-agilityio have you got a code snippet / repo showing how you achieve this?

xuanmai-agilityio commented 1 year ago

@peterferguson Not fully tested with the push notification or any simulator/emulator control. But this snippet works with simple commands like ls, la,.... curl http://localhost:3000/runcmd\?cmd\=ls hope this help

const express = require('express');
const { exec } = require('child_process');

const app = express();
const port = 3000;

app.get('/runcmd', (req, res) => {
  const cmd = req.query.cmd;

  exec(cmd, (error, stdout, stderr) => {
    if (error) {
      console.error(`Error executing command: ${error.message}`);
      res.status(500).send('An error occurred');
    } else {
      console.log(`Command executed successfully: ${cmd}`);
      res.send(stdout);
    }
  });
});

app.listen(port, () => {
  console.log(`Server is running on port ${port}`);
});
DannyPat44 commented 10 months ago

+1 for biometrics

We have device authentication for app access that is constantly breaking. Would be great to be able to catch it with automated e2e tests.

bartekpacia commented 9 months ago

There's some docs on Android Developers about simulating fingerprint, dropping it in case it's useful. It's emulator-only, though.