upload screenshots
This commit is contained in:
parent
6c0873fc6f
commit
495d4e0d26
@ -8,7 +8,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"jhodges/giteabot": "~1.2.0"
|
"jhodges/giteabot": "~1.2.2"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
@ -13,17 +13,18 @@ final class Poster{
|
|||||||
|
|
||||||
$this->report.=$testdox;
|
$this->report.=$testdox;
|
||||||
|
|
||||||
$xml = simplexml_load_file($xml_path);
|
$this->xml = simplexml_load_file($xml_path);
|
||||||
$this->process($xml);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function post($url, $user, $pass, $repoUser, $repo){
|
public function post($url, $user, $pass, $repoUser, $repo){
|
||||||
// open connection and repo
|
// open connection and repo
|
||||||
$client=new Client($url, $user, $pass);
|
$this->client=new Client($url, $user, $pass, true);
|
||||||
$repo=$client->getRepo($repoUser, $repo);
|
$this->repo=$this->client->getRepo($repoUser, $repo);
|
||||||
|
|
||||||
|
$this->process($this->xml); //process xml and upload screenshots
|
||||||
|
|
||||||
// create the issue
|
// create the issue
|
||||||
$issue=$repo->createIssue([
|
$issue=$this->repo->createIssue([
|
||||||
'title'=>'Test Results',
|
'title'=>'Test Results',
|
||||||
'body'=>$this->report
|
'body'=>$this->report
|
||||||
]);
|
]);
|
||||||
@ -34,7 +35,14 @@ final class Poster{
|
|||||||
if(isset($item->testcase)){
|
if(isset($item->testcase)){
|
||||||
foreach($item->testcase as $testcase) {
|
foreach($item->testcase as $testcase) {
|
||||||
foreach($testcase as $k=>$v){
|
foreach($testcase as $k=>$v){
|
||||||
$this->report.="\n```plain\n".print_r($testcase,true)."\n```";
|
$img='';
|
||||||
|
$name=$testcase->attributes()->class[0]."::".$testcase->attributes()->name[0];
|
||||||
|
if(file_exists("/tmp/$name.png")){
|
||||||
|
$data=$this->repo->addAttachment("/tmp/$name.png");
|
||||||
|
$url=$data->browser_download_url;
|
||||||
|
$img="\n\n";
|
||||||
|
}
|
||||||
|
$this->report.="\n------\n# $name\n$img\n```plain\n".print_r($testcase,true)."\n```";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user