Socket
Socket
Sign inDemoInstall

@viewstools/e2e

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@viewstools/e2e - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

26

index.js

@@ -1,9 +0,25 @@

const key = process.env.VIEWS_E2E_TEST_ID || "data-test-id";
const key = process.env.VIEWS_E2E_TEST_ID || 'data-test-id';
const get = (id, ...scopes) => () => {
const el = browser.element(`[${key}*="${id}|"]`);
const getElBySelector = ($in, selector, index, all) => {
let el;
if (typeof index === 'number') {
// get item from list by index
el = $in.elements(selector).value[index];
} else if (all) {
// get all items from list
el = $in.elements(selector).value;
} else {
el = $in.element(selector);
}
return el;
};
const get = (id, ...scopes) => ({ all = false, $in = browser, index } = {}) => {
const idSelector = `[${key}*="${id}|"]`;
let el = getElBySelector($in, idSelector, index, all);
scopes.forEach(scope => {
el[scope] = () =>
browser.element(`[${key}*="${id}|"][${key}*="${scope}|"]`);
getElBySelector($in, `${idSelector}[${key}*="${scope}|"`, index, all);
});

@@ -15,3 +31,3 @@

module.exports = {
get
get,
};

@@ -1,3 +0,17 @@

var key = process.env.VIEWS_E2E_TEST_ID || "data-test-id";
var key = process.env.VIEWS_E2E_TEST_ID || 'data-test-id';
var getElBySelector = function ($in, selector, index, all) {
var el;
if (typeof index === 'number') {
// get item from list by index
el = $in.elements(selector).value[index];
} else if (all) {
// get all items from list
el = $in.elements(selector).value;
} else {
el = $in.element(selector);
}
return el;
};
var get = function (id) {

@@ -7,7 +21,14 @@ var scopes = [], len = arguments.length - 1;

return function () {
var el = browser.element(("[" + key + "*=\"" + id + "|\"]"));
return function (ref) {
if ( ref === void 0 ) ref = {};
var all = ref.all; if ( all === void 0 ) all = false;
var $in = ref.$in; if ( $in === void 0 ) $in = browser;
var index = ref.index;
var idSelector = "[" + key + "*=\"" + id + "|\"]";
var el = getElBySelector($in, idSelector, index, all);
scopes.forEach(function (scope) {
el[scope] = function () { return browser.element(("[" + key + "*=\"" + id + "|\"][" + key + "*=\"" + scope + "|\"]")); };
el[scope] = function () { return getElBySelector($in, (idSelector + "[" + key + "*=\"" + scope + "|\""), index, all); };
});

@@ -20,4 +41,4 @@

module.exports = {
get: get
get: get,
};

2

package.json
{
"name": "@viewstools/e2e",
"version": "0.1.2",
"version": "0.1.3",
"description": "Views Tools E2E helpers",

@@ -5,0 +5,0 @@ "main": "lib.js",

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