Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Retrieve OTP Code and make it available for your GDSL test manually. When you launch a measurement on a Test Bench device with the Greenspector CLI, you can receive a email or a SMS on your own device linked to your account. Get the OTP and write it to a public json file on Internet that your GDSL test will read.

Before launching your GDSL test, you have to put a file available on internet via any drive you can use (for example google drive)

this file must be in the json format :

{
 "value":""
}

Then when you have received your OTP code, add it on this same file

{
 "value":"123456"
}

Here is an example of a GDSL test reading the OTP code you have set in your json file. You have to adapt to your own context :

# this method checks your json file exists with an empty value before asking a new OTP code
initOTPManual,https://myonlineotpfile.json

# Log into your app, for example a login / password form with a submit button
# you have to adapt to your own context
setTextById,mylogin,com.myapp:id/loginEditText
setTextById,mypassword,com.myapp:id/passwordEditText
waitUntilTextBeforeClick,submit

# At this time an OTP code should be sent by email or sms.
# this method waits for a value to be available on the previous file during 10 minutes
# When you have received your code, set the OTP code on the previous file
waitAndStoreOTP

# Select the edit text of your app where to put OTP Code
# for example
clickByText,OTP code

# Then you can use this method to enter the OTP code in the edit text
enterStoredOTP

How to add a json file on Internet containing an OTP Code

You can use any drive or system specific to your company. The key is to have an online json file that can be accessed through an unique URL and that you can modify at any time.

Here is an example with google drive :

  • Add a file like this otp.json on your google drive.

  • On the file, you can click on the ‘…' to select the action 'share’

  • Select ‘Anyone with the link can view’.

  • Then copy link and put it in another tab of your browser

  • You can get the FILEID which is between /d/ and /view

  • In the following link, replace FILEID with the unique file ID that you copied from above

    https://drive.google.com/uc?export=download&id=FILEID
  • Your final link should look similar to this

    https://drive.google.com/uc?export=download&id=14cLhFfCTAPWQfpSYE-nVwPROn90ppQuip
  • Test your link, it should download your otp.json file

  • You can now change the contents of the otp.json stored to your google drive

To do this right click on the file or click on '…' button and select Open with ‘Text Editor’. Accept the message to authorize Text Editor to modify your file. You can then edit the field value of your json and click on button ‘save to drive’ to save the file.

  • No labels