修改logo
cd /usr/local/Cellar/allure/2.13.7/libexec/config,在allure.yml配置文件中增加- custom-logo-plugin
plugins:
- junit-xml-plugin
- xunit-xml-plugin
- trx-plugin
- behaviors-plugin
- packages-plugin
- screen-diff-plugin
- xctest-plugin
- jira-plugin
- xray-plugin
- custom-logo-plugin
cd /usr/local/Cellar/allure/2.13.7/libexec/plugins/custom-logo-plugin/static
vi styles.css
.side-nav__brand {
background: url('logo.png') no-repeat left center !important;
margin-left: 15px;
height: 55px;
background-size: contain !important;
}
.side-nav__brand-text {
display: none;
}
保存,運行測試腳本,查看報告
2. 修改內容標題
在生成的index.html中增加js代碼
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script>
jQuery.fn.wait = function (selector, func, times, interval) {
var _times = times || -1, //100次
_interval = interval || 20, //20毫秒每次
_self = this,
_selector = selector, //選擇器
_iIntervalID; //定時器id
if( this.length ){ //如果已經獲取到了,就直接執行函數
func && func.call(this);
} else {
_iIntervalID = setInterval(function() {
if(!_times) { //是0就退出
clearInterval(_iIntervalID);
}
_times <= 0 || _times--; //如果是正數就 --
_self = $(_selector); //再次選擇
if( _self.length ) { //判斷是否取到
func && func.call(_self);
clearInterval(_iIntervalID);
}
}, _interval);
}
return this;
}
function showTime(){
var myDate = new Date;
var year = myDate.getFullYear(); //獲取當前年
var mon = myDate.getMonth() + 1; //獲取當前月
var date = myDate.getDate(); //獲取當前日
var h = myDate.getHours();//獲取當前小時數(0-23)
var m = myDate.getMinutes();//獲取當前分鐘數(0-59)
var s = myDate.getSeconds();//獲取當前秒
var time = year + '/' + mon + '/' + date + ' ' + h + ':' + m + ':' + s
console.log(time)
$('#content > div > div.app__content > div > div:nth-child(1) > div:nth-child(1) > div.widget__body > div > div > div:nth-child(1) > h2').html('自動化測試 ' + time);
}
$('#content > div > div.app__content > div > div:nth-child(1) > div:nth-child(1) > div.widget__body > div > div > div:nth-child(1) > h2').wait('#content > div > div.app__content > div > div:nth-child(1) > div:nth-child(1) > div.widget__body > div > div > div:nth-child(1) > h2', function(){showTime();})
</script>