I'm working on an app with 2fa confirmation for certain features. I want to test the features requiring 2fa confirmation on the app against the test backend. I didn't find any ways to do that yet, only unanswered questions about it. Has anyone managed to do it, and if so, how?
Found a way to do it with node-2fa . First install the dependency
npm install node-2fa --save-dev
yarn add node-2fa --dev
Import the library to detox test file
const twofactor = require('node-2fa');
Call generateToken function where the 2fa token is needed
const newToken = twofactor.generateToken(‘YOUR_SECRET’);
await element(by.id('2fa-input')).typeText(newToken.token)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.