Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
@expressen/tallahassee
Advanced tools
Test your client scripts in a headless browser.
Supports just about everything.
"use strict";
const Browser = require("@expressen/tallahassee");
const Script = require("@bonniernews/wichita");
const { app } = require("../app/app.js");
describe("Tallahassee", () => {
describe("navigateTo()", () => {
it("navigates to url", async () => {
await new Browser(app).navigateTo("/");
});
it("throws if not 200", async () => {
try {
await new Browser(app).navigateTo("/404");
} catch (e) {
var err = e; // eslint-disable-line no-var
}
expect(err).to.be.ok;
});
it("unless you override status code", async () => {
const browser = await new Browser(app).navigateTo("/404", null, 404);
expect(browser.document.getElementsByTagName("h1")[0].innerText).to.equal("Apocalyptic");
});
});
describe("run script", () => {
it("run es6 script sources with @bonniernews/wichita", async () => {
const browser = await new Browser(app).navigateTo("/", { cookie: "_ga=1" });
await new Script("./app/assets/scripts/main.js").run(browser.window);
expect(browser.document.cookie).to.equal("_ga=1");
expect(browser.document.getElementsByClassName("set-by-js")).to.have.length(1);
});
it("again", async () => {
const browser = await new Browser(app).navigateTo("/");
await new Script("./app/assets/scripts/main.js").run(browser.window);
expect(browser.document.cookie).to.equal("");
expect(browser.document.getElementsByClassName("set-by-js")).to.have.length(0);
});
});
});
May we suggest you to use Wichita, the Tallahassee sidekick. It can be found here https://www.npmjs.com/package/@bonniernews/wichita
If overriding timers on window, e.g. setTimeout
it can be a good idea to make them asynchronous since they tend to be recurring.
Example:
browser.window.setTimeout = function mySetTimeout(fn, ms, ...args) {
process.nextTick(fn, ...args);
};
16.0.0
FAQs
Lightweight client testing framework
The npm package @expressen/tallahassee receives a total of 513 weekly downloads. As such, @expressen/tallahassee popularity was classified as not popular.
We found that @expressen/tallahassee demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.