天道酬勤,学无止境

chimp.js

如何使用 Node JS / Webdriver.io / Chimp 打印到 PDF?(How to print to PDF using Node JS / Webdriver.io / Chimp?)

问题 我正在尝试在 Node JS 中使用 Chimp / Webdriver.io / Selenium 来尝试测试我的@media print CSS,以确保当人们从我的网站打印时一切都正确显示。 如何以编程方式让 Chrome / Firefox 打印到 PDF? 我不想将屏幕截图转换为 PDF。 我希望 PDF 看起来像打印时的样子。 那么,如何扫描 PDF 以确保结果正确? 回答1 成功! 我必须安装/使用以下工具: npm install html-pdf-chrome --save-dev npm install pdfreader --save-dev html-pdf-chrome 用于神奇地调用 Chrome,以 Chrome 通常用于打印的方式将某些给定的 HTML 转换为 PDF。 pdfreader 是一个读取所述 PDF 并在其中提供文本的软件包。 浏览到我想使用 webdriver 打印的页面后,我可以调用: this.When(/^I print the page to a PDF named "([^"]*)"$/, async function(outputFilename) { console.log("Getting the html..."); let sourceHTML = await browser.getSource()

2022-01-15 11:28:22    分类:技术分享    node.js   webdriver   webdriver-io   chimp.js

How to print to PDF using Node JS / Webdriver.io / Chimp?

I'm trying to use Chimp / Webdriver.io / Selenium in Node JS to try to test my @media print CSS to make sure everything shows up correctly when people print from my website. How can I programatically get Chrome / Firefox to print to PDF? I don't want to convert a screenshot to PDF. I want the PDF to look like what it will look like when printed. Then, how can I scan the PDF to make sure that the results are correct?

2022-01-12 08:48:41    分类:问答    node.js   webdriver   webdriver-io   chimp.js

Meteor.js:在使用 Chimp 进行测试时使用 server.call(Meteor.js: Using server.call when testing with Chimp)

问题 我在编写功能测试时遇到触发方法调用的问题。 我实际上并没有在 chimp 终端日志中给出错误,但是 server.call 行是突出显示失败的地方。 我相信这可能与应用程序的文件夹结构(我松散地基于 Letterpress)或定义调用然后触发的顺序有关。 当我将方法调用移到我的 main.js 文件(在应用程序的根文件夹中)时,它可以正常工作。 hooks.js路径:/app/tests/cucumber/features/support/hooks.js (function(){ module.exports = function() { this.Before(function() { console.log("server calling"); server.call("fixtures/resetUsers"); //test stops here }); }; })(); fixtures.js /app/packages/fixtures/fixtures.js (function(){ 'use strict'; Meteor.methods({ "fixtures/resetUsers": function() { Meteor.users.remove({}); } }); })(); package.js /app/packages/fixtures

2021-11-10 13:28:29    分类:技术分享    meteor   cucumber   chimp.js

Meteor.js: Using server.call when testing with Chimp

I'm having an issue triggering method calls while writing feature tests. I'm not actually given an error in the chimp terminal log, but the server.call line is where the failure is highlighted. I believe this might be related to the folder structure of the app (which I've loosely based on Letterpress) or the order in which the call is defined and then triggered. When I move the method call out to my main.js file (in the root folder of the app), it works without a problem. hooks.js path: /app/tests/cucumber/features/support/hooks.js (function(){ module.exports = function() { this.Before

2021-11-08 01:08:39    分类:问答    meteor   cucumber   chimp.js