upload screenshots
This commit is contained in:
parent
6c0873fc6f
commit
495d4e0d26
@ -8,7 +8,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"jhodges/giteabot": "~1.2.0"
|
||||
"jhodges/giteabot": "~1.2.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@ -13,17 +13,18 @@ final class Poster{
|
||||
|
||||
$this->report.=$testdox;
|
||||
|
||||
$xml = simplexml_load_file($xml_path);
|
||||
$this->process($xml);
|
||||
$this->xml = simplexml_load_file($xml_path);
|
||||
}
|
||||
|
||||
public function post($url, $user, $pass, $repoUser, $repo){
|
||||
// open connection and repo
|
||||
$client=new Client($url, $user, $pass);
|
||||
$repo=$client->getRepo($repoUser, $repo);
|
||||
$this->client=new Client($url, $user, $pass, true);
|
||||
$this->repo=$this->client->getRepo($repoUser, $repo);
|
||||
|
||||
$this->process($this->xml); //process xml and upload screenshots
|
||||
|
||||
// create the issue
|
||||
$issue=$repo->createIssue([
|
||||
$issue=$this->repo->createIssue([
|
||||
'title'=>'Test Results',
|
||||
'body'=>$this->report
|
||||
]);
|
||||
@ -34,7 +35,14 @@ final class Poster{
|
||||
if(isset($item->testcase)){
|
||||
foreach($item->testcase as $testcase) {
|
||||
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