npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sparklybot

v1.0.3

Published

Automation framework for the Spark UI Browser

Downloads

20

Readme

:sparkles: SparklyBot :sparkles:

An automation framework for testing Spark UI Applications.

Installation

Sparklybot is a set of tools which can be used together with any test framework of your choice (Jest, Ava, Mocha etc.)

Installation is simple:

npm install sparklybot --save-dev

Documentation (Jest examples)

Below is an example of testing an helloworld app with jest

helloworld.js:

px.import('px:scene.1.js').then(scene => {
  scene.create({
    t: 'text',
    id: 'my-test-id',
    parent: scene.root,
    text: 'Hello World!',
    textColor: 'green',
    pixelSize: 40,
  })
  scene.on('onClose', () => console.log('Hello got OnClose'))
})

helloworld.test.js:

import path from 'path'
import {
  initializeSparkTestBrowser,
  refreshSparkBrowser,
  findElementWithPropertyValue,
  stopServerAndBrowser,
} from 'sparklybot'

beforeEach(async done => {
  await initializeSparkTestBrowser()
  done()
})

afterEach(async done => {
  await stopServerAndBrowser()
  done()
})

test('Should be able to assert on element', async done => {
  await refreshSparkBrowser(
    path.resolve(__dirname, './helloWorld.js'),
  )
  const element = await findElementWithPropertyValue('text', 'Hello World!')
  expect(element).toBeTruthy()
  expect(element.id).toBe('my-test-id')
  done()
})

It's also possible to test Spark applications served from a webpage, either remote or local:

import {
  initializeSparkTestBrowser,
  refreshSparkBrowser,
  findElementWithPropertyValue,
  stopServerAndBrowser,
} from 'sparklybot'

beforeEach(async done => {
  await initializeSparkTestBrowser()
  done()
})

afterEach(async done => {
  await stopServerAndBrowser()
  done()
})

test('Wait for specific image to be displayed', async done => {
  await refreshSparkBrowser(
    'https://www.sparkui.org/examples/polaroid/pp_polaroid.js',
  )
  // Wait for specific element to be rendered in browser
  const element = await findElementWithPropertyValue(
    'text',
    "A '99' Ice Cream - Dingle, Ireland",
    20000, // Set custom maxTimeout
  )
  expect(element).toBeTruthy()
  done()
})

Test automation on CI

There's an experimental docker image ready for CI testing on dockerhub: docker pull renegus/spark

An example of how to use it can be found in here: CircleCI config

Remember when running tests on CI you need to specify environment variable PXSCENE_PATH

More examples

Please refer to tests found in folder: Test examples

API documentation

Comming soon!