forked from YahooArchive/arrow
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request YahooArchive#156 from pranavparikh/master
Adding Mocha tests, fixing documentation and support for maximizing browsers
- Loading branch information
Showing
49 changed files
with
2,138 additions
and
183 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
YUI.add("media-greeter", function (Y) { | ||
Y.namespace("Media"); | ||
|
||
var Greeter = Y.Media.Greeter = function() {}; | ||
|
||
//This is a simple method which takes two numbers | ||
//Add them and returns the value | ||
Greeter.prototype.greet = function(num1, num2) { | ||
return parseInt(num1)+parseInt(num2); | ||
} | ||
}, "0.1", {requires:[]}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
YUI.add("arrow-tabview", function (Y) { | ||
Y.namespace("Arrow"); | ||
|
||
Y.Arrow.TabView = { | ||
load : function(tabid) { | ||
var tabview = new Y.TabView({srcNode: tabid}); | ||
tabview.render(); | ||
} | ||
} | ||
}, "0.1", {requires:["tabview"]}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[ | ||
{ | ||
"settings":[ "master" ], | ||
|
||
"name":"controllers", | ||
|
||
"startProxyServer" : true, | ||
|
||
"routerProxyConfig" : "./router-extended.json", | ||
|
||
"config":{ | ||
"baseUrl":"http://news.yahoo.com" | ||
}, | ||
|
||
"dataprovider":{ | ||
|
||
"Test proxy Controller":{ | ||
"group":"func", | ||
"controller":"./proxy-controller-record-mocha.js", | ||
"params":{ | ||
"page":"$$config.baseUrl$$", | ||
"test":"./test-proxy-mocha.js", | ||
"engine" : "mocha", | ||
"engineConfig" : "./mocha-config.json" | ||
|
||
|
||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"settings":[ "environment:development" ] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[ | ||
{ | ||
"settings":[ "master" ], | ||
|
||
"name":"controllers", | ||
|
||
"config":{ | ||
"baseUrl":"http://finance.yahoo.com" | ||
}, | ||
|
||
|
||
"dataprovider":{ | ||
|
||
"Test YHOO Ticker using Finance Controller":{ | ||
"group":"func", | ||
"controller":"finance-controller-mocha.js", | ||
"params":{ | ||
"engine" : "mocha", | ||
"engineConfig" : "./mocha-config.json", | ||
"page":"$$config.baseUrl$$", | ||
"txtLocator":"#txtQuotes", | ||
"typeText":"yhoo", | ||
"btnLocator":"#btnQuotes", | ||
"test":"test-quote-mocha.js", | ||
"quote":"Yahoo! Inc. (YHOO)" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"settings":[ "environment:development" ] | ||
} | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/*jslint forin:true sub:true anon:true, sloppy:true, stupid:true nomen:true, node:true continue:true*/ | ||
|
||
/* | ||
* Copyright (c) 2012, Yahoo! Inc. All rights reserved. | ||
* Copyrights licensed under the New BSD License. | ||
* See the accompanying LICENSE file for terms. | ||
*/ | ||
|
||
|
||
var util = require("util"); | ||
var log4js = require("yahoo-arrow").log4js; | ||
var Controller = require("yahoo-arrow").controller; | ||
|
||
function FinanceCustomController(testConfig,args,driver) { | ||
Controller.call(this, testConfig,args,driver); | ||
|
||
this.logger = log4js.getLogger("FinanceCustomController"); | ||
} | ||
|
||
/* | ||
* All controllers MUST implement the Controller interface | ||
*/ | ||
util.inherits(FinanceCustomController, Controller); | ||
|
||
|
||
/** | ||
* In the execute method you get full access to webdriver's methods | ||
* Additionally, you can get a handle to the parameters in your descriptor | ||
* file by using this.testParams | ||
* | ||
* Lastly, in this case, the last statement is to execute the test | ||
* You'll note executeTest includes the same parameters as Arrow's CLI | ||
*/ | ||
FinanceCustomController.prototype.execute = function(callback) { | ||
var self = this; | ||
|
||
if(this.driver.webdriver){ | ||
|
||
//Get the various parameters needed from the Test Descriptor file | ||
var txtLocator = this.testParams.txtLocator; | ||
var typeText = this.testParams.typeText + "\n"; | ||
var page = this.testParams.page; | ||
|
||
//Get a handle of the WebDriver Object | ||
var webdriver = this.driver.webdriver; | ||
|
||
webdriver.get(page); | ||
webdriver.waitForElementPresent(webdriver.By.css(txtLocator)); | ||
//Navigate the page as necessary | ||
webdriver.findElement(webdriver.By.css(txtLocator)).sendKeys(typeText); | ||
|
||
webdriver.waitForElementPresent(webdriver.By.css(".title")).then(function() { | ||
self.testParams.page=null; | ||
self.driver.executeTest(self.testConfig, self.testParams, function(error, report) { | ||
callback(error); | ||
}); | ||
|
||
}); | ||
}else{ | ||
this.logger.fatal("Custom Controllers are currently only supported on Selenium Browsers"); | ||
callback("Custom Controllers are currently only supported on Selenium Browsers"); | ||
} | ||
} | ||
|
||
module.exports = FinanceCustomController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
[ | ||
{ | ||
"settings": [ "master" ], | ||
|
||
"name": "controllers", | ||
|
||
"config": { | ||
"baseUrl": "http://finance.yahoo.com" | ||
}, | ||
|
||
"dataprovider" : { | ||
"Test YHOO Ticker" : { | ||
"group" : "func", | ||
"params" :{ | ||
|
||
"scenario": [ | ||
{ | ||
"page": "$$config.baseUrl$$" | ||
}, | ||
{ | ||
"controller": "locator", | ||
"params": { | ||
"value": "#txtQuotes", | ||
"text": "yhoo\n" | ||
} | ||
}, | ||
{ | ||
"test": "test-quote-mocha.js", | ||
"quote": "Yahoo! Inc. (YHOO)", | ||
"engine" : "mocha", | ||
"engineConfig" : "./mocha-config.json" | ||
|
||
} | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"settings": [ "environment:development" ] | ||
} | ||
|
||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[ | ||
{ | ||
"settings": [ "master" ], | ||
|
||
"name" : "markup-test", | ||
|
||
"dataprovider" : { | ||
"Generic Markup Test" : { | ||
"group" : "smoke", | ||
"params" : { | ||
"test" : "../../../lib/common/tests/markup-test-mocha.js", | ||
"page" : "http://yahoo.github.io/debugCSS/playgrounds/accessibility.html", | ||
"engine" : "mocha", | ||
"engineConfig" : "./mocha-config.json", | ||
"warnOnly" : false | ||
} | ||
} | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"ui":"tdd","require":"chai","reporter":"html"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
var util = require("util"); | ||
var log4js = require("yahoo-arrow").log4js; | ||
var Controller = require("yahoo-arrow").controller; | ||
|
||
function ProxyCustomController(testConfig,args,driver) { | ||
Controller.call(this, testConfig,args,driver); | ||
|
||
this.logger = log4js.getLogger("ProxyCustomController"); | ||
} | ||
util.inherits(ProxyCustomController, Controller); | ||
ProxyCustomController.prototype.execute = function(callback) { | ||
var self = this; | ||
|
||
if(this.driver.webdriver){ | ||
|
||
var page = this.testParams.page; | ||
var webdriver = this.driver.webdriver; | ||
|
||
webdriver.get(page); | ||
//get value of global.proxyManager.record | ||
|
||
webdriver.waitForElementPresent(webdriver.By.css(".title")).then(function() { | ||
var record= JSON.stringify(global.proxyManager.record); | ||
console.log(record); | ||
self.testParams.proxyManagerRecord=record; | ||
self.testParams.page=null; | ||
self.driver.executeTest(self.testConfig, self.testParams, function(error, report) { | ||
callback(error); | ||
}); | ||
|
||
}); | ||
}else{ | ||
this.logger.fatal("Custom Controllers are currently only supported on Selenium Browsers"); | ||
callback("Custom Controllers are currently only supported on Selenium Browsers"); | ||
} | ||
} | ||
|
||
module.exports = ProxyCustomController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
[ | ||
{ | ||
"settings": [ "master" ], | ||
|
||
"name" : "descriptor", | ||
|
||
"startProxyServer" : true, | ||
|
||
"routerProxyConfig" : "router-mocha.json", | ||
|
||
"config" :{ | ||
"baseUrl" : "http://www.yahoo.com" | ||
}, | ||
|
||
"dataprovider" : { | ||
|
||
"dom" : { | ||
"params" : { | ||
"engine" : "mocha", | ||
"engineConfig" : "./mocha-config.json", | ||
"test" : "test-yahoo-title-mocha.js", | ||
"page" : "$$config.baseUrl$$" | ||
}, | ||
"group" : "int" | ||
|
||
} | ||
|
||
} | ||
|
||
}, | ||
|
||
{ | ||
"settings": [ "environment:development" ], | ||
"config": { | ||
"baseUrl": "http://news.yahoo.com" | ||
} | ||
}, | ||
{ | ||
"settings": [ "environment:production" ], | ||
"config": { | ||
"baseUrl": "http://sports.yahoo.com" | ||
} | ||
} | ||
|
||
|
||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"autos.yahoo.com" : "yourHost/linux machine", | ||
"yahoo.com" : { | ||
"newHost" : "yourHost/ linux machine" | ||
}, | ||
"sports.yahoo.com" : { | ||
"headers" : [ | ||
{ | ||
"param" : "User-Agent", | ||
"value" : "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5" | ||
} | ||
], | ||
"record" : true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"autos.yahoo.com" : "yourhost/linux machine", | ||
"yahoo.com" : { | ||
"newHost" : "yourhost/linux machine" | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
[ | ||
{ | ||
"settings": [ "master" ], | ||
|
||
"name" : "tabview", | ||
|
||
"commonlib" : "./test-lib-mocha.js", | ||
|
||
"config" :{ | ||
"baseUrl" : "http://www.doctor46.com" | ||
}, | ||
|
||
"dataprovider" : { | ||
|
||
"dom_int" : { | ||
"params" : { | ||
"engine" : "mocha", | ||
"engineConfig" : "./mocha-config.json", | ||
"test" : "test-func-mocha.js", | ||
"page" : "testMock.html" | ||
}, | ||
"group" : "unit" | ||
}, | ||
|
||
"dom" : { | ||
"params" : { | ||
"engine" : "mocha", | ||
"engineConfig" : "./mocha-config.json", | ||
"test" : "test-func-mocha.js", | ||
"page" : "$$config.baseUrl$$/tabview.html" | ||
}, | ||
"group" : "func" | ||
}, | ||
|
||
"int" : { | ||
"params" : { | ||
"engine" : "mocha", | ||
"engineConfig" : "./mocha-config.json", | ||
"test" : "test-int-mocha.js", | ||
"page" : "$$config.baseUrl$$/tabview.html" | ||
}, | ||
"group" : "smoke" | ||
} | ||
|
||
} | ||
|
||
}, | ||
|
||
{ | ||
"settings": [ "environment:development" ] | ||
} | ||
|
||
] |
Oops, something went wrong.