Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
// @rmoff
// May 21, 2014
//
// Visual Regression Testing for OBIEE using PhantomCSS/CasperJS
//
// No kind of error or exception handling, no checks for successful login, etc
// Use at your own risk!
//-----------------------------------------------------------------------------
var phantomcss = require('./phantomcss.js');
phantomcss.init({
screenshotRoot: './phantomcss_screenshots',
failedComparisonsRoot: './phantomcss_failures',
libraryRoot: './../phantomcss',
addLabelToFailedImage: false
});
// Setting the UA to iPad/iPhone forces Presentation Services to render charts in PNG instead of flash (which we can't work with in phantomJS)
casper.userAgent('Mozilla/5.0 (iPad; CPU OS 4_3_5 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8L1 Safari/6533.18.5 CasperJS')
casper.start('http://obiee-server:9704/analytics').then(function() {
this.echo('Logging into OBIEE','INFO')
casper.viewport(1400, 900,function() {
phantomcss.screenshot('html','Login page');
});
});
casper.then(function(){
this.fill('form#logonForm', { NQUser: 'weblogic' ,
NQPassword: 'Password01'
}, true);
}).
waitForUrl('http://obiee-server:9704/analytics/saw.dll?bieehome',function(){
this.echo('Logged into OBIEE','INFO')
});
casper.then(function() {
this.echo('Clicking Dashboard menu','INFO')
casper.click('#dashboard');
this.waitUntilVisible('div.HeaderPopupWindow', function() {
// We only want to snapshot the list itself; the rest of the home page has lots of
// other changes (recent docs) that confuse matters.
// Snapshot is restricted down to "HeaderSharedProtals" [sic] so as to ignore the
// Most Recent on the Dashboads list. However, the changing width that a different
// length recent dashboard name screws this approach up too.
phantomcss.screenshot('div.HeaderSharedProtals','Dashboard list');
});
});
casper.then(function(){
this.echo('Navigating to GCBC Dashboard','INFO')
casper.clickLabel('GCBC Dashboard');
})
casper.waitForUrl('http://obiee-server:9704/analytics/saw.dll?dashboard', function() {
casper.waitWhileVisible('div.AjaxLoadingOpacity', function() {
casper.waitWhileVisible('div.ProgressIndicatorDiv', function() {
this.test.assertTextDoesntExist('Invalid Link Path', 'Check for error text on page');
this.test.assertTextDoesntExist('View Display Error', 'Check for error text on page');
phantomcss.screenshot('div.DashboardPageContentDiv','GCBC Dashboard page 1');
})
})
});
casper.then(function() {
this.echo('Navigating to second page','INFO')
casper.click('td[title="Performance Breakdown"]');
});
casper.waitWhileVisible('div.AjaxLoadingOpacity', function() {
casper.waitWhileVisible('div.ProgressIndicatorDiv', function() {
this.test.assertTextDoesntExist('Invalid Link Path', 'Check for error text on page');
this.test.assertTextDoesntExist('View Display Error', 'Check for error text on page');
phantomcss.screenshot('div.DashboardPageContentDiv','GCBC Dashboard page 2');
})
});
// this.echo('Navigating to third page','INFO')
// casper.click('td[title="Cost Breakdown Report"]');
// [...]
// phantomcss.screenshot('div.DashboardPageContentDiv','GCBC Dashboard page 3');
// [...]
// this.echo('Navigating to Presentation Catalog','INFO')
// casper.clickLabel('Catalog');
// waitForUrl('http://obiee-server:9704/analytics/saw.dll?catalog',function(){
// phantomcss.screenshot('html','Presentation Catalog listing');
// [...]
casper.then(function() {
this.echo('Signing out','INFO')
casper.clickLabel('Sign Out');
});
casper.then(function() {
phantomcss.screenshot('html','Logged out');
});
casper.then( function now_check_the_screenshots(){
phantomcss.compareAll();
});
casper.then( function end_it(){
casper.test.done();
});
/*
Casper runs tests
*/
casper.run(function(){
console.log('\nTHE END.');
phantom.exit(phantomcss.getExitStatus());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.