Diff
Modified: trunk/app/app_controller.php (882 => 883)
--- trunk/app/app_controller.php 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/app_controller.php 2010-07-13 11:08:03 UTC (rev 883)
@@ -23,7 +23,6 @@
public $helpers = array('Html','Ajax','Javascript', 'Tree');
public $layout = 'green';
public $main_menu_id = -1;
- public $debugmode = true;
public $time;
public $user_projects;
public $majorversion = '3.0 rc1 SVN';
Added: trunk/app/config/sql/versions/883.sql (0 => 883)
--- trunk/app/config/sql/versions/883.sql (rev 0)
+++ trunk/app/config/sql/versions/883.sql 2010-07-13 11:08:03 UTC (rev 883)
@@ -0,0 +1,9 @@
+ALTER TABLE `browsers`
+ DROP `shortname`,
+ DROP `saucename`;
+
+ALTER TABLE `operatingsystems`
+ DROP `shortname`,
+ DROP `saucename`;
+
+ALTER TABLE `tests` ADD `saucelabs_job_id` VARCHAR( 255 ) NULL;
\ No newline at end of file
Modified: trunk/app/controllers/browsers_controller.php (882 => 883)
--- trunk/app/controllers/browsers_controller.php 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/controllers/browsers_controller.php 2010-07-13 11:08:03 UTC (rev 883)
@@ -42,23 +42,6 @@
$this->Browser->create();
$this->data['Browser']['shortname'] = strtolower($this->data['Browser']['shortname']);
if ($this->Browser->save($this->data)) {
- App::import('Model','Operatingsystem');
- App::import('Model','Combination');
-
- $os = new Operatingsystem();
- $combination = new Combination();
-
- $os->recursive = 0;
- $all_os = $os->find('all');
-
- foreach ($all_os as $value) {
- $data = array();
- $data['Combination']['operatingsystem_id'] = $value['Operatingsystem']['id'];
- $data['Combination']['browser_id'] = $this->Browser->id;
- $combination->create();
- $combination->save($data);
- }
-
$this->Session->setFlash(__('The Browser has been saved', true));
$this->redirect(array('action'=>'index'));
@@ -85,24 +68,13 @@
$this->data = $this->Browser->read(null, $id);
}
}
-
- function delete($id = null) {
+
+ function delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for Browser', true));
$this->redirect(array('action'=>'index'));
}
- if ($this->Browser->del($id)) {
-
- $combination = new Combination();
-
- $all_com = $combination->find('all',
- array('conditions' => array('Combination.browser_id'=>$id))
- );
-
- foreach ($all_com as $key=>$value) {
- $this->Browser->Combination->del($value['Combination']['id']);
- }
-
+ if ($this->Browser->del($id, true)) { //NOTICE: CASCADE = TRUE
$this->Session->setFlash(__('Browser deleted', true));
$this->redirect(array('action'=>'index'));
}
Modified: trunk/app/controllers/configs_controller.php (882 => 883)
--- trunk/app/controllers/configs_controller.php 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/controllers/configs_controller.php 2010-07-13 11:08:03 UTC (rev 883)
@@ -138,11 +138,50 @@
$this->layout = 'none';
}
+ public function sauce(){
+ $sauce_combinations = array(
+ 'Windows 2003' => array(
+ 'firefox-2.0.' => 'NA',
+ 'firefox-3.0.' => 'NA',
+ 'firefox-3.5.' => 'NA',
+ 'firefox-3.6.' => 'NA',
+ 'googlechrome' => 'NA',
+ 'iexplore-6.' => 'NA',
+ 'iexplore-7.' => 'NA',
+ 'iexplore-8.' => 'NA',
+ 'opera-10' => 'NA',
+ 'opera-9.' => 'NA',
+ 'safari-3.' => 'NA',
+ 'safari-4.' => 'NA'
+ ),
+ 'Linux' => array()
+ );
- public function sauce(){
if(!empty($this->data)) {
+ //pr($this->data);
foreach($this->data['Config'] as $name => $value) {
$data = $this->Config->findByName($name);
+ if($name == 'sauce_enabled'){
+ $this->loadModel('Operatingsystem');
+ $this->loadModel('Browser');
+ foreach($sauce_combinations as $OS => $browsers){
+ if($value == 1 && $data['Config']['value'] == 0){ //enable sauce mode
+ $this->Operatingsystem->create();
+ $this->Operatingsystem->save(array('Operatingsystem' => array('name' => "SauceLabs $OS")));
+ }elseif($value == 0 && $data['Config']['value'] == 1){
+ $this->Operatingsystem->deleteAll(array('Operatingsystem.name' => "SauceLabs $OS"));
+ }
+ foreach($browsers as $browser => $path){
+ if($value == 1 && $data['Config']['value'] == 0){ //enable sauce mode
+ $this->Browser->create();
+ $this->Browser->save(array('Browser' => array('name' => "SauceLabs $browser", 'path' => $path)));
+ }elseif($value == 0 && $data['Config']['value'] == 1){
+ $this->Browser->deleteAll(array('Browser.name' => "SauceLabs $browser"));
+ }
+ }
+ }
+ }
+
$data['Config']['name'] = $name;
$data['Config']['value'] = $value;
$this->Config->create();
Modified: trunk/app/controllers/jobs_controller.php (882 => 883)
--- trunk/app/controllers/jobs_controller.php 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/controllers/jobs_controller.php 2010-07-13 11:08:03 UTC (rev 883)
@@ -7,6 +7,7 @@
function beforeFilter(){
Configure::write('Cache.disable', true);
$this->loadModel('Config');
+ $this->loadModel('Seleniumserver');
$this->servername = $this->Config->field('value', array('name'=>'servername'));
$this->port = $this->Config->field('value', array('name'=>'port'));
$this->Auth->allow('check');
@@ -16,8 +17,7 @@
function index() {
$this->Job->recursive = 0;
-
-
+
$this->paginate = array(
'Job' => array(
'limit' => 20,
@@ -70,20 +70,19 @@
private function updateNodes(){
//session_write_close(); //Needed for avoiding race conditions even when using ajax
- $this->Node->cacheQueries = false;
+ $this->Seleniumserver->cacheQueries = false;
$this->loadModel('Test');
- $this->loadModel('Node');
- $nodes = $this->Node->find('all');
- foreach($nodes as $node){
-
- if((time() - $node['Node']['lastCommand']) > $this->timeout && $node['Node']['lastCommand'] != null){ //The test has not run commands for timeout seconds
- /*$this->log("Test killed due to timeout of $this->timeout seconds");
- $customCommand = urlencode("?cmd=customCommand&cmdName=Test terminated&var1=Bromine judged the test unresponsive because no commands had been run for $this->timeout seconds.&var2=The test was terminated to free up the nodes resources.test_id=$test_id&status=failed");
+ $seleniumservers = $this->Seleniumserver->find('all');
+ foreach($seleniumservers as $seleniumserver){
+ if((time() - $seleniumserver['Seleniumserver']['lastCommand']) > $this->timeout && $seleniumserver['Seleniumserver']['lastCommand'] != null){ //The test has not run commands for timeout seconds
+ $this->log("Test ".$seleniumserver['Seleniumserver']['test_id']." killed due to timeout of ".$this->timeout." seconds", 'jobs');
+
+ $customCommand = urlencode("?cmd=customCommand&cmdName=Test terminated&var1=Bromine judged the test unresponsive because no commands had been run for $this->timeout seconds.&var2=The test was terminated to free up the nodes resources&status=failed&sessionId=".$seleniumserver['Seleniumserver']['session_id']);
$handle = fopen("http://".$this->servername.':'.$this->port."/selenium-server/driver/$customCommand",'r');
- $handle = fopen("http://".$this->servername.':'.$this->port."/selenium-server/driver/?cmd=testComplete&sessionId=$sessionId",'r');
- fclose($handle); */
+ $handle = fopen("http://".$this->servername.':'.$this->port."/selenium-server/driver/?cmd=testComplete&sessionId=".$seleniumserver['Seleniumserver']['session_id'],'r');
+ fclose($handle);
- $this->Node->updateAll(array('running'=>0, 'test_id'=>null, 'session_id' => null, 'lastCommand' => null), array('Node.id' => $node['Node']['id']));
+ $this->Seleniumserver->delete($seleniumserver['Seleniumserver']['id']);
}
}
}
@@ -105,7 +104,7 @@
jobs.operatingsystem_id = operatingsystems.id AND
jobs.testcase_id = testcases.id AND
operatingsystems.id = nodes.operatingsystem_id AND
- nodes.running = 0 AND
+ (nodes.running < nodes.limit OR nodes.limit = -1) AND
browsers_nodes.browser_id = browsers.id AND
browsers_nodes.node_id = nodes.id AND
jobs.suite_id = suites.id AND
@@ -128,9 +127,11 @@
}
private function run($nextPossible){
+ //$this->log("function run called with nextPossible: ".print_r($nextPossible, true), 'jobs');
//Sets up the selenium-server in the DB, puts together the command line string
//Setup the test in the DB
- $this->Test->create();
+ $this->loadModel('Test');
+
$this->data['Test'] = array(
'name' => $nextPossible['testcases']['name'],
'suite_id' => $nextPossible['suites']['id'],
@@ -140,12 +141,20 @@
'operatingsystem_id' => $nextPossible['operatingsystems']['id'],
'testcase_id' => $nextPossible['testcases']['id'],
);
- $this->loadModel('Test');
+ $this->Test->create();
$this->Test->save($this->data);
$test_id = $this->Test->id;
- //Update the node
- $this->Node->updateAll(array('test_id'=>$test_id, 'running'=>1, 'lastCommand'=>time()), array('Node.id'=>$nextPossible['nodes']['id']));
+ //Create the seleniumserver
+ $this->Seleniumserver->create();
+ $this->Seleniumserver->save(array(
+ 'test_id' => $test_id,
+ 'nodepath' => $nextPossible['nodes']['nodepath'],
+ 'node_id' => $nextPossible['nodes']['id'],
+ 'lastCommand' => time()
+ ));
+
+ //delete the job
$this->Job->delete($nextPossible['jobs']['id']);
$project_name = $nextPossible['projects']['name'];
@@ -160,16 +169,20 @@
//Put together browser, sauce RC integration:
$sauce_enabled = $this->Config->field('value', array('name'=> 'sauce_enabled'));
- if($sauce_enabled == 1){
+ if($sauce_enabled == 1 && $nextPossible['nodes']['nodepath'] == '67.23.20.87:4444'){
$sauce_username = $this->Config->field('value', array('name' => 'sauce_username'));
$sauce_apikey = $this->Config->field('value', array('name'=> 'sauce_apikey'));
- $saucename = explode('-',$nextPossible['browsers']['saucename']);
+
+ $browser = str_replace('SauceLabs ', '', $nextPossible['browsers']['name']);
+ $browser = explode('-', $browser);
+
+ $OS = str_replace('SauceLabs ', '', $nextPossible['operatingsystems']['name']);
$browser = '{"username": "'.$sauce_username.'",'.
' "access-key": "'.$sauce_apikey.'",'.
- ' "os": "'.$nextPossible['operatingsystems']['saucename'].'",'.
- ' "browser": "'.$saucename[0].'",'.
- ' "browser-version": "'.$saucename[1].'",'.
+ ' "os": "'.$OS.'",'.
+ ' "browser": "'.$browser[0].'",'.
+ ' "browser-version": "'.$browser[1].'",'.
' "job-name": "'.$nextPossible['testcases']['name'].'"}';
$browser = urlencode($browser);
}else{
@@ -190,14 +203,14 @@
private function execute($cmd, $test_id) {
//session_write_close(); //Needed for avoiding race conditions even when using ajax
- $this->log("Executing: $cmd");
- $this->log("Output printed to logs/output$test_id.txt");
+ $this->log("Executing: $cmd", 'jobs');
+ $this->log("Output printed to ".'"'.LOGS."$test_id.log".'"', 'jobs');
if (substr(php_uname(), 0, 7) == "Windows"){ //Windows
- $this->log(pclose(popen("start /B ".$cmd .' > logs/output' . $test_id . '.txt && exit', "r")));
+ pclose(popen("start /B ".$cmd .' > '.'"'.LOGS."$test_id.log".'"'." && exit", "r"));
}
else { //Unix.
- exec($cmd . " > logs".DS."output$test_id.txt &");
+ exec($cmd . " > ".LOGS."$test_id.log &");
}
}
Modified: trunk/app/controllers/operatingsystems_controller.php (882 => 883)
--- trunk/app/controllers/operatingsystems_controller.php 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/controllers/operatingsystems_controller.php 2010-07-13 11:08:03 UTC (rev 883)
@@ -39,26 +39,10 @@
function add() {
if (!empty($this->data)) {
+ //pr($this->data);
$this->Operatingsystem->create();
$this->data['Operatingsystem']['shortname'] = strtolower($this->data['Operatingsystem']['shortname']);
if ($this->Operatingsystem->save($this->data)) {
-
- $browser = new Browser();
- $combination = new Combination();
-
- $browser->recursive = 0;
- $all_browser = $browser->find('all');
-
- foreach ($all_browser as $value) {
-
- $data = array();
- $data['Combination']['browser_id'] = $value['Browser']['id'];
- $data['Combination']['operatingsystem_id'] = $this->Operatingsystem->id;
- $combination->create();
- $combination->save($data);
-
- }
-
$this->Session->setFlash(__('The Operatingsystem has been saved', true));
$this->redirect(array('action'=>'index'));
} else {
@@ -90,16 +74,7 @@
$this->Session->setFlash(__('Invalid id for Operatingsystem', true));
$this->redirect(array('action'=>'index'));
}
- if ($this->Operatingsystem->del($id)) {
-
- $combination = new Combination();
- $all_com = $combination->find('all',
- array('conditions' => array('Combination.operatingsystem_id'=>$id))
- );
-
- foreach ($all_com as $key=>$value) {
- $this->Operatingsystem->Combination->del($value['Combination']['id']);
- }
+ if ($this->Operatingsystem->del($id, true)) { //NOTICE: CASCADE = TRUE
$this->Session->setFlash(__('Operatingsystem deleted', true));
$this->redirect(array('action'=>'index'));
}
Modified: trunk/app/controllers/runrctests_controller.php (882 => 883)
--- trunk/app/controllers/runrctests_controller.php 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/controllers/runrctests_controller.php 2010-07-13 11:08:03 UTC (rev 883)
@@ -21,11 +21,6 @@
<?php
class RunrctestsController extends AppController {
- public $runningLimit = 1; //How many testscript can be executed on each selenium-server
- public $loopLimit = 10000; //How many loops the loadbalancer will do before giving up running a test suite. Set to -1 for infinite
- public $timeout = 45; //After this many seconds of not recieving commands, Bromine will terminate the test
- //Don't change anything below this line
-
public $helpers = array('Html', 'Form');
public $layout = "green";
public $uses = array();
@@ -46,56 +41,8 @@
$this->servername = $this->Config->field('value', array('name'=>'servername'));
$this->port = $this->Config->field('value', array('name'=>'port'));
parent::beforeFilter();
- }
-
- private function array_search_recursive($key, $needle, $haystack){
- $path=array();
- foreach($haystack as $id => $val){
- if($val == $needle && $id == $key)
- $path[]=$id;
- else if(is_array($val)){
- $found=$this->array_search_recursive($key, $needle, $val);
- if(count($found)>0){
- $path[$id]=$found;
- }
- }
- }
- return $path;
}
- private function cmp($a, $b){
- //pr($a = $a['Node']);
- //pr($b = $b['Node']);
- $field_1 = 'Browser';
- $field_2 = 'running';
-
- if(count($a[$field_1]) == count($b[$field_1])){
- if(count($a[$field_2]) == count($b[$field_2])){
- return 0;
- }
- elseif(count($a[$field_2]) > count($b[$field_2])){
- return 1;
- }
- elseif(count($a[$field_2]) < count($b[$field_2])){
- return -1;
- }
- }
- elseif(count($a[$field_1]) > count($b[$field_1])){
- return 1;
- }
- elseif(count($a[$field_1]) < count($b[$field_1])){
- return -1;
- }
- }
-
- public function log($msg){
- if ($this->debugmode){
- $fp = fopen('logs/Loadbalancer_output.txt','a');
- fwrite($fp, date('l jS \of F Y h:i:s A'). ': ' . $msg."\n");
- fclose($fp);
- }
- }
-
private function getFileExt($id){
App::import('Model','Type');
$this->Type = new Type();
@@ -108,54 +55,6 @@
}
return false;
}
-
- private function getAvailableNodes($nodes, $OS_id, $browser_id){
- $availableNodes=array();
- foreach($nodes as $k=>$node){
- if(count($node['Node']['running']) < $this->runningLimit && $this->Node->checkJavaServer($node['Node']['nodepath']) && $this->array_search_recursive('id', $browser_id, $node['Browser'])!==array() && $node['Node']['operatingsystem_id']==$OS_id){
- $availableNodes[$k]=$node;
- }
- }
- return $availableNodes;
- }
-
- private function findBestNode($nodes){
- //Algorithm to be debated
- //Current alorithm: Sort by number of browsers as first priority and number of running as second.
- //uasort($nodes,array($this,'cmp'));
- return current(array_keys($nodes));
- }
-
- private function updateNodes($nodes){
- $this->loadModel('Test');
-
- foreach($nodes as $k=>$node){
- foreach($node['Node']['running'] as $j=>$uid){
- $currentTime = time();
- $seleniumServer = $this->Seleniumserver->find("uid = '$uid'");
- $lastCommand = $seleniumServer['Seleniumserver']['lastCommand'];
- $sessionId = $seleniumServer['Seleniumserver']['session'];
- $test_id = $seleniumServer['Seleniumserver']['test_id'];
- $done = $seleniumServer['Seleniumserver']['done'];
- if((time() - $lastCommand) > $this->timeout && $lastCommand != 0){ //The test has not run commands for timeout seconds
- $this->log("Test killed due to timeout of $this->timeout seconds");
- $customCommand = urlencode("?cmd=customCommand&cmdName=Test terminated&var1=Bromine judged the test unresponsive because no commands had been run for $this->timeout seconds.&var2=The test was terminated to free up the nodes resources.&uid=$uid&test_id=$test_id&status=failed");
- $handle = fopen("http://".$this->servername.':'.$this->port."/selenium-server/driver/$customCommand",'r');
- $handle = fopen("http://".$this->servername.':'.$this->port."/selenium-server/driver/?cmd=testComplete&sessionId=$sessionId",'r');
- fclose($handle);
- unset($nodes[$k]['Node']['running'][$j]);
- // Used for cleaning up the seleniumserver table
- $this->Seleniumserver->delete($uid,false);
- }
- if($done){
- unset($nodes[$k]['Node']['running'][$j]);
- // Used for cleaning up the seleniumserver table
- $this->Seleniumserver->delete($uid,false);
- }
- }
- }
- return $nodes;
- }
//Should be called when adding to the que
function setupSuite($requirement_id){ //Sets up the suite, returns suite_id to viewer, viewer calls runRequirement/runTestcase
@@ -237,10 +136,7 @@
}
function runRequirement($requirement_id, $suite_id){ //Sorts out offline needs, sets up tests array, calls loadBalancer
- App::import('Model','Requirement');
-
- $this->Requirement = new Requirement();
- $this->Requirement->Behaviors->attach('Containable');
+ $this->loadModel('Requirement');
$requirement = $this->Requirement->find('first', array(
'conditions'=>array(
'Requirement.id'=>$requirement_id
@@ -275,10 +171,8 @@
}
}
}
- $this->loadModel('Job');
- $this->log(print_r($jobs,true));
+ $this->loadModel('Job');
$this->Job->saveAll($jobs);
- //$this->loadBalancer($suite_id,$tests);
}
function runTestcase($testcase_id, $requirement_id, $suite_id){ //Sorts out offline needs, sets up tests array, calls loadBalancer
@@ -311,170 +205,12 @@
);
}
}
- $this->loadModel('Job');
- $this->log(print_r($jobs,true));
+ $this->loadModel('Job');
$this->Job->saveAll($jobs);
- //$this->loadBalancer($suite_id,$tests);
}
- private function loadBalancer($suite_id=0, $tests=array()){ //BR's own grid-alike function that sends the tests to the nodes when they are ready
- session_write_close(); //Needed for avoiding race conditions even when using ajax
-
- $this->log("loadBalancer was called with tests = ".print_r($tests,true).", suite_id = $suite_id");
- App::import('Model','Suite');
- $this->Suite = new Suite();
- $this->Suite->recursive = 1;
- $suite = $this->Suite->read(null,$suite_id);
- $siteToTest = $suite['Site']['name'];
- $this->log("siteToTest: $siteToTest");
-
- App::import('Model','Node');
- $this->Node = new Node();
- $nodes = $this->Node->find('all');
-
- foreach($nodes as &$node){
- $node['Node']['running'] = array();
- }
-
- $i=0;
- //DON'T enter this loop with combination needs you don't have the nodes to handle. You'll get an infinite loop.
- while($this->array_search_recursive('done',0,$tests)!==array() || $this->nodes_running($nodes)){ //While there are tests that has not been run, or nodes still running
-
- $this->log("Doing loop ".$i++);
- foreach($tests as $testName => $test){ //Loop through each test
- foreach($test as $k=>$need){ //Loop through each need
- if($need['done']==0){ //If need not done
- $OS_id = $need['OS'];
- $browser_id = $need['browser'];
- $this->log('Need: '.print_r($need,true));
- $availableNodes = $this->getAvailableNodes($nodes,$OS_id,$browser_id); //Find all available nodes. (not full, right OS and brows)
- $this->log("available nodes: ".print_r($availableNodes,true));
-
- if(!empty($availableNodes)){
-
- $bestNodeId = $this->findBestNode($availableNodes); //Find the best node.
- $bestNode = $nodes[$bestNodeId];
-
- //Run the test
- $uid = str_replace('.', '', microtime('U')) . rand(0, 1000);
- $this->log("Running test $testName on $OS_id / $browser_id using resource ".$bestNode['Node']['nodepath']." with uid = $uid");
-
- $this->run($testName, $bestNode['Node']['nodepath'], $OS_id, $browser_id, $siteToTest, $suite_id, $uid); //Run the test
-
- //Update the need and the node
- $tests[$testName][$k]['done'] = 1;
- $nodes[$bestNodeId]['Node']['running'][] = $uid;
- }
- }
- }
- }
- sleep(2);
- $nodes = $this->updateNodes($nodes);
- if($this->loopLimit != -1 && $i>$this->loopLimit){
- $this->log("Exceeded loop limit of ".$this->loopLimit." loops. Breaking.");
- break;
- }
- }
- $email_enabled = $this->Config->field('value', array('name' => 'email_enabled'));
- if ($email_enabled == true){
- $this->notifyUsers($suite_id,$uid);
- }
- }
-
-
- private function run($testName, $nodePath, $OS_id, $browser_id, $siteToTest, $suite_id, $uid){
- //Sets up the selenium-server in the DB, puts together the command line string
- //Setup the test in the DB
- App::import('Model','Test');
- App::import('Model','Testcase');
- $this->Test = new Test();
- $this->Testcase = new Testcase();
- $testcase = $this->Testcase->read(null, $testName);
-
- $this->data['Test'] = array(
- 'name' => $testcase['Testcase']['name'],
- 'suite_id' => $suite_id,
- 'manstatus' => "auto",
- 'browser_id' => $browser_id,
- 'operatingsystem_id' => $OS_id,
- 'testcase_id' => $testName,
- 'uid' => 0
- );
- $this->Test->save($this->data);
- $test_id = $this->Test->id;
-
- //Setup the Seleniumserver in the DB for uid/session storage
- App::import('Model','Seleniumserver');
- $this->Seleniumserver = new Seleniumserver();
- $this->data['Seleniumserver']['session'] = "-1";
- $this->data['Seleniumserver']['nodepath'] = $nodePath;
- $this->data['Seleniumserver']['uid'] = $uid;
- $this->data['Seleniumserver']['test_id'] = $test_id;
- $this->data['Seleniumserver']['lastCommand'] = time();
- $this->data['Seleniumserver']['done'] = 0;
- $this->Seleniumserver->save($this->data);
-
- //Setup type variables (extension, spacer and so on)
- $extension = $this->getFileExt($testName);
- App::import('Model','Type');
- $this->typemodel = new Type();
- $this->types = $this->typemodel->find("extension = '$extension'");
- $name = $this->types['Type']['name'];
- $spacer = $this->types['Type']['spacer'];
- $command = $this->types['Type']['command'];
-
- //Find the browser path
- App::import('Model','Browser');
- $this->Browser = new Browser();
- $browser = $this->Browser->find("id = $browser_id");
- $browserPath = $browser['Browser']['path'];
-
- //Put together the command line string
- $cmd = $command . $spacer . '"'.WWW_ROOT . 'testscripts' . DS .
- $this->Session->read('project_name') . DS . $extension . DS . $testName . '.' . $extension .'"'.
- $spacer . $this->servername . $spacer . $this->port . $spacer . $browserPath . $spacer .
- $siteToTest . $spacer . $uid . $spacer . $test_id;
- //Execute it
- $this->execute($cmd, $test_id);
- }
-
-
- private function execute($cmd, $test_id) {
- $this->log("Executing: $cmd");
- $this->log("Output printed to logs/output$test_id.txt");
-
- if (substr(php_uname(), 0, 7) == "Windows"){ //Windows
- $this->log(pclose(popen("start /B ".$cmd .' > logs/output' . $test_id . '.txt && exit', "r")));
- }
- else { //Unix.
- exec($cmd . " > logs".DS."output$test_id.txt &");
- }
- }
-
-
- private function directoryToArray($directory, $recursive) {
- $array_items = array();
- if ($handle = opendir($directory)) {
- while (false !== ($file = readdir($handle))) {
- if ($file != "." && $file != ".." ) {
- if (is_dir($directory. "/" . $file)) {
- if($recursive) {
- $array_items = array_merge($array_items, $this->directoryToArray($directory. "/" . $file, $recursive));
- }
- $file = $directory . "/" . $file;
- $array_items[] = preg_replace("/\/\//si", "/", $file);
- } else {
- $file = $directory . "/" . $file;
- $array_items[] = preg_replace("/\/\//si", "/", $file);
- }
- }
- }
- closedir($handle);
- }
- return $array_items;
- }
-
+ /*
function notifyUsers($suite_id,$uid){
$this->loadModel('Suite');
$this->log("notify users called with: suite_id=$suite_id, uid=$uid");
@@ -521,7 +257,7 @@
$this->Email->sendAs = 'html';
$this->Email->template = 'report';
- /* Set delivery method */
+ //Set delivery method
$this->Email->delivery = 'smtp';
$this->Email->to = $this->realname . " <$newuser>";
@@ -539,4 +275,5 @@
}
}
+ */
}
Modified: trunk/app/controllers/seleniumserver_controller.php (882 => 883)
--- trunk/app/controllers/seleniumserver_controller.php 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/controllers/seleniumserver_controller.php 2010-07-13 11:08:03 UTC (rev 883)
@@ -22,16 +22,15 @@
class SeleniumserverController extends AppController {
public $layout = null;
- var $uses = array('Node');
-
function beforeFilter(){
$this->Auth->allow('*');
}
function driver(){
- App::import('Model','Command');
- $this->Command = new Command();
- $this->Test = new Test();
+
+ $this->loadModel('Command');
+ $this->loadModel('Test');
+ $this->loadModel('Node');
Configure::write('debug', 0);
@@ -49,26 +48,26 @@
}else{
$sessionId = "";
}
- $this->log(print_r($_REQUEST,true));
+ $this->log(print_r($_REQUEST,true),'Leech_output');
//If, first command, use test_id for DB identification
if ($cmd == 'getNewBrowserSession'){
$arr = split(';',$one);
$one = $arr[0];
$test_id = $arr[1];
- $result = $this->Node->find("test_id = '$test_id'");
- $this->log('GetNewBrowserSession, '.$test_id);
+ $result = $this->Seleniumserver->find("test_id = '$test_id'");
+ $this->log('GetNewBrowserSession, '.$test_id, 'Leech_output');
}
//All other commands, use sessionId
elseif($cmd != 'customCommand'){
if($sessionId == '' || !isset($sessionId)){
- $this->log('ERROR no session id. Terminating.');
+ $this->log('ERROR no session id. Terminating.', 'Leech_output');
echo "ERROR no session id. Terminating.";
exit;
}
- $result = $this->Node->find("session_id = '$sessionId'");
- $this->log($cmd . ' on session ' . $sessionId);
+ $result = $this->Seleniumserver->find("session_id = '$sessionId'");
+ $this->log($cmd . ' on session ' . $sessionId, 'Leech_output');
}
if($cmd == 'customCommand'){ //If custom command, just insert in the DB and be done with it.
$cmdName = $_REQUEST['cmdName'];
@@ -78,24 +77,24 @@
$var2 = $_REQUEST['var2'];
$this->insertCommand($status, $cmdName, $var1, $var2, $test_id, $sessionId);
echo "OK";
- $this->log("Custom command: cmd='$cmdName' & 1='$var1' & 2='$var2'");
+ $this->log("Custom command: cmd='$cmdName' & 1='$var1' & 2='$var2'", 'Leech_output');
exit;
}
//Grab the data from the DB
//pr ($result);
- $nodepath = $result['Node']['nodepath']; //Must be an IP!!!! localhost will fuck it up
- $test_id = $result['Node']['test_id'];
+ $nodepath = $result['Seleniumserver']['nodepath']; //Must be an IP!!!! localhost will fuck it up
+ $test_id = $result['Seleniumserver']['test_id'];
//Send the command to the RC server
$cmd = urlencode($cmd);
$one = urlencode($one);
$two = urlencode($two);
- //$url = "http://$nodepath/selenium-server/driver/?cmd=$cmd&1=$one&2=$two&sessionId=$sessionId";
+
$session = $sessionId ? "&sessionId=$sessionId" : "";
$url = "http://$nodepath/selenium-server/driver/?cmd=$cmd&1=$one&2=$two$session";
- $this->log("Executing $url");
+ $this->log("Executing $url", 'Leech_output');
$response = $this->executeCommand($url);
- $this->log("command returned: '" . $response . "'");
+ $this->log("command returned: '" . $response . "'", 'Leech_output');
//Determine status
if (preg_match('/^OK/', $response) ) {
@@ -112,40 +111,21 @@
if ($cmd == 'getNewBrowserSession'){
$sessionId = end(split(',',$response));
- $this->Node->updateAll(
+ $this->Seleniumserver->updateAll(
array(
- 'Node.session_id' => "'$sessionId'",
- 'Node.lastCommand' => time()
- ),"Node.test_id = '$test_id'"
- );
- $this->log("Updated DB with session: '$sessionId' on test_id: '$test_id'");
+ 'Seleniumserver.session_id' => "'$sessionId'",
+ 'Seleniumserver.lastCommand' => time()
+ ),"Seleniumserver.test_id = '$test_id'"
+ );
+ $test = $this->Test->findById($test_id);
+ $test['Test']['saucelabs_job_id'] = $sessionId;
+ $this->Test->save($test);
+ $this->log("Updated DB with session: '$sessionId' on test_id: '$test_id'", 'Leech_output');
}
//If NOTHING messed up, send the response
echo $response;
- //echo "OK";
- //END
-
- /*
- }catch(Exception $e){
- $req = print_r($_REQUEST, true);
- $timedate = date("m.d.y H:i:s");
- $msg = "$timedate \n Called with: $req \n Url created: $url \n Got response: $response \n ***ERROR***: $e \n\n";
- if(file_exists('log.txt')){
- $fp = fopen('log.txt','r');
- $prev_cont = file_get_contents('log.txt');
- fclose($fp);
- }
- $fp = fopen('log.txt','w');
- fwrite($fp,$msg.$prev_cont);
- fclose($fp);
- $short_msg="<br /><br /><b>ERROR: index.php suffered an error:<br /></b> <i>$e</i><br /><b>Check the <a href='../selenium-server/driver/log.txt' target='_blank'>log</a> for details.</b><br /><br />";
- echo $short_msg;
- if($test_id!='' && $u_id!=''){
- insertCommand('failed', '', '', $short_msg, $test_id, $u_id);
- }
- }
- */
+ $this->log('echoed response', 'Leech_output');
}
@@ -162,61 +142,46 @@
$this->Command->save($command);
if($test_id !== null){
- $node = $this->Node->find('first',array(
+ $seleniumserver = $this->Seleniumserver->find('first',array(
'conditions' => array(
- "Node.test_id" => $test_id
+ "Seleniumserver.test_id" => $test_id
)
)
);
}elseif($sessionId !== null){
- $node = $this->Node->find('first',array(
+ $seleniumserver = $this->Seleniumserver->find('first',array(
'conditions' => array(
- "Node.session_id" => $sessionId
+ "Seleniumserver.session_id" => $sessionId
)
)
);
}else{
- $this->log("test_id and session_id not set. Cannot proceed. debug: status: $status cmd: $cmd var1: $var1 var2: $var2 test_id: $test_id sessionid: $sessionId");
+ $this->log("test_id and session_id not set. Cannot proceed. debug: status: $status cmd: $cmd var1: $var1 var2: $var2 test_id: $test_id sessionid: $sessionId", 'Leech_output');
exit;
}
- $node['Node']['lastCommand'] = time();
-
-
if($cmd == 'testComplete'){
- $node['Node']['running'] = 0;
- $node['Node']['test_id'] = null;
- $node['Node']['session_id'] = null;
- $node['Node']['lastCommand'] = null;
+ $cmds = $this->Command->find(array(
+ 'Command.test_id' => $test_id,
+ 'Command.status' => 'failed')
+ );
+ $status = empty($cmds) ? 'passed' : 'failed';
+ $test = array(
+ 'Test' => array(
+ 'status' => $status,
+ 'id' => $test_id
+ )
+ );
+ $this->Test->save($test);
- $conditions = array('Command.test_id' => $test_id, 'Command.status' => 'failed');
- $cmds = $this->Command->find($conditions);
+ $this->log("Deleting seleniumserver on test $test_id", 'Leech_output');
+ $this->Seleniumserver->delete($seleniumserver['Seleniumserver']['id']);
- if (empty($cmds)){
- $test = array(
- 'Test' => array(
- 'status' => 'passed',
- 'id' => $test_id
- )
- );
- $this->Test->save($test);
- }
- else{
- $test = array(
- 'Test' => array(
- 'status' => 'failed',
- 'id' => $test_id
- )
- );
- $this->Test->save($test);
- }
-
-
- }
- if(isset($node['Node']['id'])){
- $this->Node->save($node);
+ }elseif(isset($seleniumserver['Seleniumserver']['id'])){
+ $seleniumserver['Seleniumserver']['lastCommand'] = time();
+ $this->Seleniumserver->save($seleniumserver);
}else{
- $this->log("No node id set. Panic! debug: status: $status cmd: $cmd var1: $var1 var2: $var2 test_id: $test_id sessionid: $sessionId".print_r($node,true));
+ $this->log("No node id set. Panic! debug: status: $status cmd: $cmd var1: $var1 var2: $var2 test_id: $test_id sessionid: $sessionId".print_r($node,true), 'Leech_output');
exit;
}
@@ -240,12 +205,4 @@
return $response;
}
- function log($text){
- if ($this->debugmode){
- $fp = fopen('logs/Leech_output.txt','a');
- fwrite($fp, date('l jS \of F Y h:i:s A'). ': ' . "$text\n");
- fclose($fp);
- }
-
- }
-}
+}
\ No newline at end of file
Modified: trunk/app/controllers/tests_controller.php (882 => 883)
--- trunk/app/controllers/tests_controller.php 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/controllers/tests_controller.php 2010-07-13 11:08:03 UTC (rev 883)
@@ -28,6 +28,11 @@
$this->Session->setFlash(__('Invalid Test.', true));
$this->redirect(array('action'=>'index'));
}
+ $sauce_enabled = $this->Config->field('value', array('name'=> 'sauce_enabled'));
+ if($sauce_enabled == 1){
+ $this->set('sauce_username', $this->Config->field('value', array('name' => 'sauce_username')));
+ $this->set('sauce_apikey', $this->Config->field('value', array('name'=> 'sauce_apikey')));
+ }
$this->set('test', $this->Test->read(null, $id));
}
Modified: trunk/app/models/browser.php (882 => 883)
--- trunk/app/models/browser.php 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/models/browser.php 2010-07-13 11:08:03 UTC (rev 883)
@@ -25,7 +25,7 @@
var $hasMany = array(
'Combination' => array('className' => 'Combination',
'foreignKey' => 'browser_id',
- 'dependent' => false,
+ 'dependent' => true, //NOTICE: TRUE
'conditions' => '',
'fields' => '',
'order' => '',
@@ -70,6 +70,17 @@
$id = $this->id;
if ($created){
$text = "Added the browser: <a href='/requirements#/browsers/view/$id'>" . $this->data['Browser']['name'] . '(' . $this->data['Browser']['path'] . ')</a>';
+
+ $this->Combination->Operatingsystem->recursive = 0;
+ $all_os = $this->Combination->Operatingsystem->find('all');
+
+ foreach ($all_os as $value) {
+ $data = array();
+ $data['Combination']['operatingsystem_id'] = $value['Operatingsystem']['id'];
+ $data['Combination']['browser_id'] = $id;
+ $this->Combination->create();
+ $this->Combination->save($data);
+ }
}else{
$text = "Edited the browser: <a href='/requirements#/browsers/view/$id'>" . $this->data['Browser']['name'] . "</a>";
}
@@ -82,5 +93,9 @@
$this->saveActivity($text);
return true;
}
+
+ function afterDelete(){
+
+ }
}
?>
\ No newline at end of file
Modified: trunk/app/models/command.php (882 => 883)
--- trunk/app/models/command.php 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/models/command.php 2010-07-13 11:08:03 UTC (rev 883)
@@ -20,17 +20,10 @@
?>
<?php
class Command extends AppModel {
-
- var $pathToProject = array(
- 'Command'=>'Test',
- 'Test'=>'Suite',
- 'Suite'=>'Project',
- );
function afterSave($created){
clearCache(array('testlabs','projects_testlabsview/','requirements_testlabview'));
- Debugger::log(print_r($this->data, true));
$command = $this->find('first',array(
'conditions' => array(
'Command.id' => $this->getLastInsertID()
Modified: trunk/app/models/node.php (882 => 883)
--- trunk/app/models/node.php 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/models/node.php 2010-07-13 11:08:03 UTC (rev 883)
@@ -21,7 +21,7 @@
<?php
class Node extends AppModel {
- function checkJavaServer($nodepath, $timeout=0.5){
+ function checkJavaServer($nodepath, $timeout=2){
$nodepath = explode(':',$nodepath);
$host = @$nodepath[0];
@@ -46,12 +46,6 @@
'conditions' => '',
'fields' => '',
'order' => ''
- ),
- 'Test' => array('className' => 'Test',
- 'foreignKey' => 'test_id',
- 'conditions' => '',
- 'fields' => '',
- 'order' => ''
)
);
Modified: trunk/app/models/operatingsystem.php (882 => 883)
--- trunk/app/models/operatingsystem.php 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/models/operatingsystem.php 2010-07-13 11:08:03 UTC (rev 883)
@@ -25,7 +25,7 @@
var $hasMany = array(
'Combination' => array('className' => 'Combination',
'foreignKey' => 'operatingsystem_id',
- 'dependent' => false,
+ 'dependent' => true, //NOTICE: TRUE
'conditions' => '',
'fields' => '',
'order' => '',
@@ -65,6 +65,18 @@
$id = $this->id;
if ($created){
$text = "Added the operating system: <a href='/requirements#/operatingsystems/view/$id'>" . $this->data['Operatingsystem']['name'] . "</a>";
+
+
+ $this->Combination->Browser->recursive = 0;
+ $all_browser = $this->Combination->Browser->find('all');
+
+ foreach ($all_browser as $value) {
+ $data = array();
+ $data['Combination']['browser_id'] = $value['Browser']['id'];
+ $data['Combination']['operatingsystem_id'] = $id;
+ $this->Combination->create();
+ $this->Combination->save($data);
+ }
}else{
$text = "Edited the operating system: <a href='/requirements#/operatingsystems/view/$id'>" . $this->data['Operatingsystem']['name'] . "</a>";
}
Added: trunk/app/models/seleniumserver.php (0 => 883)
--- trunk/app/models/seleniumserver.php (rev 0)
+++ trunk/app/models/seleniumserver.php 2010-07-13 11:08:03 UTC (rev 883)
@@ -0,0 +1,41 @@
+<?php
+class Seleniumserver extends AppModel {
+
+ var $validate = array(
+ 'test_id' => 'numeric',
+ 'lastCommand' => 'numeric',
+ 'nodepath' => 'notEmpty',
+ 'node_id' => 'numeric'
+ );
+ //The Associations below have been created with all possible keys, those that are not needed can be removed
+ var $belongsTo = array(
+ 'Test' => array(
+ 'className' => 'Test',
+ 'foreignKey' => 'test_id',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ ),
+ 'Node' => array(
+ 'className' => 'Node',
+ 'foreignKey' => 'node_id',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ )
+ );
+
+ function afterSave($created){
+ if($created === true){
+ $this->Node->updateAll(array('running'=>'running+1'), array('Node.id'=>$this->data['Seleniumserver']['node_id']));
+ }
+ }
+
+ function beforeDelete(){
+ $data = $this->findById($this->id);
+ $this->Node->updateAll(array('running'=>'running-1'), array('Node.id'=>$data['Seleniumserver']['node_id']));
+ return true;
+ }
+
+}
+?>
\ No newline at end of file
Modified: trunk/app/views/browsers/add.ctp (882 => 883)
--- trunk/app/views/browsers/add.ctp 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/views/browsers/add.ctp 2010-07-13 11:08:03 UTC (rev 883)
@@ -25,8 +25,6 @@
<?php
echo $form->input('name');
echo $form->input('path');
- echo $form->input('shortname');
- echo $form->input('saucename');
?>
</fieldset>
<?php echo $form->end('Submit');?>
Modified: trunk/app/views/browsers/edit.ctp (882 => 883)
--- trunk/app/views/browsers/edit.ctp 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/views/browsers/edit.ctp 2010-07-13 11:08:03 UTC (rev 883)
@@ -26,8 +26,6 @@
echo $form->input('id');
echo $form->input('name');
echo $form->input('path');
- echo $form->input('shortname');
- echo $form->input('saucename');
?>
</fieldset>
<?php echo $form->end('Submit');?>
Modified: trunk/app/views/browsers/index.ctp (882 => 883)
--- trunk/app/views/browsers/index.ctp 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/views/browsers/index.ctp 2010-07-13 11:08:03 UTC (rev 883)
@@ -30,8 +30,6 @@
<tr>
<th><?php echo $paginator->sort('name');?></th>
<th><?php echo $paginator->sort('path');?></th>
- <th><?php echo $paginator->sort('shortname');?></th>
- <th><?php echo $paginator->sort('saucename');?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
@@ -50,12 +48,6 @@
<td>
<?php echo $browser['Browser']['path']; ?>
</td>
- <td>
- <?php echo $browser['Browser']['shortname']; ?>
- </td>
- <td>
- <?php echo $browser['Browser']['saucename']; ?>
- </td>
<td class="actions">
<?php echo $html->link(__('View', true), array('action'=>'view', $browser['Browser']['id'])); ?>
<?php echo $html->link(__('Edit', true), array('action'=>'edit', $browser['Browser']['id'])); ?>
Modified: trunk/app/views/browsers/view.ctp (882 => 883)
--- trunk/app/views/browsers/view.ctp 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/views/browsers/view.ctp 2010-07-13 11:08:03 UTC (rev 883)
@@ -31,16 +31,6 @@
<?php echo $browser['Browser']['path']; ?>
</dd>
- <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Shortname'); ?></dt>
- <dd<?php if ($i++ % 2 == 0) echo $class;?>>
- <?php echo $browser['Browser']['shortname']; ?>
-
- </dd>
- <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Saucename'); ?></dt>
- <dd<?php if ($i++ % 2 == 0) echo $class;?>>
- <?php echo $browser['Browser']['saucename']; ?>
-
- </dd>
</dl>
</div>
<div class="actions">
Modified: trunk/app/views/layouts/green.ctp (882 => 883)
--- trunk/app/views/layouts/green.ctp 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/views/layouts/green.ctp 2010-07-13 11:08:03 UTC (rev 883)
@@ -16,6 +16,7 @@
//echo $html->css('green/datepicker');
echo $scripts_for_layout;
echo $javascript->link('prototype');
+ echo $javascript->link('http://saucelabs.com/flowplayer/example/flowplayer-3.1.4.min.js');
echo $javascript->link('scriptaculous');
echo $javascript->link('popup');
echo $javascript->link('prettify/prettify');
@@ -89,11 +90,13 @@
</head>
<body>
- <div id="main">
+ <div id="main">
+
<div id="links_container">
<div id="links">
<!-- #links is bad naming-->
<?php
+
if(isset($realname) && isset($username)){
echo "<div class='br-logged-in-as'>" . __("Logged in as", true) . " $realname ($username)</div>";
}
Modified: trunk/app/views/operatingsystems/add.ctp (882 => 883)
--- trunk/app/views/operatingsystems/add.ctp 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/views/operatingsystems/add.ctp 2010-07-13 11:08:03 UTC (rev 883)
@@ -24,7 +24,6 @@
<legend><?php __('Add Operatingsystem');?></legend>
<?php
echo $form->input('name');
- echo $form->input('shortname');
?>
</fieldset>
<?php echo $form->end('Submit');?>
Modified: trunk/app/views/operatingsystems/edit.ctp (882 => 883)
--- trunk/app/views/operatingsystems/edit.ctp 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/views/operatingsystems/edit.ctp 2010-07-13 11:08:03 UTC (rev 883)
@@ -25,7 +25,6 @@
<?php
echo $form->input('id');
echo $form->input('name');
- echo $form->input('shortname');
?>
</fieldset>
<?php echo $form->end('Submit');?>
Modified: trunk/app/views/operatingsystems/index.ctp (882 => 883)
--- trunk/app/views/operatingsystems/index.ctp 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/views/operatingsystems/index.ctp 2010-07-13 11:08:03 UTC (rev 883)
@@ -29,7 +29,6 @@
<table cellpadding="0" cellspacing="0">
<tr>
<th><?php echo $paginator->sort('name');?></th>
- <th><?php echo $paginator->sort('shortname');?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
@@ -44,9 +43,6 @@
<td>
<?php echo $operatingsystem['Operatingsystem']['name']; ?>
</td>
- <td>
- <?php echo $operatingsystem['Operatingsystem']['shortname']; ?>
- </td>
<td class="actions">
<?php echo $html->link(__('View', true), array('action'=>'view', $operatingsystem['Operatingsystem']['id'])); ?>
<?php echo $html->link(__('Edit', true), array('action'=>'edit', $operatingsystem['Operatingsystem']['id'])); ?>
Modified: trunk/app/views/operatingsystems/view.ctp (882 => 883)
--- trunk/app/views/operatingsystems/view.ctp 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/views/operatingsystems/view.ctp 2010-07-13 11:08:03 UTC (rev 883)
@@ -26,11 +26,6 @@
<?php echo $operatingsystem['Operatingsystem']['name']; ?>
</dd>
- <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Shortname'); ?></dt>
- <dd<?php if ($i++ % 2 == 0) echo $class;?>>
- <?php echo $operatingsystem['Operatingsystem']['shortname']; ?>
-
- </dd>
</dl>
</div>
<div class="actions">
Modified: trunk/app/views/suites/view.ctp (882 => 883)
--- trunk/app/views/suites/view.ctp 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/views/suites/view.ctp 2010-07-13 11:08:03 UTC (rev 883)
@@ -31,7 +31,7 @@
echo "</tr>";
}
echo "</table>";
- $filename = WWW_ROOT.'logs'.DS.'output'.$test['id'].'.txt';
+ $filename = LOGS.$test['id'].'.log';
$log = @file_get_contents($filename);
if(!empty($log)){
echo "<pre><p class='notice'>Notice: $log</p></pre>";
Modified: trunk/app/views/tests/view.ctp (882 => 883)
--- trunk/app/views/tests/view.ctp 2010-07-13 10:53:09 UTC (rev 882)
+++ trunk/app/views/tests/view.ctp 2010-07-13 11:08:03 UTC (rev 883)
@@ -18,6 +18,7 @@
along with Bromine. If not, see <http://www.gnu.org/licenses/>.
*/
?>
+
<div class="tests view">
<h1><?php echo $test['Test']['name']; ?></h1>
<dl>
@@ -41,15 +42,44 @@
<?php echo $test['Test']['timestamp']; ?>
</dd>
+ <?php
+ if(!empty($test['Test']['saucelabs_job_id'])){
+ echo '<dt>Video</dt>';
+ echo "<dd>.";
+ //echo 'http://saucelabs.com/video-embed/'.$test['Test']['saucelabs_job_id'].'.js?username='.$sauce_username.'&access_key='.$sauce_apikey.'"';
+ ?>
+ <a href="." style="display:block;width:600px;height:450px" id="player"></a>
+ <script type='text/javascript'>
+
+ flowplayer("player", "http://saucelabs.com/flowplayer/flowplayer-3.1.5.swf", {
+ clip: {
+ url:'http://saucelabs.com/jobs/<?php echo $test["Test"]["saucelabs_job_id"]; ?>/video.flv',
+ provider: 'streamer',
+ autoPlay: false,
+ autoBuffering: true},
+ plugins: {
+ streamer: {
+ url: 'http://saucelabs.com/flowplayer/flowplayer.pseudostreaming-3.1.3.swf'
+ }
+ }
+ });
+
+ </script>
+ <?php
+ echo "</dd>";
+ }
+ ?>
<dt><?php __('Commands'); ?></dt>
<dd>
<?php if (!empty($test['Command'])):?>
+
+
<table cellpadding = "0" cellspacing = "0" style="width: 100%;">
<tr>
<th><?php __('Command'); ?></th>
<th><?php __('Statement 1'); ?></th>
<th><?php __('Statement 2'); ?></th>
- <th><?php __('Comment'); ?></th>
+ <th><?php __('Comment'); ?></th>
</tr>
<?php foreach ($test['Command'] as $command): ?>
<tr class='<?php echo $command['status'];?>'>
@@ -61,9 +91,10 @@
<?php endforeach; ?>
</table>
<?php endif; ?>
- </dd>
+ </dd>
+
<?php
- $filename = WWW_ROOT.'logs'.DS.'output'.$test['Test']['id'].'.txt';
+ $filename = LOGS.$test['Test']['id'].'.log';
if(file_exists($filename)){
$log = file_get_contents($filename);
if(!empty($log)){
@@ -76,4 +107,4 @@
}
?>
</dl>
-</div>
+</div>
\ No newline at end of file