您的位置:首页 > 编程语言 > Go语言

allure修改logo和内容标题

2020-12-15 20:09 1431 查看
  1. 修改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>

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐