Skip to content

Instantly share code, notes, and snippets.

pm.sendRequest({
url: '{{your url}}',
method: 'POST',
header: {
'Content-Type': 'multipart/form-data',
},
body: {
mode: 'formdata',
formdata: [
var random_id = parseInt(Math.random() * 10000);
pm.environment.set("random_id", random_id);
var domain = pm.environment.get("domain");
pm.sendRequest({
url: "https://api"+domain+"./signup",
method: 'POST',
header: {
'Content-Type': 'application/json',
},
pm.sendRequest({
url: environment.host + "url" + environment.a_signup + "url",
method: 'GET',
}, function(err, response) {
//запись в переменную ответа
var code = response.json();
//копирование в переменную код юзера
pm.environment.set("code_signup", code.code);
pm.sendRequest({
url: "<host>/api/sign_in",
method: 'POST',
header: 'Content-Type:application/json',
body: {
mode: 'raw',
raw: JSON.stringify({
"email": pm.environment.get("user_email"),
"password": pm.environment.get("user_password")
})
var update_name_user_c = "Smily " + parseInt(Math.random() * 10000);
pm.environment.set("update_name_user_c", update_name_user_c);
var arr_timezone = ["Africa/Tunis" , "Asia/Gaza" , "America/Costa_Rica", "America/Puerto_Rico" , "Atlantic/Cape_Verde" , "Europe/London" , "Europe/Dublin" , "Europe/Oslo" , "Europe/Rome"];
var rand_arr_timezone = Math.floor(Math.random() * arr_timezone.length);
var alert_rand_arr_timezone = arr_timezone[rand_arr_timezone];
pm.environment.set("alert_rand_arr_timezone", alert_rand_arr_timezone);
var jsonData = JSON.parse(responseBody);
tests["response contains approved"] = jsonData.data.approved >= 1;
//or
pm.test("response contains approved", function () {
pm.expect(pm.response.text()).to.include("approved");
});
pm.test("responce contains billing_type", function () {
pm.expect(jsonData.billing_type).to.eql("check");
});
public boolean scrollPageDown() {
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("window.scrollBy(0,250)");
boolean scrollResult = (boolean) executor.executeScript {
"var scrollBefore = $(window).scrollTop();" +
"window.scrollTop(scrollBefore, document.body.scrollHeight);" +
"return $(window).scrollTop() > scrollBefore;"};
return scrollResult;
}
var moment = require("moment");
pm.environment.set('start', moment().add(30, 'minutes').format('YYYY-MM-DD HH:mm:00'));
///or
pm.environment.set('end', moment().add(45, 'minutes').toISOString());