Enables you to install and use npm packages as part of your test scripts.
npm is a package manager for JavaScript that makes it easy to share and reuse code. With npm support in testRTC, you can now leverage the ecosystem of packages and modules provided by the Node.js community.
rtcRequire() can be used by applications to use third party packages and enhance the capabilities of their scripts. This script command receives a package name and a function as an input. The function will operate in the context of the package.
Arguments
Name | Type | Description |
---|---|---|
name | string | The name of the package. This can also include a version number using the format <name>@<version>. |
npmFunct | function(object) | The npm package can be used inside this function. Outside of it, it won’t exist. |
Code Example
//This will send HTTP POST to the to save some data
.rtcActivateWebhook(restURL, { value: sampleValue }, function(answer) {
client.rtcInfo('rtcActivateWebhook Post answer ' + answer);
})
//This will send HTTP Get to the same url to retrive the just posted data
.rtcActivateWebhook(restURL, function(answer) {
client.rtcInfo('rtcActivateWebhook Get answer' + answer);
})
HTTP Headers
var webHookOptions = {
url: 'https://[url]',
headers: {
'X-HTTP-Method-Override': 'PATCH',
'Cache-Control': 'no-cache',
'Content-Type': 'text/xml'
}
};
client.rtcActivateWebhook(webHookOptions, {value: 100}, function(answer) {
. . .
})