Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View obiee_phantomcss.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
// @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.