I'm trying to improve a script that I already have for load testing with Gatling. The scripts consist in injecting data filling forms with different type of inputs(dropdowns, textboxes, checkboxes, etc..). Now I have a form to upload attachments and I am trying to POST a PDF file but I have not found a way to do it.
If a open the network in the browser developer tools and upload the file and continue to the next form this is what I get:
1- First POST is when I click on "Choose File"
2- The second POST is when the file is already uploaded and I click on "Save & Continue"
I'm pretty sure I'm doing something very wrong, this is the .exec I'm currently have
.exec(http("Upload the file")
.post("/private/private/private/forms/submit")
.headers(shared_headers)
.formParamMap(Map(
"resumableChunkNumber" -> "1",
"resumableChunkSize" -> "1048576",
"resumableCurrentChunkSize" -> "10080",
"resumableTotalSize" -> "10080",
"resumableType" -> "application/pdf",
"resumableFilename" -> "Caso_SimuladoSC_202.pdf",
"resumableRelativePath" -> "Caso_SimuladoSC_202.pdf",
"resumableTotalChunks" -> "1"))
.bodyPart(RawFileBodyPart("file", "Caso_SimuladoSC_202.pdf")
.fileName("Caso_SimuladoSC_202.pdf")
.transferEncoding("binary")).asMultipartForm
)// end exec
The PDF file is in my Gating repo with another files.
How can I achieve this? Any idea?
Answered on Gatling's community forum. This form is signed with AWS Signature v4.
Related
I faced a lot of trouble setting up trigger mail extensions along with cloud functions. Here I explain step-by-step how to get things done!
Lets get working.
Set up Firebase
Create a project if you haven't already here.
To use trigger-mail extension and cloud functions, you need to
upgrade the project to BLAZE Plan.
Go on and do that now (check bottom left side of window).
Go on and set-up firestore database and storage. This is
necessary for both extension and functions to work.
Configuring Extensions
Click on Extensions panel under Build.
Find Trigger Mail extension and click on install.
Here's the main part:
Click on next 2 times.
Grant all necessary permissions.
This is where you'll link your mail account from which you'll be sending mail
You'll be greeted with such a screen ->
URI
If the mail I'm linking is xyz123#gmail.com, this will be your SMTPS format:
smtps://xyz123#gmail.com#smtp.gmail.com:465
Use this in the SMTPS connection URI field.
Password
This is a little hectic step.
Enable 2 factor Authorization in your Gmail here.
Now you would need to create an App Password
Click on Generate.
You'll see such a screen ->
You have to enter this password in the SMTP password field and click Create secret.
NOTE: Do not enter spaces.
Wait for sometime for the process to finish.
After it's done, Your screen will look like this ->
You could keep the same Gmail for Default Reply-To address as the original mail, or one of your choice.
Let Email documents collection be the same.
Click on Install Extension.
This will take few minutes.*
Voila, you're done!
Let's send a test mail.
Now in-order to send a mail, you need to add a document to mail collection in your firestore db.
Find official documentation here.
to: ['someone#example.com'],
message: {
subject: 'Hello from Firebase!',
text: 'This is the plaintext section of the email body.',
html: 'This is the <code>HTML</code> section of the email body.',
}
This is the format of document to send mail.
"to" is an array and "message" is a map .
Let's create a collection manually ->
Here's my document window
Let's save this document.
If done correctly, within few seconds, you'll see the document automatically update with more fields like attempts etc.
Check your mail for the email.
Writing a function.
Lets set up Firebase CLI
Download Node.js here.
Run the installer.
Copy the installed path in your drive.
I have mine installed under C:\Program Files\nodejs.
Search environment variables in your system tray.
Paste the directory under System Variables -> Path, create new and add.
Download and install Firebase CLI by following the steps here..
login to firebase cli using the above doc.
Open your project in code editor, and type firebase init in terminal.
Select project and add functions support. It'll create a new folder functions.
I've written a function that sends a onboarding email when a new user is created.
const functions = require("firebase-functions");
const admin = require("firebase-admin");
admin.initializeApp();
// sends mail if new user is regestired
exports.userOnboardingMail = functions.auth.user().onCreate((user)=>{
admin.firestore().collection("mail").add({
"to": [user.email],
"message": {
"subject": "Welcome to My app! Explore functionalities here.",
"text": `Hi, ${user.displayName}. \n\nIt's nice to have you on-board.`,
},
})
.then((result) => {
console.log(
"onboarding email result: ", result,
"\ntime-stamp: ", Date.now);
});
});
Hope I was able to make your day a bit easier :)
Upvote if it helped..
Additional Links
Learn firebase cloud functions here. really recommend this channel.
Official Trigger-mail docs.
Firebase CLI docs.
Firebase Cloud Functions docs
Im trying to create a gmail draft using gmail API and open it in a new tab.
When i try to open a draft using the following url : https://mail.google.com/mail/u/0/#drafts/ draft id , from a external web it does not open the draft. Instead it lists the drafts.
If i do the same in a Gmail tab it works as expected.
You can reproduce it following this steps
Chose any draft and copy its message id , you can use this
Create a url joining https://mail.google.com/mail/u/0/#drafts/ + the message id you got in the last step.
Open a new tab in Chrome and paste it, it will send you to your draft list.
If you paste the same url in the the same tab it will open the draft.
More information about the problem
It does not work with https://mail.google.com/mail/u/0/#drafts/?compose= neither
Chrome console throws this error when i try to open a draft from another tab
console error
I noticed if you open a draft the url is like this one https://mail.google.com/mail/u/0/#drafts?compose=JHrtffLJpZXxNwzKGMhcjvjBrqfPRwKWvkvJbtWpRffXldzxkNQhmkkBWJsHPbdSPdDgBVKpHKZMNtCVFgXrhwMCVjCdCRqTLJhGvqrXNKFZmJDGZ , this url works also to open the draft editor from other tabs, but where does the compose value come from?
I know it is not a API error or problem but if somebody had the same problem and know any way to solve it i will apreciate.
So the question is, how can i create a url to open a gmail draft using Gmail API ?
The way to make this url changed, now it works like this:
mail.google.com/mail/#inbox?compose=draft.message.id
If you list your drafts you get
{
"drafts": [
{
"id": "r5632827412362757569",
"message": {
"id": "174f4fa0dd96af123",
"threadId": "174f4f59344d6321"
}
}
],
...
}
So, to open this draft you need the following url :
mail.google.com/mail/#inbox?compose=174f4fa0dd96af123
Your goal:
To be able to open a browser tab directly focused on a specific draft of your choosing, from the drafts in your mailbox. (Correct me if I'm wrong).
Background:
You noticed that drafts have a "compose" parameter visible in the url when focused within the UI.
The drafts resource doesn't include the "compose" parameter, so we can't get it from the API, and it also isn't equal to the draft id.
Conclusion:
Since the parameter needed is not publicly available via API, you can't achieve your goal at the moment. You can request the feature to Google directly by creating a "Feature Request" for the Gmail API. Here's the link Issue Tracker.
I've got a database containing offline conversions (email, phone, name, purchase_amount, etc). I can export this database in .csv or .xls and I can also email this file on a daily basis to a Gmail account.
As Zapier has a Google Sheet to "Facebook offline event" API, I tried this workflow with Zapier.com:
Export my database in .xls: OK
Mail it to my Gmail account as an email attachment: OK
Grab the attachment and upload file to Google Drive using Zapier: OK
This is the part where I'm in trouble: I want to copy the content of the .xls file that is on Google Drive to a new Google Sheet. I can't figure out how to do this in Zapier.
Finally, on every new spreadsheet created or new row added (depending on how I configure the Zap) , pushing the data to Facebook API.
I'm not a developer so I want to avoid coding if possible. I tought I could easily do it with zapier but it seems that working with data inside a file is not so easy.
Any help would be much appreciated.
Thank you,
Best regards,
Tim.
If it were me I would look into the scripting capabilities of Google Sheets to try and achieve this, having your code execute from a single place eliminates other possible points of failure. That said, I have put together a somewhat hacky, code free solution that should set you up to do what you are looking to achieve. I break it down step by step below:
Step 1: Export database as .csv file. I could only get this to work with .csv files and not .xlsx files. There may be the ability to do so but it would require further trial and error.
Step 2: Mail it to your Gmail account where I assume there is a Zap which triggers to upload the attachment to your drive account automatically.
Step 3: Setup a second Zap that is connected to your Gmail account
that triggers when you receive an email with an attachment.
Step 4: Isolate the attachment file from the results of the triggered Zap and use it as input for the following formatter action step.
Step 5: Setup your formatter action step using the text option. Within the formatter template select trim white space and use the attachment, isolated from the trigger step, as its input. See example photo here.
Step 6: Setup your final step which is the create Google Sheet function of the Google Sheets Zap. Enter a title for your new sheet, it will probably need to be a unique value I used the attachment ID from step one as my title but you can set it to whatever you would like. In the headers section type =IMPORTDATA("") . Between the two quotation marks place the output of the previous formatter step and then run the Zap. See example photo here.
Explanation: When Zapier catches the attachment file from your inbound email it seems to be stored as raw data. Given this we cannot simply dump this information into a spreadsheet as it would be unreadable. However it seems Zapier has a method for converting this raw data through the endpoint https://zapier.com/engine/hydrate. When we input the raw attachment data into the formatter step Zapier provides a link pointing to the URL for converting the data into its original format. We take this URL and using the Google worksheet function IMPORTDATA() we are able to import the file using Zapier's file conversion engine. Now that the data is in your new sheet you can set up an additional Zap to do something with it. Also note that the Zap to upload the attachment to your Google Drive is not necessary with this setup. That said if you are looking to keep backups of your data then keep it on otherwise you may have the opportunity to save yourself some zaps.
Hope this helps!
Many thanks for your awesome reply. I also tried the "trim whitespace" to get the data back. I only missed the "importdata" function which is super powerful. Indeed it only works with .csv. With .xls file, importdata gives the source code of xls file which is useless.
I ended with 2 zaps:
Grab Gmail attachment, upload to Google Drive (for backup & monitoring) and create new spreadsheet
Send Facebook offline conversion when new spreadsheet is added (filter: only continue when file name is xxxx), lookup spreadsheet row (I took one column that has the same value for each row) and finaly I could match my columns with the Facebook API.
I create automated testing by click on download button to download file (.pdf, .xlsx, .exe, .application) but every download, it showed the pop up dialog to confirm.
So, how to access this pop up or let it download automatically without asking?
I try to add reference in execution and run it by opening browser and click download, but it still show that dialog message.
For Chrome
Log view (chrome)
For Firefox
Log view (firefox)
Or Set Reference by this way (still not working)
You need to set these preferences under Project -> Settings -> Execution -> Default -> WebUI -> Chrome.
Variable prefs has to be created and values below has to be added to array.
browser.download.manager.showWhenStarting : Boolean : false
safebrowsing.enabled : Boolean : false
browser.helperApps.neverAsk.saveToDisk : String :
application/download,
application/octet-stream, text/csv, application/vnd.ms-excel, application/msexcel, application/x-msexcel, application/excel, application/pdf
safebrowsing-disable-download-protection : Boolean : true
You can read more about Desired Capabilities in Execution settings.
Also struggled a bit. I've got the chrome answer still searching for Firefox answer.
For Chrome add a property with the following:
Name: prefs
Type: Dictionary
Value: {download.prompt_for_download=false}
If you want to specify the download directory you can add the value to the Dictionary: {download.default_directory}
You can also check out this site Capabilities & ChromeOptions for Chrome's capabilities.
I have an application in Swift which has the function of "I forgot my password", which sends a URL in the user's email, in that URL contains user and token
Example:
https://example.com/forgotPassword#/user/token
Clicking the "https://example.com/forgotPassword#/user/token" link requires the application to open when the link is clicked by passing the parameters after the # (user / token) as follows in the example.
I need to click on the link and open the application.
I tried to modify the info p list in xcode but it generates a link example: application: //, me limiting to send it by email for example, could anyone help me please? If you have not understood, I can explain it better, thank you in advance
The problem is that you are using the word "scheme" in your question title but your example doesn't use a scheme. Well, it does use a scheme, but the scheme is https, which is a link. You need your app to define and declare its own scheme.