Skip to content

Commit

Permalink
Merge pull request #182 from starmon00/victor
Browse files Browse the repository at this point in the history
front-end test cases
  • Loading branch information
JavierJia authored Aug 30, 2016
2 parents 626157a + 8fa6433 commit e3837bc
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 0 deletions.
36 changes: 36 additions & 0 deletions neo/test/resources/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Must download selenium-webdriver on Node.js Command Prompt by entering

npm install selenium-webdriver

For each browser you are testing, you will be required to download a driver and
add it to Enviornmental Variables PATH. The current browsers currently being tested
are Chrome and Firefox. Please make sure to download the latest version of the driver
and also have the browser itself installed on your computer.

Chrome:
http://chromedriver.storage.googleapis.com/index.html

Firefox:
https://github.com/mozilla/geckodriver/releases/

For more browser drivers or fully detailed instructions on setting up, visit
https://www.npmjs.com/package/selenium-webdriver

API Doc: http://seleniumhq.github.io/selenium/docs/api/javascript/index.html

***********************************************************************************************
To run test:

On Node.js Command Prompt change directory to neo\test\resources\
then run

node front-end.js

Browsers will open and test will begin. Please wait for test to be completed.

If you encounter any errors, it is most likely that you are missing a module file.
Simply return to Node.js Command Prompt and install by running

npm install (missing module)

***********************************************************************************************
72 changes: 72 additions & 0 deletions neo/test/resources/front-end.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
//Load modules
var webdriver = require('selenium-webdriver');

//Internet Browser Drivers
var chrome = new webdriver.Builder().forBrowser('chrome').build();
var firefox = new webdriver.Builder().forBrowser('firefox').build();

var drivers = [ chrome, firefox];
var names = ['Chrome', 'FireFox'];

//Execute Tests
for (i = 0; i < drivers.length; i++){
console.log('Now Testing for %s \n', names[i]);
drivers[i].get('http://cloudberry.ics.uci.edu');
Title_Assert();
Reset_Button_Assert();
console.log(' ');

}




//Test Functions
function Title_Assert() {
var title = drivers[i].getTitle().then( function(title) {
if(title != "Cloudberry")
{
console.log("************************");
console.log("Title Check......Failed ");
console.log("************************");
}
else
console.log("Title Check......Cleared");
});

}

function Reset_Button_Assert() {
var zoomLevel = drivers[i].findElement(webdriver.By.tagName('map')).getAttribute("zoom").then( function(zoomlevel){
if(zoomlevel != 4)
{
console.log("****************************************");
console.log('Reset Button ZoomLevel Check......Failed');
console.log("****************************************");
}
else
console.log('Reset Button Zoomlevel Check......Cleared');
});

var latCoordinate = drivers[i].findElement(webdriver.By.tagName('map')).getAttribute("lat").then( function(latCoordinate){
if(latCoordinate != 39.5)
{
console.log("**************************************************");
console.log('Reset Button Latitude Coordinate Check......Failed');
console.log("**************************************************");
}
else
console.log('Reset Button Latitude Coordinate Check......Cleared');
});

var lngCoordinate = drivers[i].findElement(webdriver.By.tagName('map')).getAttribute("lng").then( function(lngCoordinate){
if(lngCoordinate != -96.35)
{
console.log("**************************************************");
console.log('Reset Button Longitude Coordinate Check......Failed');
console.log("**************************************************");
}
else
console.log('Reset Button Longitude Coordinate Check......Cleared');
});
}

0 comments on commit e3837bc

Please sign in to comment.