When there is a need to upload files to your Test Application, we can upload the file from three sources:
- Local file system - In Hybrid Executions, the files needed during the Test can be uploaded from the local Test Machine
- public URLs - direct link for files from Amazon S3, imgur, shutterstock, Google Drive, Drop box e.t.c
- Testsigma Cloud Storage - Testsigma provides cloud storage option for storing your files that are needed during Test Execution.
Note: Local file system or file path can't be used in any cloud Execution Models like Testsigma Labs, Sauce Labs or BrowserStack since the Cloud machines doesn't have access to your local File system.
Getting the file URL
Check the below article for more details on uploading files and getting the file path:
How to upload Attachments to Testsigma Cloud and use it in Test Steps?
You will get a file path of the form:
Getting the file path for local storage is straightforward.
Windows file URL - C:\\Users\user\My Documents\adventure-beach-compass-691637-resized.jpg
Linux or Mac - /home/user/Documents/adventure-beach-compass-691637-resized.jpg
You can get the direct link for the file from your respective Storage provider.
Using the URL in Test Steps
Now let us discuss how we can use these links in our Test Steps.
We will take an example with the NLP - Upload file testdata using the element ui identifier
1. While creating a new Test Step, enter 'upload' in Action Text box and select the grammar Upload file testdata using the element ui identifier from the suggested NLP statements list.
2. Replace testdata part with the file path obtained in previous Section.
3. Replace the ui identifier part with the UI Identifier for the Input box in the Webpage.
After replacing the test data and ui identifier part with actual values, the Test Step will look similar to the following:
- Testsigma Cloud Storage - Upload file testsigma-storage:/testsigma.com/uploads/9/7/adventure-beach-compass-691637-resized.jpg using the element upload_button
- 3rd party Storage - Upload file https://s3.amazonaws.com/dev.testsigma.com/samples/videos1.mp4 using the element upload_button
- Local windows file - Upload file C:\\Users\user\My Documents\adventure-beach-compass-691637-resized.jpg using the element upload_button
- Local Linux/Mac file - Upload file /home/user/Documents/adventure-beach-compass-691637-resized.jpg using the element upload_button
Note: In some Web pages, the file upload button(usually named Submit or Upload) might be hidden and the file gets uploaded automatically as soon as we select the file. In those cases, you can skip the next step.
Also, in such cases, Testsigma Chrome UI Recorder will not work and we will have to find the UI Identifier for that Input element manually - Inspect the UI Identifier manually
4. If there's a Submit or Upload button, add a Test Step to click on the button to upload the file - Click Upload button
Note: Based on the file size, you may need to add an additional "Wait" step before performing next step.
5. Continue adding further steps to complete the Test Case.
That's all we need perform in order to add a Test Step to upload a file using Testsigma.