|
| 1 | +//Load modules |
| 2 | +var webdriver = require('selenium-webdriver'); |
| 3 | + |
| 4 | +//Internet Browser Drivers |
| 5 | +var chrome = new webdriver.Builder().forBrowser('chrome').build(); |
| 6 | +var firefox = new webdriver.Builder().forBrowser('firefox').build(); |
| 7 | + |
| 8 | +var drivers = [ chrome, firefox]; |
| 9 | +var names = ['Chrome', 'FireFox']; |
| 10 | + |
| 11 | +//Execute Tests |
| 12 | +for (i = 0; i < drivers.length; i++){ |
| 13 | + console.log('Now Testing for %s \n', names[i]); |
| 14 | + drivers[i].get('http://cloudberry.ics.uci.edu'); |
| 15 | + Title_Assert(); |
| 16 | + Reset_Button_Assert(); |
| 17 | + console.log(' '); |
| 18 | + |
| 19 | +} |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | +//Test Functions |
| 25 | +function Title_Assert() { |
| 26 | + var title = drivers[i].getTitle().then( function(title) { |
| 27 | + if(title != "Cloudberry") |
| 28 | + { |
| 29 | + console.log("************************"); |
| 30 | + console.log("Title Check......Failed "); |
| 31 | + console.log("************************"); |
| 32 | + } |
| 33 | + else |
| 34 | + console.log("Title Check......Cleared"); |
| 35 | + }); |
| 36 | + |
| 37 | +} |
| 38 | + |
| 39 | +function Reset_Button_Assert() { |
| 40 | + var zoomLevel = drivers[i].findElement(webdriver.By.tagName('map')).getAttribute("zoom").then( function(zoomlevel){ |
| 41 | + if(zoomlevel != 4) |
| 42 | + { |
| 43 | + console.log("****************************************"); |
| 44 | + console.log('Reset Button ZoomLevel Check......Failed'); |
| 45 | + console.log("****************************************"); |
| 46 | + } |
| 47 | + else |
| 48 | + console.log('Reset Button Zoomlevel Check......Cleared'); |
| 49 | + }); |
| 50 | + |
| 51 | + var latCoordinate = drivers[i].findElement(webdriver.By.tagName('map')).getAttribute("lat").then( function(latCoordinate){ |
| 52 | + if(latCoordinate != 39.5) |
| 53 | + { |
| 54 | + console.log("**************************************************"); |
| 55 | + console.log('Reset Button Latitude Coordinate Check......Failed'); |
| 56 | + console.log("**************************************************"); |
| 57 | + } |
| 58 | + else |
| 59 | + console.log('Reset Button Latitude Coordinate Check......Cleared'); |
| 60 | + }); |
| 61 | + |
| 62 | + var lngCoordinate = drivers[i].findElement(webdriver.By.tagName('map')).getAttribute("lng").then( function(lngCoordinate){ |
| 63 | + if(lngCoordinate != -96.35) |
| 64 | + { |
| 65 | + console.log("**************************************************"); |
| 66 | + console.log('Reset Button Longitude Coordinate Check......Failed'); |
| 67 | + console.log("**************************************************"); |
| 68 | + } |
| 69 | + else |
| 70 | + console.log('Reset Button Longitude Coordinate Check......Cleared'); |
| 71 | + }); |
| 72 | +} |
0 commit comments