构建Headless 的 E2E 测试

为什么要构建 Headless 的 E2E 测试 A headless browser is a great tool for automated testing and server environments where you don't need a visible UI shell. For example, you may want to run some tests against a real web page, create a PDF of it, or just inspect how the browser renders an URL. 结合上面的原因,我们还可以 Headless结合 E2E 测试,可以让E2E 测试在非 GUI 的操作系统中运行 可以集成至 CI 环境中。让版本得到快速验证 Chrome Headless 的选取 Mac/Linux 的Chrome从59版本后,已经支持 Healess 模式的运行。Windows 的从60版本开始支持 所以选择一个你想要的 Chrome 版本,便可以进行 Headless 的测试 chrome \ --headless \ # Runs Chrome in headless mode. --disable-gpu \ # Temporarily needed if running on Windows. https://www.chromestatus.com # URL to open. Defaults to about:blank. ...

March 2, 2018 · 2 min · Yuanjie

获取Chrome浏览器

由来 项目的测试需求,需要针对64位 Chrome 42+的各个稳定版本进行测试,但安装环境又无法直接访问外网进行在线版本安装,因此需要搜集已发布的离线安装版本。作为安装源。 首先,来认识下Chrome到底有哪些版本。 Chrome VS Chromium 区别 The Chromium projects include Chromium and Chromium OS, the open-source projects behind the Google Chrome browser and Google Chrome OS, respectively. This site houses the documentation and code related to the Chromium projects and is intended for developers interested in learning about and contributing to the open-source projects. 简而言之,Chrome是基于 开源项目 Chromium的 。新功能会优先在Chromium发布。 ...

January 18, 2017 · 2 min · Yuanjie

API开发神器-Postman

Postman helps you develop APIs faster. 豪华午餐 Postman 构建、管理、文档化API 在线安装 Chrome插件版 https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop MAC版 https://www.getpostman.com/app/postman-osx 离线安装 使用已经安装好的Postman文件夹,机器默认存放目录:/Library/Application\ Support/Google/Chrome/Default/Extensions 进入chrome://extensions/,选择Load unpacked extensions,加载Postman的文件夹 ...

June 24, 2016 · 5 min · Yuanjie

Chrome设置网络延迟与带宽

Developer Tools开发者工具查看网络请求 Windows: F12键 Mac OS: option+command+i键 打开网络请求Network 请求网址http://aimer1124.github.io/后,Network中便会有本次的网络请求内容 点击第一条请求http://aimer1124.github.io/,可查看到此网络请求的详细信息Request/Response 切换到Timing栏中,显示具体的请求时间消耗 切换Headers、Preview、Response、Cookies,也可直接查看对应的信息 设置网络延迟和带宽 点击No throttling会显示出Chrome已提前设置好常用的网络延迟和带宽,供直接选择 网络类型 带宽 延迟 Offline 0kb/s 0ms GPRS 50kb/s 500ms Regular 2G 250kb/s 300ms Good 2G 450kb/s 150ms Regular 3G 750kb/s 100ms Good 3G 1Mb/s 40ms Regular 4G 4Mb/s 20ms DSL 2Mb/s 5ms WiFi 30Mb/s 2ms 选择GRPS,clear网络请求,再次刷新页面,查看请求http://aimer1124.github.io/的Timing 此时,可查看到对应的网络延迟已经生效 自定义网络延迟和带宽 点击No throttling-Custom-add进入Network Throttling Profiles设置页面 设置Profile Name:slow1S,Throughput:10,Latency为:1000 关闭设置框,切换No throttling为slow1S,自定义网络延迟与带宽设置完成 参考 Measure Resource Loading Times:https://developers.google.com/web/tools/chrome-devtools/profile/network-performance/resource-loading#network-panel-overview Device Mode & Mobile Emulation:https://developer.chrome.com/devtools/docs/device-mode

March 9, 2016 · 2 min · Yuanjie