关于Angular组件测试时需要制定浏览器初期尺寸的设定项(Firefox,Chrome)

需要在karma.conf.js里面添加如下节点。

customLaunchers : {

    chromeCustom: {

        base: 'Chrome',

        displayName: 'chromeCustom',

        flags: ['--window-size=768,1024']  // for Chrome

 

    },

    firefoxCustom:{

        base:'Firefox',

        displayName:'firefoxCustom',

        flags: ['-width=768','-height=1024']  // for Firefox

    }

}

添加了这两个后,运行ng test命令时浏览器就会按照指定的大小打开,对于测试屏幕分辨率很有帮助。

posted on 2018-10-19 21:52  さがみ野さくら  阅读(298)  评论(0编辑  收藏  举报