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

@communicatehealth/browsertests

Package Overview
Dependencies
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@communicatehealth/browsertests - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

5

CHANGELOG.md
# Changelog
## 1.3.0
- Support jumplink testing (via options.jumplinks)
- Better resolve tests in subdirectories
## 1.2.0

@@ -4,0 +9,0 @@

3

index.js

@@ -109,5 +109,6 @@ /**

test = require(dir + "/" + filenameBase + ".js");
} else if (fs.existsSync(__dirname + "/" + filenameBase + "/index.js")) {
} else if (fs.existsSync(dir + "/" + filenameBase + "/index.js")) {
test = require(dir + "/" + filenameBase + "/index.js");
} else {
console.error("No tests in " + filenameBase);
return;

@@ -114,0 +115,0 @@ }

{
"name": "@communicatehealth/browsertests",
"version": "1.2.0",
"version": "1.3.0",
"description": "Testing framework for testing Drupal sites using Selenium",

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

@@ -43,2 +43,7 @@ // Load a page, trying a few times if a 403 error is encountered

.then(() => {
if (options.jumplinks) {
return module.exports.checkJumpLinks(webdriver, driver, options);
}
})
.then(() => {
if (options.accessibility) {

@@ -154,2 +159,30 @@ return module.exports.checkAccessibility(webdriver, driver, options);

module.exports.checkJumpLinks = function(webdriver, driver, options) {
const By = webdriver.By;
console.log("Checking internal jump links.");
return driver.findElements(By.css('a[href^="#"]:not([href$="#"]'))
.then((jumplinks) => {
var promise = Promise.resolve();
jumplinks.forEach(jumplink => {
promise = promise.then(() => jumplink.getAttribute("href"))
.then((href) => {
var id = decodeURIComponent(href).replace(/.*#/, "");
if (id === "top") {
return;
}
return driver.findElements(By.css('*[id="' + id + '"]'))
.then((elements) => {
if (elements.length === 0) {
module.exports.logError("Missing target for jumplink #" + id);
} else if (elements.length > 1) {
module.exports.logError("Multiple targets for jumplink #" + id);
}
});
});
});
return promise;
});
}
module.exports.checkAccessibility = function(webdriver, driver, options) {

@@ -156,0 +189,0 @@ const { AxeBuilder } = require('@axe-core/webdriverjs');

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