diff --git a/Makefile b/Makefile
index d2b587d2..7d6d2f3d 100644
--- a/Makefile
+++ b/Makefile
@@ -12,6 +12,7 @@ start-mirror-server:
cp ./apache-jmeter-5.6.3/lib/log4j-core-2.22.1.jar ./apache-jmeter-5.6.3/lib/log4j-core-2.11.1.jar
cp ./apache-jmeter-5.6.3/lib/log4j-1.2-api-2.22.1.jar ./apache-jmeter-5.6.3/lib/log4j-1.2-api-2.11.1.jar
echo "Starting the mirror server on port 8500."
+
./apache-jmeter-5.6.3/bin/mirror-server --port 8500 &
test:
diff --git a/integration/001_extensions-enable-all.jmx b/integration/001_extensions-enable-all.jmx
index 0c82df8a..2a7bf87d 100644
--- a/integration/001_extensions-enable-all.jmx
+++ b/integration/001_extensions-enable-all.jmx
@@ -45,6 +45,11 @@
HTTP path for the raw.githubusercontent.com repo
=
+
+ config_path
+ ${__BeanShell(import org.apache.jmeter.services.FileServer; FileServer.getFileServer().getBaseDir();)}
+ =
+
@@ -131,31 +136,9 @@
javascript
-
+ ${config_path}/scripts/extract_extensions_ids.js
true
- var resp = JSON.parse(prev.getResponseDataAsString());
-var excludedExtensions = (vars.get("excludedExtensions") || "").split(",");
-
-var extensions = {};
-
-for (var i = 0; i < resp.extensions.length; i++) {
- var ext = resp.extensions[i];
- if (excludedExtensions.indexOf(ext.id) === -1) {
- extensions[ext.id] = true;
- }
-}
-
-
-
-extensionList = Object.keys(extensions);
-//extensionList[1] = 'nostrmarket'
-//extensionList.length = 3
-vars.put("extensions", extensionList);
-
-
-
-vars.put("extensionsLength", extensionList.length);
-
+
@@ -536,13 +519,9 @@ vars.put("extensionsLength", extensionList.length);
javascript
-
+ ${config_path}/scripts/extract_extension_data.js
true
- var extensions = vars.get("extensions")
-var extensionIndex = vars.get("extensionIndex")
-
-vars.put("extension", extensions.split(",")[extensionIndex - 1])
-
+
@@ -659,20 +638,9 @@ vars.put("extension", extensions.split(",")[extensionIndex -
javascript
-
+ ${config_path}/scripts/extract_extension_data.js
true
- var extensions = vars.get("extensions")
-var adminExtensions = vars.get("adminExtensions")
-var extensionIndex = vars.get("extensionIndex")
-var extesion = extensions.split(",")[extensionIndex - 1]
-var isAdminExtension = adminExtensions.split(",").indexOf(extesion) !== -1
-
-vars.put("extension", extesion)
-vars.put("isAdminExtension", isAdminExtension)
-
-var responseCode = prev.getResponseCode()
-
-vars.put("responseCode", responseCode)
+
@@ -854,13 +822,9 @@ vars.put("responseCode", responseCode)
javascript
-
+ ${config_path}/scripts/extract_extension_data.js
true
- var extensions = vars.get("extensions")
-var extensionIndex = vars.get("extensionIndex")
-
-vars.put("extension", extensions.split(",")[extensionIndex - 1])
-
+
@@ -1156,18 +1120,9 @@ vars.put("extension", extensions.split(",")[extensionIndex -
javascript
-
+ ${config_path}/scripts/extract_latest_extension_release.js
true
- var resp = JSON.parse(prev.getResponseDataAsString())
-var latestRelease = resp[resp.length - 1]
-
-var ext_id = vars.get("extension")
-
-vars.put("ext_id", ext_id)
-vars.put("archive", latestRelease.archive)
-vars.put("source_repo", latestRelease.source_repo)
-vars.put("version", latestRelease.version)
-
+
@@ -1628,27 +1583,9 @@ vars.put("version", latestRelease.version)
javascript
-
+ ${config_path}/scripts/check_admin_extension_status_code.js
true
- var responseCode = +prev.getResponseCode()
-var isAdminExtension = vars.get("isAdminExtension")
-
-
-if (isAdminExtension === 'true') {
- if (responseCode !== 200 && responseCode !== 401) {
- AssertionResult.setFailureMessage(
- "Expected response code 200 for 401 for admin extension but got: " +
- responseCode
- );
- AssertionResult.setFailure(true);
- }
-} else if (responseCode !== 200) {
- AssertionResult.setFailureMessage(
- "Expected response code 200 but got: " + responseCode
- );
- AssertionResult.setFailure(true);
-}
-
+
@@ -1726,11 +1663,6 @@ if (isAdminExtension === 'true') {
8
-
- 3000
- for the callback to be invoked
-
-
@@ -1877,11 +1809,6 @@ if (isAdminExtension === 'true') {
8
-
- 3000
- for the callback to be invoked
-
-
@@ -1946,27 +1873,9 @@ if (isAdminExtension === 'true') {
javascript
-
+ ${config_path}/scripts/check_admin_extension_status_code.js
true
- var responseCode = +prev.getResponseCode()
-var isAdminExtension = vars.get("isAdminExtension")
-
-
-if (isAdminExtension === "true") {
- if (responseCode !== 200 && responseCode !== 401) {
- AssertionResult.setFailureMessage(
- "Expected response code 200 for 401 for admin extension but got: " +
- responseCode
- );
- AssertionResult.setFailure(true);
- }
-} else if (responseCode !== 200) {
- AssertionResult.setFailureMessage(
- "Expected response code 200 but got: " + responseCode
- );
- AssertionResult.setFailure(true);
-}
-
+
diff --git a/integration/002_lnurl.jmx b/integration/002_lnurl.jmx
index aba4381e..14756112 100644
--- a/integration/002_lnurl.jmx
+++ b/integration/002_lnurl.jmx
@@ -30,27 +30,27 @@
paidChargeCount
- 5
+ 3
=
userTipCount
- 5
+ 3
=
thinkTime
- 3000
+ 300
=
lnurlpCount
- 5
+ 3
=
lnurlwCount
- 5
+ 3
=
@@ -68,6 +68,11 @@
${__property(mirrorPort,,8500)}
=
+
+ configPath
+ ${__BeanShell(import org.apache.jmeter.services.FileServer; FileServer.getFileServer().getBaseDir();)}
+ =
+
@@ -484,34 +489,17 @@
javascript
-
+ ${configPath}/scripts/lnurl_check_created_pay_link.js
true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var walletId = vars.get("walletId")
-var lnurlpCounter = +vars.get("lnurlpCounter")
-
-if (!resp.id) {
- AssertionResult.setFailureMessage("Pay Link not created");
- AssertionResult.setFailure(true)
-} else if (resp.wallet !== walletId){
- AssertionResult.setFailureMessage("Pay Link description expected to be '"+walletId+"', but was: " + resp.wallet);
- AssertionResult.setFailure(true)
-} else if (resp.description !== "receive payments "+lnurlpCounter){
- AssertionResult.setFailureMessage("Pay Link description expected to be 'receive payments "+lnurlpCounter+"', but was: " + resp.description);
- AssertionResult.setFailure(true)
-}
+
javascript
-
+ ${configPath}/scripts/lnurl_extract_pay_link_id.js
true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-vars.put("payLinkId", resp.id || 'no-pay-link-id');
-vars.put("payLinkLnurl", resp.lnurl || 'no-pay-link-lnurl');
+
@@ -928,12 +916,7 @@ vars.put("payLinkLnurl", resp.lnurl || 'no-pay-link-lnurl');
-
- 3000
- for the webhook to be called
-
-
-
+
@@ -941,7 +924,7 @@ vars.put("payLinkLnurl", resp.lnurl || 'no-pay-link-lnurl');
${port}
${scheme}
UTF-8
- /api/v1/payments/${paymenHash}
+ /api/v1/wallet
GET
true
false
@@ -954,10 +937,30 @@ vars.put("payLinkLnurl", resp.lnurl || 'no-pay-link-lnurl');
+
+ Referer
+ ${scheme}://${host}:${port}/wallet?wal=${walletId}
+
+
+ Accept-Language
+ en-US,en;q=0.5
+
X-Api-Key
${inkey}
+
+ Accept-Encoding
+ gzip, deflate
+
+
+ User-Agent
+ Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:105.0) Gecko/20100101 Firefox/105.0
+
+
+ Accept
+ application/json, text/plain, */*
+
@@ -971,59 +974,21 @@ vars.put("payLinkLnurl", resp.lnurl || 'no-pay-link-lnurl');
8
-
- $.details.extra.wh_success
- true
- true
- false
- false
- false
-
-
-
- $.details.extra.wh_message
- OK
- true
- false
- false
- false
-
-
-
- javascript
-
-
+
true
- var resp = JSON.parse(prev.getResponseDataAsString())
-var paymenHash = vars.get("paymenHash")
-
-
-var whResp = resp.details.extra.wh_response
-var separatorIndex = whResp.indexOf("\r\n\r\n")
-if (separatorIndex == -1) {
- AssertionResult.setFailureMessage("Webhook response has wrong format: " + whResp);
- AssertionResult.setFailure(true)
-} else {
- var headers = whResp.substring(0, separatorIndex)
- var bodyStr = whResp.substring(separatorIndex)
- var body = JSON.parse(bodyStr)
- if (body.payment_hash !== paymenHash) {
- AssertionResult.setFailureMessage("Incorrect webhook payment hash: " + JSON.stringify(body));
- AssertionResult.setFailure(true)
- } else if (headers.indexOf("h1: 1") === -1) {
- AssertionResult.setFailureMessage("Expected header missing: 'h1': '1'");
- AssertionResult.setFailure(true)
- } else if (!body.body || !body.body.b2 || body.body.b2 !== 2) {
- AssertionResult.setFailureMessage("Expected body field missing: \"body\": {\"b2\": 2}, found: " + JSON.stringify(body.body));
- AssertionResult.setFailure(true)
- }
-}
-
-
+ ${configPath}/scripts/lnurl_check_balance.js
+
+
+ javascript
-
+
+ 100
+ for the webhook to be called
+
+
+
@@ -1031,7 +996,7 @@ if (separatorIndex == -1) {
${port}
${scheme}
UTF-8
- /api/v1/wallet
+ /api/v1/payments/${paymenHash}
GET
true
false
@@ -1044,30 +1009,10 @@ if (separatorIndex == -1) {
-
- Referer
- ${scheme}://${host}:${port}/wallet?wal=${walletId}
-
-
- Accept-Language
- en-US,en;q=0.5
-
X-Api-Key
${inkey}
-
- Accept-Encoding
- gzip, deflate
-
-
- User-Agent
- Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:105.0) Gecko/20100101 Firefox/105.0
-
-
- Accept
- application/json, text/plain, */*
-
@@ -1081,26 +1026,30 @@ if (separatorIndex == -1) {
8
-
- true
-
-
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var lnurlpCounter = +vars.get('lnurlpCounter')
-
-
-var userBalance = +vars.get("userBalance")
-userBalance += 10 + lnurlpCounter
-
-// millisats
-if (resp.balance !== userBalance * 1000) {
- AssertionResult.setFailureMessage("Expected balance to be "+userBalance * 1000+", but got: "+ resp.balance);
- AssertionResult.setFailure(true)
-}
-
-vars.put("userBalance", userBalance)
+
+ $.details.extra.wh_success
+ true
+ true
+ false
+ false
+ false
+
+
+
+ $.details.extra.wh_message
+ OK
+ true
+ false
+ false
+ false
+
+
+
javascript
+
+ ${configPath}/scripts/lnurl_check_webhook_response.js
+ true
+
@@ -1568,23 +1517,9 @@ vars.put("userBalance", userBalance)
javascript
-
+ ${configPath}/scripts/lnurl_check_created_withdraw_link.js
true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var walletId = vars.get("walletId")
-var lnurlwCounter = +vars.get("lnurlwCounter")
-
-if (!resp.id) {
- AssertionResult.setFailureMessage("Withdraw Link not created");
- AssertionResult.setFailure(true)
-} else if (resp.wallet !== walletId) {
- AssertionResult.setFailureMessage("Withdraw Link wallet expected to be '" + walletId + "', but was: " + resp.wallet);
- AssertionResult.setFailure(true)
-} else if (resp.title !== "withdraw " + lnurlwCounter) {
- AssertionResult.setFailureMessage("Withdraw Link description expected to be 'withdraw " + lnurlwCounter + "', but was: " + resp.description);
- AssertionResult.setFailure(true)
-}
+
@@ -1995,12 +1930,7 @@ if (!resp.id) {
-
- 3000
- for the callback to be invoked
-
-
-
+
@@ -2008,7 +1938,7 @@ if (!resp.id) {
${port}
${scheme}
UTF-8
- /api/v1/payments/${paymenHash}
+ /api/v1/wallet
GET
true
false
@@ -2021,10 +1951,30 @@ if (!resp.id) {
+
+ Referer
+ ${scheme}://${host}:${port}/wallet?wal=${walletId}
+
+
+ Accept-Language
+ en-US,en;q=0.5
+
X-Api-Key
${inkey}
+
+ Accept-Encoding
+ gzip, deflate
+
+
+ User-Agent
+ Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:105.0) Gecko/20100101 Firefox/105.0
+
+
+ Accept
+ application/json, text/plain, */*
+
@@ -2038,59 +1988,21 @@ if (!resp.id) {
8
-
- $.details.extra.wh_success
- true
- true
- false
- false
- false
-
-
-
- $.details.extra.wh_message
- OK
- true
- false
- false
- false
-
-
-
- javascript
-
-
+
true
- var resp = JSON.parse(prev.getResponseDataAsString())
-var paymenHash = vars.get("paymenHash")
-
-
-var whResp = resp.details.extra.wh_response
-var separatorIndex = whResp.indexOf("\r\n\r\n")
-if (separatorIndex == -1) {
- AssertionResult.setFailureMessage("Webhook response has wrong format: " + whResp);
- AssertionResult.setFailure(true)
-} else {
- var headers = whResp.substring(0, separatorIndex)
- var bodyStr = whResp.substring(separatorIndex)
- var body = JSON.parse(bodyStr)
- if (body.payment_hash !== paymenHash) {
- AssertionResult.setFailureMessage("Incorrect webhook payment hash: " + JSON.stringify(body));
- AssertionResult.setFailure(true)
- } else if (headers.indexOf("h1: 1") === -1) {
- AssertionResult.setFailureMessage("Expected header missing: 'h1': '1'");
- AssertionResult.setFailure(true)
- } else if (!body.body || !body.body.b2 || body.body.b2 !== 2) {
- AssertionResult.setFailureMessage("Expected body field missing: \"body\": {\"b2\": 2}, found: " + JSON.stringify(body.body));
- AssertionResult.setFailure(true)
- }
-}
-
-
+ ${configPath}/scripts/lnurl_check_balance_after_withdraw.js
+
+
+ javascript
-
+
+ 1000
+ for the callback to be invoked
+
+
+
@@ -2098,7 +2010,7 @@ if (separatorIndex == -1) {
${port}
${scheme}
UTF-8
- /api/v1/wallet
+ /api/v1/payments/${paymenHash}
GET
true
false
@@ -2111,30 +2023,10 @@ if (separatorIndex == -1) {
-
- Referer
- ${scheme}://${host}:${port}/wallet?wal=${walletId}
-
-
- Accept-Language
- en-US,en;q=0.5
-
X-Api-Key
${inkey}
-
- Accept-Encoding
- gzip, deflate
-
-
- User-Agent
- Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:105.0) Gecko/20100101 Firefox/105.0
-
-
- Accept
- application/json, text/plain, */*
-
@@ -2148,23 +2040,30 @@ if (separatorIndex == -1) {
8
-
- true
-
-
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var userBalance = +vars.get("userBalance")
-userBalance -= 10
-
-// millisats
-if (resp.balance !== userBalance * 1000) {
- AssertionResult.setFailureMessage("Expected balance to be "+userBalance * 1000+", but got: "+ resp.balance);
- AssertionResult.setFailure(true)
-}
-
-vars.put("userBalance", userBalance)
+
+ $.details.extra.wh_success
+ true
+ true
+ false
+ false
+ false
+
+
+
+ $.details.extra.wh_message
+ OK
+ true
+ false
+ false
+ false
+
+
+
javascript
+
+ ${configPath}/scripts/lnurl_check_webhook_response.js
+ true
+
@@ -2232,26 +2131,9 @@ vars.put("userBalance", userBalance)
true
-
+ ${configPath}/scripts/lnurl_check_receive_wallet_balance.js
- var resp = JSON.parse(prev.getResponseDataAsString());
-
-var withdrawAmount = 10;
-var lnurlwCount = +vars.get("lnurlwCount");
-var withdrawCountPerLnurlw = +vars.get("withdrawCountPerLnurlw");
-
-var userBalance = withdrawAmount * lnurlwCount * withdrawCountPerLnurlw;
-
-// millisats
-if (resp.balance !== userBalance * 1000) {
- AssertionResult.setFailureMessage(
- "Expected balance to be " +
- userBalance * 1000 +
- ", but got: " +
- resp.balance
- );
- AssertionResult.setFailure(true);
-}
+
javascript
diff --git a/integration/003_tpos.jmx b/integration/003_tpos.jmx
index bac59c0d..a0e20cdc 100644
--- a/integration/003_tpos.jmx
+++ b/integration/003_tpos.jmx
@@ -33,6 +33,11 @@
3000
=
+
+ configPath
+ ${__BeanShell(import org.apache.jmeter.services.FileServer; FileServer.getFileServer().getBaseDir();)}
+ =
+
@@ -428,40 +433,17 @@
javascript
-
+ ${configPath}/scripts/tpos_check_tip_wallet_created.js
true
- var resp = JSON.parse(prev.getResponseDataAsString());
-
-var walletId = vars.get("walletId");
-var userId = vars.get("userId");
-if (!resp.id) {
- AssertionResult.setFailureMessage("TPoS not created");
- AssertionResult.setFailure(true);
-} else if (resp.user !== userId) {
- AssertionResult.setFailureMessage(
- "TPoS user id expected to be '" + userId + "', but was: " + resp.user
- );
- AssertionResult.setFailure(true);
-} else if (resp.name !== "tips wallet") {
- AssertionResult.setFailureMessage(
- "TPoS name expected to be 'tips wallet', but was: " + resp.name
- );
- AssertionResult.setFailure(true);
-}
-
+
javascript
-
+ ${configPath}/scripts/tpos_extract_tip_wallet_data.js
true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-vars.put("tipWalletId", resp.id || "no-tip-wallet-id");
-vars.put("tipinkey", resp.inkey || 'no-tip-inkey');
-vars.put("tipadminkey", resp.adminkey || 'no-tip-adminkey');
-
+
@@ -549,30 +531,17 @@ vars.put("tipadminkey", resp.adminkey || 'no-tip-adminkey');
javascript
-
+ ${configPath}/scripts/tpos_check_created.js
true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var walletId = vars.get("walletId")
-
-if (!resp.id) {
- AssertionResult.setFailureMessage("TPoS not created");
- AssertionResult.setFailure(true)
-} else if (resp.wallet !== walletId){
- AssertionResult.setFailureMessage("TPoS description expected to be '"+walletId+"', but was: " + resp.wallet);
- AssertionResult.setFailure(true)
-}
+
-
- javascript
-
-
- true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-vars.put("tposId", resp.id || 'no-tpos-id');
-
+
+ tposId
+ id
+
+ no-tpos-id
+
@@ -659,27 +628,9 @@ vars.put("tposId", resp.id || 'no-tpos-id');
javascript
-
+ ${configPath}/scripts/tops_check_updated.js
true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var walletId = vars.get("walletId")
-var tipWalletId = vars.get("tipWalletId")
-var tipOptions = vars.get("tipOptions")
-
-if (!resp.id) {
- AssertionResult.setFailureMessage("TPoS not updated");
- AssertionResult.setFailure(true)
-} else if (resp.wallet !== walletId){
- AssertionResult.setFailureMessage("TPoS description expected to be '"+walletId+"', but was: " + resp.wallet);
- AssertionResult.setFailure(true)
-} else if (resp.tip_wallet != tipWalletId) {
- AssertionResult.setFailureMessage("Tip wallet expected to be '"+tipWalletId+"', but was: " + resp.tip_wallet);
- AssertionResult.setFailure(true)
-} else if (resp.tip_options != tipOptions) {
- AssertionResult.setFailureMessage("Tip options expected to be '"+tipOptions+"', but was: " + resp.tip_options);
- AssertionResult.setFailure(true)
-}
+
@@ -767,30 +718,17 @@ if (!resp.id) {
javascript
-
+ ${configPath}/scripts/tpos_check_atm_created.js
true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var walletId = vars.get("walletId")
-
-if (!resp.id) {
- AssertionResult.setFailureMessage("TPoS not created");
- AssertionResult.setFailure(true)
-} else if (resp.wallet !== walletId){
- AssertionResult.setFailureMessage("TPoS description expected to be '"+walletId+"', but was: " + resp.wallet);
- AssertionResult.setFailure(true)
-}
+
-
- javascript
-
-
- true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-vars.put("ATMtposId", resp.id || 'no-tpos-id');
-
+
+ ATMtposId
+ id
+
+ no-tpos-id
+
@@ -1076,10 +1014,6 @@ vars.put("ATMtposId", resp.id || 'no-tpos-id');
1
-
- 1100
-
-
@@ -1244,27 +1178,18 @@ vars.put("ATMtposId", resp.id || 'no-tpos-id');
8
-
- javascript
-
-
- true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var paymentHash = vars.get("paymentHash")
-
-if (!resp.payment_hash) {
- AssertionResult.setFailureMessage("Payment failed");
- AssertionResult.setFailure(true)
-} else if (resp.payment_hash !== paymentHash) {
- AssertionResult.setFailureMessage("Payment hash expected to be '"+paymentHash+"', but was: " + resp.payment_hash);
- AssertionResult.setFailure(true)
-}
-
+
+ payment_hash
+ ${paymentHash}
+ true
+ false
+ false
+ false
+
-
- 1100
+
+ 1000
@@ -1634,23 +1559,14 @@ if (!resp.payment_hash) {
8
-
- javascript
-
-
- true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var paymentHash = vars.get("paymentHash")
-
-if (!resp.payment_hash) {
- AssertionResult.setFailureMessage("Payment failed");
- AssertionResult.setFailure(true)
-} else if (resp.payment_hash !== paymentHash) {
- AssertionResult.setFailureMessage("Payment hash expected to be '"+paymentHash+"', but was: " + resp.payment_hash);
- AssertionResult.setFailure(true)
-}
-
+
+ payment_hash
+ ${paymentHash}
+ true
+ false
+ false
+ false
+
@@ -2002,7 +1918,7 @@ if (!resp.payment_hash) {
-
+
1100
@@ -2093,23 +2009,14 @@ if (!resp.payment_hash) {
8
-
- javascript
-
-
- true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var paymentHash = vars.get("paymentHash")
-
-if (!resp.payment_hash) {
- AssertionResult.setFailureMessage("Payment failed");
- AssertionResult.setFailure(true)
-} else if (resp.payment_hash !== paymentHash) {
- AssertionResult.setFailureMessage("Payment hash expected to be '"+paymentHash+"', but was: " + resp.payment_hash);
- AssertionResult.setFailure(true)
-}
-
+
+ payment_hash
+ ${paymentHash}
+ true
+ false
+ false
+ false
+
@@ -2718,7 +2625,7 @@ if (!resp.payment_hash) {
-
+
1100
@@ -2819,21 +2726,11 @@ if (!resp.payment_hash) {
8
-
+
true
-
+ ${configPath}/scripts/tpos_check_user_balance.js
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var userBalance = +vars.get("userBalance")
-var amount = +vars.get("amount")
-userBalance -= amount * 1000
-
-// millisats
-if (resp.balance !== userBalance) {
- AssertionResult.setFailureMessage("Expected balance to be "+userBalance+", but got: "+ resp.balance);
- AssertionResult.setFailure(true)
-}
+
javascript
@@ -2898,19 +2795,9 @@ if (resp.balance !== userBalance) {
true
-
+ ${configPath}/scripts/tpos_check_admin_balance.js
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var adminBalance = +vars.get("adminBalance")
-var amount = +vars.get("amount")
-adminBalance += amount * 1000
-
-// millisats
-if (resp.balance !== adminBalance) {
- AssertionResult.setFailureMessage("Expected balance to be "+adminBalance+", but got: "+ resp.balance);
- AssertionResult.setFailure(true)
-}
+
javascript
@@ -3142,54 +3029,6 @@ if (resp.balance !== adminBalance) {
-
- 8888
-
- windowsupdate\.microsoft\.com.*
- (?i).*\.(bmp|css|js|gif|ico|jpe?g|png|swf|eot|otf|ttf|mp4|woff|woff2)
- .*msg\.yahoo\.com.*
- www\.download\.windowsupdate\.com.*
- toolbarqueries\.google\..*
- http?://self-repair\.mozilla\.org.*
- tiles.*\.mozilla\.com.*
- .*detectportal\.firefox\.com.*
- us\.update\.toolbar\.yahoo\.com.*
- .*\.google\.com.*/safebrowsing/.*
- api\.bing\.com.*
- toolbar\.google\.com.*
- .*yimg\.com.*
- toolbar\.msn\.com.*
- (?i).*\.(bmp|css|js|gif|ico|jpe?g|png|swf|eot|otf|ttf|mp4|woff|woff2)[\?;].*
- toolbar\.avg\.com/.*
- www\.google-analytics\.com.*
- pgq\.yahoo\.com.*
- safebrowsing.*\.google\.com.*
- sqm\.microsoft\.com.*
- g\.msn.*
- clients.*\.google.*
- .*toolbar\.yahoo\.com.*
- geo\.yahoo\.com.*
-
-
- true
- 4
- false
-
- false
- true
- true
- false
- true
-
-
- false
-
- 0
-
- true
- UTF-8
-
-
8500
0
diff --git a/integration/004_tpos-pay-to-enable.jmx b/integration/004_tpos-pay-to-enable.jmx
index 95795dec..6d795149 100644
--- a/integration/004_tpos-pay-to-enable.jmx
+++ b/integration/004_tpos-pay-to-enable.jmx
@@ -33,6 +33,11 @@
tpos
=
+
+ configPath
+ ${__BeanShell(import org.apache.jmeter.services.FileServer; FileServer.getFileServer().getBaseDir();)}
+ =
+
@@ -320,18 +325,9 @@
javascript
-
+ ${configPath}/scripts/extract_latest_extension_release.js
true
- var resp = JSON.parse(prev.getResponseDataAsString())
-var latestRelease = resp[resp.length - 1]
-
-var ext_id = vars.get("extension")
-
-vars.put("ext_id", ext_id)
-vars.put("archive", latestRelease.archive)
-vars.put("source_repo", latestRelease.source_repo)
-vars.put("version", latestRelease.version)
-
+
@@ -666,27 +662,9 @@ vars.put("version", latestRelease.version)
javascript
-
+ ${configPath}/scripts/check_admin_extension_status_code.js
true
- var responseCode = +prev.getResponseCode()
-var isAdminExtension = vars.get("isAdminExtension")
-
-
-if (isAdminExtension === 'true') {
- if (responseCode !== 200 && responseCode !== 401) {
- AssertionResult.setFailureMessage(
- "Expected response code 200 for 401 for admin extension but got: " +
- responseCode
- );
- AssertionResult.setFailure(true);
- }
-} else if (responseCode !== 200) {
- AssertionResult.setFailureMessage(
- "Expected response code 200 but got: " + responseCode
- );
- AssertionResult.setFailure(true);
-}
-
+
diff --git a/integration/005_lnurlw-race.jmx b/integration/005_lnurlw-race.jmx
index d0074026..e2b8fe5f 100644
--- a/integration/005_lnurlw-race.jmx
+++ b/integration/005_lnurlw-race.jmx
@@ -62,6 +62,11 @@
2
=
+
+ configPath
+ ${__BeanShell(import org.apache.jmeter.services.FileServer; FileServer.getFileServer().getBaseDir();)}
+ =
+
@@ -460,38 +465,46 @@
8
-
- javascript
-
-
- true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var walletId = vars.get("walletId")
-var lnurlpCounter = +vars.get("lnurlpCounter")
-
-if (!resp.id) {
- AssertionResult.setFailureMessage("Pay Link not created");
- AssertionResult.setFailure(true)
-} else if (resp.wallet !== walletId){
- AssertionResult.setFailureMessage("Pay Link description expected to be '"+walletId+"', but was: " + resp.wallet);
- AssertionResult.setFailure(true)
-} else if (resp.description !== "receive payments"){
- AssertionResult.setFailureMessage("Pay Link description expected to be 'receive payments "+lnurlpCounter+"', but was: " + resp.description);
- AssertionResult.setFailure(true)
-}
-
+
+ payLinkId
+ id
+
+ no-pay-link-id
+
-
- javascript
-
-
- true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-vars.put("payLinkId", resp.id || 'no-pay-link-id');
-vars.put("payLinkLnurl", resp.lnurl || 'no-pay-link-lnurl');
-
+
+ payLinkLnurl
+ lnurl
+
+ no-pay-link-url
+
+
+
+ id
+
+ false
+ false
+ false
+ true
+
+
+
+ wallet
+ ${walletId}
+ true
+ false
+ false
+ false
+
+
+
+ description
+ receive payments
+ true
+ false
+ false
+ false
+
@@ -1227,7 +1240,7 @@ vars.put("payLinkLnurl", resp.lnurl || 'no-pay-link-lnurl');
no-receive-inkey
-
+
javascript
@@ -1347,27 +1360,32 @@ props.put("receiveInkey", receiveInkey)
8
-
- javascript
-
-
- true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var walletId = vars.get("walletId")
-var lnurlwCounter = +vars.get("lnurlwCounter")
-
-if (!resp.id) {
- AssertionResult.setFailureMessage("Withdraw Link not created");
- AssertionResult.setFailure(true)
-} else if (resp.wallet !== walletId) {
- AssertionResult.setFailureMessage("Withdraw Link wallet expected to be '" + walletId + "', but was: " + resp.wallet);
- AssertionResult.setFailure(true)
-} else if (resp.title !== "withdraw " + lnurlwCounter) {
- AssertionResult.setFailureMessage("Withdraw Link description expected to be 'withdraw " + lnurlwCounter + "', but was: " + resp.description);
- AssertionResult.setFailure(true)
-}
-
+
+ id
+ .+
+ true
+ false
+ false
+ true
+
+
+
+ wallet
+ ${walletId}
+ true
+ false
+ false
+ false
+
+
+
+ title
+ withdraw ${lnurlwCounter}
+ true
+ false
+ false
+ false
+
withdrawLinkId
@@ -1659,7 +1677,7 @@ if (!resp.id) {
no-withdrawlink-callback
-
+
javascript
@@ -2004,7 +2022,7 @@ props.put("withdrawLinkCallback", withdrawLinkCallback)
no-payment-hash
-
+
javascript
@@ -2121,7 +2139,7 @@ vars.put("receiveInkey", receiveInkey)
-
+
groovy
@@ -2135,41 +2153,9 @@ vars.put("receiveInkey", receiveInkey)
javascript
-
+ ${configPath}/scripts/lnurlw_check_executed_withdraws.js
true
- var resp = JSON.parse(prev.getResponseDataAsString());
-
-var parallelWithdrawUsers = +vars.get("parallelWithdrawUsers");
-var maxWithdrawsPerLink = +vars.get("maxWithdrawsPerLink");
-
-if (resp.length !== parallelWithdrawUsers) {
- AssertionResult.setFailureMessage(
- "Expected " +
- parallelWithdrawUsers +
- " parallel withdraw attempts, but got " +
- resp.length
- );
- AssertionResult.setFailure(true);
-} else {
- var withdrawOkCount = 0;
-
- for (var i = 0; i < resp.length; i++) {
- if (resp[i].pending === false) {
- withdrawOkCount++;
- }
- }
-
- if (withdrawOkCount !== maxWithdrawsPerLink) {
- AssertionResult.setFailureMessage(
- "Expected " +
- maxWithdrawsPerLink +
- " successfull wihdraws, but got " +
- withdrawOkCount
- );
- AssertionResult.setFailure(true);
- }
-}
-
+
diff --git a/integration/006_watchonly-satspay-tipjar.jmx b/integration/006_watchonly-satspay-tipjar.jmx
index 47aa8b8b..736e4f5b 100644
--- a/integration/006_watchonly-satspay-tipjar.jmx
+++ b/integration/006_watchonly-satspay-tipjar.jmx
@@ -58,6 +58,11 @@
${__property(mirrorPort,,8500)}
=
+
+ configPath
+ ${__BeanShell(import org.apache.jmeter.services.FileServer; FileServer.getFileServer().getBaseDir();)}
+ =
+
@@ -482,46 +487,75 @@
8
-
- groovy
-
-
- true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-if (!resp.id) {
- AssertionResult.setFailureMessage("Onchain account not created");
- AssertionResult.setFailure(true)
-}
-
-delete resp.id
-
-var expectedAccount = [{
- "masterpub": "zpub6roF3uF1YsrxvSK9cC7kpT7xt45i6aZffVg5SHWkqcEMTpA2fnB9eF45wgM7EXAmFDazxyWGsDbwCMUTiteYFhBJNLrgpkBjVet9S98UXor",
- "fingerprint": "8eb84369",
- "title": "segwit",
- "address_no": 79,
- "balance": 0,
- "type": "p2wpkh",
- "network": "Mainnet",
- "meta": "{\"accountPath\":\"m/84'/0'/0'\"}"
-}]
-
-if (JSON.stringify(resp) !== JSON.stringify(expectedAccount)) {
- AssertionResult.setFailureMessage("Expected account incorrect: " + JSON.stringify(expectedAccount));
- AssertionResult.setFailure(true)
-}
-
+
+ onchainAccountId
+ id
+
+ no-onchain-account-id
+
-
- javascript
-
-
- true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-vars.put("onchainAccountId", resp.id || 'no-onchain-account-id');
-
+
+ fingerprint
+ e78afd66
+ true
+ false
+ false
+ false
+
+
+
+ masterpub
+ zpub6rsRjqj6BTbD9DjqrY4p14tUx5kdA8ZGCTJD99wZTxD5wfvCkyXKrK3s7M3B1eFN6NbRhmbDDRDC8LF3Bn5gmxxN9rF8mDpZsGC6isGrK1g
+ true
+ false
+ false
+ false
+
+
+
+ title
+ segwit
+ true
+ false
+ false
+ false
+
+
+
+ balance
+ 0
+ true
+ false
+ false
+ false
+
+
+
+ address_no
+ -1
+ true
+ false
+ false
+ false
+
+
+
+ type
+ p2wpkh
+ true
+ false
+ false
+ false
+
+
+
+ network
+ Mainnet
+ true
+ false
+ false
+ false
+
@@ -580,25 +614,6 @@ vars.put("onchainAccountId", resp.id || 'no-onchain-account-id&ap
-
- javascript
-
-
- true
- var accounts = JSON.parse(prev.getResponseDataAsString())
-
-if (accounts.length === 0) {
- AssertionResult.setFailureMessage("No onchain account found");
- AssertionResult.setFailure(true)
-}
-
-var accountId = vars.get("onchainAccountId")
-if (accountId !== accounts[0].id) {
- AssertionResult.setFailureMessage("Incorrect account id: "+accountId + " / "+accounts[0].id);
- AssertionResult.setFailure(true)
-}
-
-
200
@@ -609,6 +624,69 @@ if (accountId !== accounts[0].id) {
8
+
+ $[0].fingerprint
+ e78afd66
+ true
+ false
+ false
+ false
+
+
+
+ $[0].masterpub
+ zpub6rsRjqj6BTbD9DjqrY4p14tUx5kdA8ZGCTJD99wZTxD5wfvCkyXKrK3s7M3B1eFN6NbRhmbDDRDC8LF3Bn5gmxxN9rF8mDpZsGC6isGrK1g
+ true
+ false
+ false
+ false
+
+
+
+ $[0].title
+ segwit
+ true
+ false
+ false
+ false
+
+
+
+ $[0].balance
+ 0
+ true
+ false
+ false
+ false
+
+
+
+ $[0].address_no
+ -1
+ true
+ false
+ false
+ false
+
+
+
+ $[0].type
+ p2wpkh
+ true
+ false
+ false
+ false
+
+
+
+ $[0].network
+ Mainnet
+ true
+ false
+ false
+ false
+
+
@@ -730,20 +808,6 @@ if (addresses.length !== 25) {
-
- javascript
-
-
- true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var expectedAddress = 'bc1qtmfyj6s76xhrsgd4aw6qq9tc9d48vnd0690k5w'
-if (resp.address !== expectedAddress) {
- AssertionResult.setFailureMessage("Expected addresses '"+expectedAddress+"', got " + resp.address );
- AssertionResult.setFailure(true)
-}
-
-
200
@@ -754,6 +818,15 @@ if (resp.address !== expectedAddress) {
8
+
+ address
+ bc1qtmfyj6s76xhrsgd4aw6qq9tc9d48vnd0690k5w
+ true
+ false
+ false
+ false
+
+
@@ -1048,16 +1121,6 @@ if (resp.address !== expectedAddress) {
8
-
- javascript
-
-
- true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-vars.put("chargeId", resp.id || 'no-charge-id');
-
-
200
@@ -1068,6 +1131,12 @@ vars.put("chargeId", resp.id || 'no-charge-id');8
+
+ chargeId
+ id
+
+
+
@@ -1351,19 +1420,6 @@ vars.put("chargeId", resp.id || 'no-charge-id');
-
- javascript
-
-
- true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-vars.put("lightningChargeId", resp.id || 'no-lightning-charge-id');
-vars.put("paymentRequest", resp.payment_request || 'no-lpayment-request');
-
-
-
-
200
@@ -1374,6 +1430,18 @@ vars.put("paymentRequest", resp.payment_request || 'no-lpayment-r
8
+
+ lightningChargeId
+ id
+
+
+
+
+ paymentRequest
+ payment_request
+
+
+
@@ -1484,35 +1552,23 @@ vars.put("paymentRequest", resp.payment_request || 'no-lpayment-r
8
-
- javascript
-
-
- true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-if (resp.balance !== 0) {
- AssertionResult.setFailureMessage("Expected balance to be zero, got " + resp.amount);
- AssertionResult.setFailure(true)
-}
-
-if (resp.paid) {
- AssertionResult.setFailureMessage("Expected charge to not be paid");
- AssertionResult.setFailure(true)
-}
-
+
+ paid
+ false
+ true
+ false
+ false
+ false
+
-
-
- 1
- 0
- ${thinkTime}
-
-
-
- 1000
- 100
-
+
+ balance
+ 0
+ true
+ false
+ false
+ false
+
@@ -1639,24 +1695,23 @@ if (resp.paid) {
8
-
- javascript
-
-
- true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var amount = +vars.get('amountGenerator')
-if (resp.balance !== amount) {
- AssertionResult.setFailureMessage("Expected balance to be "+amount+", got " + resp.amount);
- AssertionResult.setFailure(true)
-}
-
-if (!resp.paid) {
- AssertionResult.setFailureMessage("Expected charge to be paid");
- AssertionResult.setFailure(true)
-}
-
+
+ paid
+ true
+ true
+ false
+ false
+ false
+
+
+
+ balance
+ ${amountGenerator}
+ true
+ false
+ false
+ false
+
@@ -1716,44 +1771,9 @@ if (!resp.paid) {
javascript
-
+ ${configPath}/scripts/satspay_check_charge_webhook_call.js
true
- var payment = JSON.parse(prev.getResponseDataAsString())
-
-if (!payment.paid || !payment.lnbitswallet || !payment.webhook){
- AssertionResult.setFailureMessage("Charge not correctly updated after paiment: "+ payment.id);
- AssertionResult.setFailure(true)
-}
-
-var extra = JSON.parse(payment.extra)
-if (!extra.webhook_response) {
- AssertionResult.setFailureMessage("Webhook response missing for payment: "+ payment.id);
- AssertionResult.setFailure(true)
-}
-
-var separatorIndex = extra.webhook_response.indexOf("\r\n\r\n")
-if (separatorIndex == -1) {
- AssertionResult.setFailureMessage("Webhook response has wrong format"+ extra.webhook_response);
- AssertionResult.setFailure(true)
-}
-var headers = extra.webhook_response.substring(0, separatorIndex)
-var bodyStr = extra.webhook_response.substring(separatorIndex)
-
-var body = JSON.parse(bodyStr)
-
-
-if (vars.get("lightningChargeId") !== body.id) {
- AssertionResult.setFailureMessage("Wrong webhook charge id. Expected: "+ vars.get("lightningChargeId") + ", but got "+ body.id);
- AssertionResult.setFailure(true)
-}
-
-if (vars.get("paymentRequest") !== body.payment_request) {
- AssertionResult.setFailureMessage("Wrong webhook charge payment request. Expected: "+ vars.get("paymentRequest") + ", but got "+ body.payment_request);
- AssertionResult.setFailure(true)
-}
-
-
-
+
@@ -1826,18 +1846,9 @@ if (vars.get("paymentRequest") !== body.payment_request) {
javascript
-
+ ${configPath}/scripts/satspay_check_charges_count.js
true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var paidChargeCount = +vars.get('paidChargeCount')
-
-var totalChargeCount = paidChargeCount + 2; // one onchain and one to expire
-if (resp.length !== totalChargeCount) {
- AssertionResult.setFailureMessage("Expected charges count to be "+totalChargeCount+", got " + resp.length);
- AssertionResult.setFailure(true)
-}
-
+
@@ -1901,24 +1912,9 @@ if (resp.length !== totalChargeCount) {
true
-
+ ${configPath}/scripts/satspay_check_wallet_balance.js
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var paidChargeCount = +vars.get('paidChargeCount')
-var balance = 0
-var startAmount = 10
-for (var i=0; i< paidChargeCount; i++) {
- balance += startAmount + i
-}
-
-// millisats
-if (resp.balance !== balance * 1000) {
- AssertionResult.setFailureMessage("Expected balance to be "+balance+", but got: "+ resp.balance);
- AssertionResult.setFailure(true)
-}
-
-vars.put("userBalance", resp.balance)
+
javascript
@@ -1983,31 +1979,9 @@ vars.put("userBalance", resp.balance)
true
-
+ ${configPath}/scripts/satspay_check_payments_status.js
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var paidChargeCount = +vars.get('paidChargeCount')
-// one payment is the expired one
-var totalPaymentsCount = paidChargeCount + 1
-
-if (resp.length != totalPaymentsCount) {
- AssertionResult.setFailureMessage("Expected total "+totalPaymentsCount+" paymet, but got: "+ resp.length);
- AssertionResult.setFailure(true)
-}
-
-var pendingCount = 0
-
-for (var i=0; i<resp.length; i++) {
- var payment = resp[i]
- if (payment.pending) pendingCount++
-}
-
-if (pendingCount !== 1) {
- AssertionResult.setFailureMessage("Expected one pending paymet, but got: "+ pendingCount);
- AssertionResult.setFailure(true)
-}
-
+
javascript
@@ -2289,29 +2263,21 @@ if (pendingCount !== 1) {
8
-
- javascript
-
-
- true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-vars.put("tipjarId", resp.id || 'no-tipjar-id');
-
+
+ name
+ Nakamoto
+ true
+ false
+ false
+ false
+
-
- javascript
-
-
- true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-if (resp.name !== "Nakamoto") {
- AssertionResult.setFailureMessage("Expected tipjar name to be 'Nakamoto', got " + resp.name);
- AssertionResult.setFailure(true)
-}
-
-
+
+ tipjarId
+ id
+
+ no-tipjar-id
+
@@ -2460,35 +2426,23 @@ if (resp.name !== "Nakamoto") {
8
-
- javascript
-
-
- true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-if (!resp.redirect_url || !resp.redirect_url.startsWith("/satspay/")) {
- AssertionResult.setFailureMessage("Expected redirect url to start with '/satspay/', but was: " + resp.redirect_url);
- AssertionResult.setFailure(true)
-}
-
-
-
javascript
-
+ ${configPath}/scripts/tipjar_extract_charge_url_for_tip.js
true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-vars.put("tipChargeUrl", resp.redirect_url || 'no-tip-charge-url');
-
-if (resp.redirect_url) {
- var tipChargeId = resp.redirect_url.split("/")[2]
- vars.put("tipChargeId", tipChargeId || 'no-tip-charge-id');
-}
+
+
+ redirect_url
+ /satspay/.*$
+ true
+ false
+ false
+ true
+
+
@@ -2610,36 +2564,17 @@ if (resp.redirect_url) {
javascript
-
+ ${configPath}/scripts/satspay_check_charge_details.js
true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var tipCounter = +vars.get("tipCounter")
-var name = "Hal"
-var description = "Let's go ..." + tipCounter + "!"
-
-if (resp.description !== description) {
- AssertionResult.setFailureMessage("Expected name to be 'Hal', but was: " + resp.name);
- AssertionResult.setFailure(true)
-}
-
-if (resp.description !== description) {
- AssertionResult.setFailureMessage("Expected description to be 'Let's go!', but was: " + resp.description);
- AssertionResult.setFailure(true)
-}
-
+
-
- javascript
-
-
- true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-vars.put("tipPaymentRequest", resp.payment_request || 'no-tip-payment-request');
-
-
+
+ tipPaymentRequest
+ payment_request
+
+ no-tip-payment-request
+
@@ -2699,38 +2634,12 @@ vars.put("tipPaymentRequest", resp.payment_request || 'no-tip-pay
javascript
-
+ ${configPath}/scripts/tipjar_check_tips_for_user.js
true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var tipCounter = +vars.get("tipCounter")
-
-if (resp.length !== tipCounter) {
- AssertionResult.setFailureMessage("Expected "+tipCounter+" tips, but got: " + resp.length);
- AssertionResult.setFailure(true)
-} else {
- var tip = resp[tipCounter - 1]
- var message = "Let's go ..." + tipCounter + "!"
- if (!tip || tip.name !== "Hal" || tip.message !== message || tip.sats !== 21) {
- AssertionResult.setFailureMessage("Expected tip to '" + message + "', but was: " + JSON.stringify(resp));
- AssertionResult.setFailure(true)
- }
-}
+
-
- 1
- 0
- ${thinkTime}
-
-
-
- 1000
- 100
-
-
-
true
@@ -2861,22 +2770,9 @@ if (resp.length !== tipCounter) {
true
-
+ ${configPath}/scripts/tipjar_check_user_balance.js
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var tipCounter = +vars.get('tipCounter')
-var userBalance = +vars.get("userBalance")
-
-userBalance += 21 * 1000
-
-// millisats
-if (resp.balance !== userBalance) {
- AssertionResult.setFailureMessage("Expected balance to be "+userBalance+", but got: "+ resp.balance);
- AssertionResult.setFailure(true)
-}
-
-vars.put("userBalance", userBalance)
+
javascript
diff --git a/integration/007_lndhub.jmx b/integration/007_lndhub.jmx
index 70356c25..4dd375b7 100644
--- a/integration/007_lndhub.jmx
+++ b/integration/007_lndhub.jmx
@@ -38,6 +38,11 @@
3
=
+
+ configPath
+ ${__BeanShell(import org.apache.jmeter.services.FileServer; FileServer.getFileServer().getBaseDir();)}
+ =
+
@@ -774,18 +779,9 @@
javascript
-
+ ${configPath}/scripts/lndhub_check_balance.js
true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-
-var count = +vars.get("defaultPaymentCount")
-var paymentDelta = 20
-
-if (resp.BTC.AvailableBalance !== paymentDelta * count) {
- AssertionResult.setFailureMessage("Expected balance "+paymentDelta * count+" but got: " + resp.BTC.AvailableBalance);
- AssertionResult.setFailure(true)
-}
+
@@ -842,34 +838,9 @@ if (resp.BTC.AvailableBalance !== paymentDelta * count) {
javascript
-
+ ${configPath}/scripts/lndhub_check_transactions.js
true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-
-var count = +vars.get("defaultPaymentCount")
-
-if (resp.length !== count) {
- AssertionResult.setFailureMessage("Expected "+ count+" transactions but got: " + resp.length);
- AssertionResult.setFailure(true)
-} else {
- for (var i=0;i<count;i++){
- if (resp[i].value !== -1) {
- AssertionResult.setFailureMessage(i + ". Expected value -1 but got: " + resp[i].value);
- AssertionResult.setFailure(true)
-
- break
- }
-
- if (!resp[i].memo.startsWith("admin invoice ")) {
- AssertionResult.setFailureMessage(i + ". Expected memo 'admin invoice X' but got: " + resp[i].memo);
- AssertionResult.setFailure(true)
-
- break
- }
- }
-
-}
+
@@ -922,34 +893,9 @@ if (resp.length !== count) {
javascript
-
+ ${configPath}/scripts/lndhub_check_payments.js
true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-
-var count = +vars.get("defaultPaymentCount")
-
-if (resp.length !== count) {
- AssertionResult.setFailureMessage("Expected "+ count+" transactions but got: " + resp.length);
- AssertionResult.setFailure(true)
-} else {
- for (var i=0;i<count;i++){
- if (resp[i].amt !== 21) {
- AssertionResult.setFailureMessage(i + ". Expected value 21 but got: " + resp[i].amt);
- AssertionResult.setFailure(true)
-
- break
- }
- var description = "user invoice "
- if (!resp[i].description.startsWith(description)) {
- AssertionResult.setFailureMessage(i + ". Expected memo '"+description+"' but got: " + resp[i].description);
- AssertionResult.setFailure(true)
-
- break
- }
- }
-
-}
+
@@ -1150,17 +1096,9 @@ if (resp.length !== count) {
javascript
-
+ ${configPath}/scripts/lndhub_check_payments_after_payment.js
true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-var mobilePaymentCount = 1
-var count = +vars.get("defaultPaymentCount") + mobilePaymentCount
-
-if (resp.length !== count) {
- AssertionResult.setFailureMessage("Expected "+ count+" transactions but got: " + resp.length);
- AssertionResult.setFailure(true)
-}
+
@@ -1365,19 +1303,9 @@ if (resp.length !== count) {
javascript
-
+ ${configPath}/scripts/lndhub_check_transactions_after_payment.js
true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-
-var mobilePaymentCount = 1
-var count = +vars.get("defaultPaymentCount") + mobilePaymentCount
-
-
-if (resp.length !== count) {
- AssertionResult.setFailureMessage("Expected "+ count + " transactions but got: " + resp.length);
- AssertionResult.setFailure(true)
-}
+
@@ -1439,19 +1367,9 @@ if (resp.length !== count) {
javascript
-
+ ${configPath}/scripts/lndhub_check_balance_after_payments.js
true
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-
-var count = +vars.get("defaultPaymentCount")
-var paymentDelta = 20
-var mobilePaymentDelta = 20
-
-if (resp.BTC.AvailableBalance !== paymentDelta * count + mobilePaymentDelta) {
- AssertionResult.setFailureMessage("Expected balance "+paymentDelta * count+" but got: " + resp.BTC.AvailableBalance);
- AssertionResult.setFailure(true)
-}
+
diff --git a/integration/fragments/init-account.jmx b/integration/fragments/init-account.jmx
index d7ea3af1..4897b9c5 100644
--- a/integration/fragments/init-account.jmx
+++ b/integration/fragments/init-account.jmx
@@ -129,19 +129,31 @@
8
-
- true
-
-
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-vars.put("userId", resp.user || "no-user-id");
-vars.put("walletId", resp.id || "no-wallet-id");
-vars.put("inkey", resp.inkey || 'no-inkey');
-vars.put("adminkey", resp.adminkey || 'no-adminkey');
-
- javascript
-
+
+ userId
+ user
+
+
+
+
+ walletId
+ id
+
+
+
+
+ inkey
+ inkey
+
+ no-inkey
+
+
+
+ adminkey
+ adminkey
+
+ no-adminkey
+
@@ -408,19 +420,14 @@ vars.put("adminkey", resp.adminkey || 'no-adminkey');
8
-
- true
-
-
- var resp = JSON.parse(prev.getResponseDataAsString())
-
-if (resp.balance !== 0) {
- AssertionResult.setFailureMessage("Balance is not zero, but: "+ resp.balance);
- AssertionResult.setFailure(true)
-}
-
- javascript
-
+
+ balance
+ 0
+ true
+ false
+ false
+ false
+
diff --git a/integration/fragments/init-server.jmx b/integration/fragments/init-server.jmx
index 60cb00c4..e5fc6099 100644
--- a/integration/fragments/init-server.jmx
+++ b/integration/fragments/init-server.jmx
@@ -335,17 +335,19 @@
8
-
- true
-
-
- var resp = JSON.parse(prev.getResponseDataAsString())[0]
-
-vars.put("adminWalletId", resp.id || "no-admin-wallet-id");
-vars.put("adminWalletKey", resp.adminkey || 'no-adminkey');
-
- javascript
-
+
+ adminWalletId
+ $[0].id
+
+ no-admin-wallet-id
+
+
+
+ adminWalletKey
+ $[0].adminkey
+
+ no-admin-wallet-key
+
diff --git a/integration/scripts/check_admin_extension_status_code.js b/integration/scripts/check_admin_extension_status_code.js
new file mode 100644
index 00000000..fcafb0e9
--- /dev/null
+++ b/integration/scripts/check_admin_extension_status_code.js
@@ -0,0 +1,18 @@
+var responseCode = +prev.getResponseCode()
+var isAdminExtension = vars.get("isAdminExtension")
+
+
+if (isAdminExtension === 'true') {
+ if (responseCode !== 200 && responseCode !== 401) {
+ AssertionResult.setFailureMessage(
+ "Expected response code 200 for 401 for admin extension but got: " +
+ responseCode
+ );
+ AssertionResult.setFailure(true);
+ }
+} else if (responseCode !== 200) {
+ AssertionResult.setFailureMessage(
+ "Expected response code 200 but got: " + responseCode
+ );
+ AssertionResult.setFailure(true);
+}
diff --git a/integration/scripts/extract_extension_data.js b/integration/scripts/extract_extension_data.js
new file mode 100644
index 00000000..4d067887
--- /dev/null
+++ b/integration/scripts/extract_extension_data.js
@@ -0,0 +1,11 @@
+var extensions = vars.get("extensions")
+var adminExtensions = vars.get("adminExtensions")
+var extensionIndex = vars.get("extensionIndex")
+var extesion = extensions.split(",")[extensionIndex - 1]
+var isAdminExtension = adminExtensions.split(",").indexOf(extesion) !== -1
+
+vars.put("extension", extesion)
+vars.put("isAdminExtension", isAdminExtension)
+
+var responseCode = prev.getResponseCode()
+vars.put("responseCode", responseCode)
\ No newline at end of file
diff --git a/integration/scripts/extract_extensions_ids.js b/integration/scripts/extract_extensions_ids.js
new file mode 100644
index 00000000..062d643c
--- /dev/null
+++ b/integration/scripts/extract_extensions_ids.js
@@ -0,0 +1,22 @@
+var resp = JSON.parse(prev.getResponseDataAsString());
+var excludedExtensions = (vars.get("excludedExtensions") || "").split(",");
+
+var extensions = {};
+
+for (var i = 0; i < resp.extensions.length; i++) {
+ var ext = resp.extensions[i];
+ if (excludedExtensions.indexOf(ext.id) === -1) {
+ extensions[ext.id] = true;
+ }
+}
+
+
+
+extensionList = Object.keys(extensions);
+//extensionList[1] = 'nostrmarket'
+//extensionList.length = 3
+vars.put("extensions", extensionList);
+
+
+
+vars.put("extensionsLength", extensionList.length);
diff --git a/integration/scripts/extract_latest_extension_release.js b/integration/scripts/extract_latest_extension_release.js
new file mode 100644
index 00000000..e7097adf
--- /dev/null
+++ b/integration/scripts/extract_latest_extension_release.js
@@ -0,0 +1,9 @@
+var resp = JSON.parse(prev.getResponseDataAsString())
+var latestRelease = resp[resp.length - 1]
+
+var ext_id = vars.get("extension")
+
+vars.put("ext_id", ext_id)
+vars.put("archive", latestRelease.archive)
+vars.put("source_repo", latestRelease.source_repo)
+vars.put("version", latestRelease.version)
diff --git a/integration/scripts/lndhub_check_balance.js b/integration/scripts/lndhub_check_balance.js
new file mode 100644
index 00000000..b3b4d86b
--- /dev/null
+++ b/integration/scripts/lndhub_check_balance.js
@@ -0,0 +1,10 @@
+var resp = JSON.parse(prev.getResponseDataAsString())
+
+
+var count = +vars.get("defaultPaymentCount")
+var paymentDelta = 20
+
+if (resp.BTC.AvailableBalance !== paymentDelta * count) {
+ AssertionResult.setFailureMessage("Expected balance "+paymentDelta * count+" but got: " + resp.BTC.AvailableBalance);
+ AssertionResult.setFailure(true)
+}
\ No newline at end of file
diff --git a/integration/scripts/lndhub_check_balance_after_payments.js b/integration/scripts/lndhub_check_balance_after_payments.js
new file mode 100644
index 00000000..0f24f52c
--- /dev/null
+++ b/integration/scripts/lndhub_check_balance_after_payments.js
@@ -0,0 +1,11 @@
+var resp = JSON.parse(prev.getResponseDataAsString())
+
+
+var count = +vars.get("defaultPaymentCount")
+var paymentDelta = 20
+var mobilePaymentDelta = 20
+
+if (resp.BTC.AvailableBalance !== paymentDelta * count + mobilePaymentDelta) {
+ AssertionResult.setFailureMessage("Expected balance "+paymentDelta * count+" but got: " + resp.BTC.AvailableBalance);
+ AssertionResult.setFailure(true)
+}
\ No newline at end of file
diff --git a/integration/scripts/lndhub_check_payments.js b/integration/scripts/lndhub_check_payments.js
new file mode 100644
index 00000000..2a4f6aae
--- /dev/null
+++ b/integration/scripts/lndhub_check_payments.js
@@ -0,0 +1,26 @@
+var resp = JSON.parse(prev.getResponseDataAsString())
+
+
+var count = +vars.get("defaultPaymentCount")
+
+if (resp.length !== count) {
+ AssertionResult.setFailureMessage("Expected "+ count+" transactions but got: " + resp.length);
+ AssertionResult.setFailure(true)
+} else {
+ for (var i=0;i