Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

testable-utils

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

testable-utils - npm Package Compare versions

Comparing version 0.2.9 to 0.2.12

18

lib/main.js

@@ -13,2 +13,3 @@

const LocalInfo = {
expectedFinishTimestamp: -1,
iteration: 0,

@@ -98,4 +99,14 @@ client: 0,

});
}
};
const expectedFinishTimestamp = info.expectedFinishTimestamp;
const waitForFinish = function() {
return new Promise(function(resolve, reject) {
if (expectedFinishTimestamp > 0 && expectedFinishTimestamp - Date.now() > 0)
setTimeout(resolve, expectedFinishTimestamp - Date.now());
else
resolve();
});
};
const csv = isLocal ? csvLocal.initialize() : csvRemote.initialize(info, log);

@@ -115,3 +126,3 @@ const registerCommands = typeof browser !== 'undefined' && _.isUndefined(browser.testableLogInfo);

wdio.registerStopwatchCommands(browser, stopwatch);
wdio.registerEventsCommands(browser, events, doNotWait);
wdio.registerEventsCommands(browser, events, doNotWait, waitForFinish);
}

@@ -127,2 +138,3 @@

module.exports.events = events;
module.exports.dataTable = csv;
module.exports.dataTable = csv;
module.exports.waitForFinish = waitForFinish;

5

lib/wdio-commands.js

@@ -134,3 +134,3 @@ const _ = require('lodash');

function registerEventsCommands(browser, events, doNotWait) {
function registerEventsCommands(browser, events, doNotWait, waitForFinish) {
if (isWdioContext(browser)) {

@@ -162,2 +162,5 @@ browser.addCommand('testableWaitForEvent', function async(eventName, timeout, defaultVal) {

});
browser.addCommand('testableWaitForFinish', function async() {
return waitForFinish();
});
}

@@ -164,0 +167,0 @@ }

{
"name": "testable-utils",
"version": "0.2.9",
"version": "0.2.12",
"description": "Utilities for Testable scripts",

@@ -5,0 +5,0 @@ "author": "Avi Stramer",

@@ -12,3 +12,3 @@ # Testable Script Utilities

* [Manual Live Event](#manual-live-event)
* [Coordination Across Virtual Users](#coordination-across-virtual-users)
* [Wait For Finish](#wait-for-finish)
* [Webdriver.io Custom Commands](#webdriverio-commands)

@@ -316,2 +316,15 @@ * [Screenshots](#screenshots)

### Wait For Finish
Use this function to wait for the remainder of the test duration before the script finishes. Returns a Promise so that you can run some cleanup code before the script exits.
For tests configured for a set number of iterations the promise resolved immediately. Otherwise the promise will not resolve until the remaining duration has passed.
```
const testableUtils = require('testable-utils');
testableUtils.waitForFinish().then(() => {
console.log('finished!');
});
```
## Webdriver.io Commands

@@ -426,2 +439,6 @@

<tr>
<td><pre>browser.testableWaitForFinish();</pre></td>
<td><a href="#wait-for-finish"><pre>testableUtils.waitForFinish().then(() => { });</pre></a></td>
</tr>
<tr>
<td><pre>// blocks until done() is called

@@ -428,0 +445,0 @@ browser.testableStopwatch(function(done) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc