[英]Write text to a file using testcafe
I was wondering if there's a way I can create a file and save the data in a file using testcafe.我想知道是否有一种方法可以使用 testcafe 创建文件并将数据保存在文件中。
test('copy data', async t => {
await someAction(t);
const data = RequestLogger(data, { logRequestBody: true, stringifyRequestBody: true });
await t.clearContent('data/output.js');
await t.writeText('data/output.js', data);
});
I have written some dummy test to explain what I need.我写了一些虚拟测试来解释我需要什么。 Is it possible to do something of this sort in testcafe?
有可能在 testcafe 中做这样的事情吗? How could we do that?
我们怎么能那样做?
You can safely treat a testcafe test as a nodejs application where you can use any standard nodejs API and/or any other third-party modules to write/read files:您可以安全地将 testcafe 测试视为 nodejs 应用程序,您可以在其中使用任何标准 nodejs API 和/或任何其他第三方模块来写入/读取文件:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.