Skip to content

A node.js client to connect to the web application Spectre

Notifications You must be signed in to change notification settings

HenningThiemann/nodeclient-spectre

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node client for Spectre

A node.js client to connect to the web application Spectre.

Installation

Install via npm as usual

$ npm install nodeclient-spectre --save

Usage Example

const fs = require('fs');
const path = require('path');

const SpectreClient = require('nodeclient-spectre');

const spectreUrl = 'http://localhost:3000';

// read binary data
const bitmap1 = fs.readFileSync(path.join(__dirname, 'img/img1.png'));
// convert binary data to base64 encoded string
const screenshot1Base64 = new Buffer(bitmap1).toString('base64');

// read binary data
const bitmap2 = fs.readFileSync(path.join(__dirname, 'img/img2.png'));
// convert binary data to base64 encoded string
const screenshot2Base64 = new Buffer(bitmap2).toString('base64');

const spectreClientInstance = new SpectreClient(spectreUrl);

Promise
    .resolve()
    .then(() => {
        return spectreClientInstance.createTestrun("Projekt", "Suite");
    })
    .then((result) => {
        return spectreClientInstance.submitScreenshot("Testimage", "Testbrowser", 480, screenshot1Base64, result.id)
    })
    .then(() => {
        return spectreClientInstance.createTestrun("Projekt", "Suite");
    })
    .then((result) => {
        return spectreClientInstance.submitScreenshot("Testimage", "Testbrowser", 480, screenshot2Base64, result.id)
    });

About

A node.js client to connect to the web application Spectre

Resources

Stars

Watchers

Forks

Packages

No packages published