Here, we introduce effective prompts for creating specific test cases with MagicPod Autopilot.
We are also continuously looking for examples of how you use MagicPod Autopilot and effective prompts. Please feel free to share via the MagicPod Slack community or by contacting us directly.
Table of Contents
Test to get the subject of the latest email with MailSlurp
Related page: Email tests with MailSlurp
Prerequisite: Following the instructions in the help page above, obtain both the API access key and Inbox ID, and set their values in MagicPod’s secret shared variables.
Prompt:
Please create a test to retrieve the subject of the latest email with MailSlurp. The API key and InboxID have already been registered as shared variables.
Test to extract information from the email body with MailSlurp
Related page: Email tests with MailSlurp
Prerequisite: Following the instructions in the help page above, obtain both the API access key and Inbox ID, and set their values in MagicPod’s secret shared variables.
Prompt:
Please create a test to retrieve the 6-digit verification code from the body of the latest email with MailSlurp. The API key and Inbox ID have already been registered as shared variables.
Test to get the subject of the latest email with Gmail
Related page: Email tests with Gmail Web API
Prerequisite: Following the instructions in the help page above, obtain the Client ID, Client Secret, and Refresh Token, and set their values in MagicPod’s secret shared variables.
Prompt:
Please create a test that retrieves the subject of the latest Gmail using the Web API Call command.
Test to extract information from the email body with Gmail
Related page: Email tests with Gmail Web API
Prerequisite: Following the instructions in the help page above, obtain the Client ID, Client Secret, and Refresh Token, and set their values in MagicPod’s secret shared variables.
Prompt:
Please create test steps using the Web API Call command according to the following instructions:
1.Retrieve the Access Token
In the Web API Call, set as follows:
Method: POST
URL: https://accounts.google.com/o/oauth2/token
Header: Key = Content-Type, Value = application/x-www-form-urlencoded
Body: raw data, client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}&refresh_token=${REFRESH_TOKEN}&grant_type=refresh_token
Result: Variable = ACCESS_TOKEN, JavaScript = jsonResponse["access_token"]
2. Retrieve the Mail ID
Method: GET
URL: https://www.googleapis.com/gmail/v1/users/me/messages/
Header: Key = Authorization, Value = Bearer ${ACCESS_TOKEN}
Result: Variable = MAIL_ID, JavaScript = jsonResponse["messages"][0]["id"]
3. Retrieve the Mail Body
Method: GET
URL: https://www.googleapis.com/gmail/v1/users/me/messages/${MAIL_ID}
Header: Key = Authorization, Value = Bearer ${ACCESS_TOKEN}
Result: Variable = MAIL_CONTENTS, JavaScript =
const inlineMessagePart = function(messagePart) {
let messagePartBodies = [{"mimeType": messagePart.mimeType, "body": messagePart.body}];
if ("parts" in messagePart) {
for (const subMsgPart of messagePart["parts"]) {
messagePartBodies = messagePartBodies.concat(inlineMessagePart(subMsgPart));
}
}
return messagePartBodies;
};
atob([jsonResponse['payload']].map(inlineMessagePart).flat().filter(function(item) { return item.mimeType === "text/plain"; })[0]['body']['data']);
After the above steps, add a step to search MAIL_CONTENTS for the specified number of digits in the integer string, and store it in the variable “AUTHENTICATION INFORMATION”.