galen-visual execute visual validation using Galen in Selenium
This utility will enable you to integrate Galen visual tests into your selenium-webdriver or webdriverio tests.
To easily create your Galen tests use the following chrome extension:
It support both of the common node javacript selenium packages: selenium-webdriver and webdriverio.
To integrate into your tests first you need to create a page:
To install:
npm install galen-visual
In short:
var visual = require('visual.js');
visual.init('K5pAdMqrNz7Lcz69jnB6WE8');
visual.verify(driver, 'login_page');
Full selenium example:
import {assert} from 'chai';
var webdriver = require('selenium-webdriver');
var visual = require('galen-visual');
const chrome = require('selenium-webdriver/chrome');
describe('visual tests', function(this: any) {
this.timeout(20000);
var driver: any;
before(() => {
visual.init('K5pAdMqrNz7Lcz69jnB6WE8');
});
it('#verify', async () => {
driver = await new webdriver.Builder().usingServer().withCapabilities({'browserName': 'chrome' }).build();
await driver.get("https://github.com/login");
setDebug(true);
const res = await visual.verify(driver, 'login');
assert.isTrue(res , 'all is good');
console.log(getLastResultUrl());
});
});
Note: Node 6.10 or higher runtime required.