Status | ||||
---|---|---|---|---|
|
Besoin
Je veux uploader un fichier via mon application
Solution
#CLEAN DOWNLOAD FOLDER
emptyDownloadFolder
...
Need
In my functional journey, I want a file to upload with my mobile app or web site
How to
GDSL for android gives commands to download a file on device and use it in an app.
This example download a file on the device, go to wetransfer website and upload this file
Code Block |
---|
# empty the downloads folder before each iteration of test filesEmptyDownloadsFolder # download a file in the downloads directory of the device filesDownloadFile,https:// |
...
dl. |
...
greenspector.com/ |
...
pressEnter
waitUntilPageLoaded,30000
clickByTextExact,Français
waitUntilTextExact,Télécharger gratuitement
clickByTextExact,Télécharger gratuitement
waitUntilByIdBeforeClick,com.android.chrome:id/positive_button,true
waitUntilByTextExactBeforeClick,File downloaded,true
applicationKill,com.android.chrome
#SEND IMAGE BY MESSAGES APP
applicationStart,com.samsung.android.messaging
clickById,com.samsung.android.messaging:id/fab
waitUntilTextExact,New conversation
enterText,0600000000
clickById,com.samsung.android.messaging:id/attach_gallery_button
waitUntilId,com.samsung.android.messaging:id/gallery_item_selector
clickById,com.samsung.android.messaging:id/gallery_item_selector
waitUntilByTextExactBeforeClick,Resize,true
Explication
1/ Nettoyage du répertoire de téléchargement du téléphone
2/ Je télécharge un fichier dans le répertoire de téléchargement du téléphone
...
pdf/sustainability.pdf"
########## prepare browser ############################
browserPrepareAndOpenForReference
measureStart,PAUSE_REFERENCE
pause,30000
measureStop
########################################################
###### go to wetransfer site ###########################
browserGoToUrl,https://wetransfer.com
measureStart,CHRGT_HOME
pressEnter
waitUntilText,Send a file
pause,${PAUSEAFTERLOAD}
measureStop
########################################################
########## stuf to go to the upload button ##################
measureStart,CHRGT_PAGE_AGREEMENT
clickByText,Send a file
waitUntilText,please agree
measureStop
measureStart,CHRGT_PAGE_UPLOAD
clickByText,I agree
waitUntilTextBeforeClick,Okay
waitUntilText,Upload files
measureStop
########################################################
###### upload the previous donwloaded file #############
measureStart,ACTION_SELECT_ONE_FILE
clickByText,Upload files
clickByText,Allow
#open the file system on the device
clickByText,Files
# select the dowloads folder on file system
filesSelectDownloadsFolder
# select the previous downloaded file
clickByText,sustainability.pdf
waitUntilText,Add more files
measureStop
########################################################
|
Explanation
1/ Clean downloads folder to start my test iteration in same state: filesCleanDownloadsFolder
2/ Download a file on device : filesDownloadFile
3/ Select the previous downloaded file by going to downloads folder: filesSelectDownloadsFolder
...