使用 Cucumber 测试 SWFUpload

发布于 2024-07-29 07:54:50 字数 208 浏览 3 评论 0原文

在一个项目中,我最近用SWFUpload替换了一个简单的基于表单的文件上传。 当 SWFUpload 返回成功时,我会生成一个表单以向上传的资源添加标签。

我希望能够测试将数据输入到标签文本框中,但要做到这一点,我(认为我)需要伪造 SWFUpload。

过去有人这样做过吗? 我无法通过谷歌找到任何东西,并且黄瓜文档中似乎没有任何内容:测试Flash。

In a project, I recently replaced a simple form-based file upload with SWFUpload. When SWFUpload returns a success, I generate a form to add tags to the uploaded asset.

I'd like to be able to test inputting data into the tags textbox, but to do that I (think I) need to fake out SWFUpload.

Has anyone done this in the past? I haven't been able to find anything via google, and there doesn't seem to be anything in the cucumber docs re: testing Flash.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

橙幽之幻 2024-08-05 07:54:50

我认为你根本不需要伪造 flash,因为 swfupload 为你做的只是模拟一个简单的 http post。

如果您对 swfupload 发布到的同一操作/控制器执行手动 http 发布,并确保帖子的文件字段的名称与 swfupload 传递的 swf 参数 (params[:Filedata]) 相同,您应该得到效果相同。

另外,要回答上面 Swanand 的评论,您需要破解 CGI::Session。 尝试 http:// /blog.isshen.com/2008/10/5/making-swfupload-and-rails-2-1-sessions-work-together

I dont think you need to fake flash at all, because all swfupload is doing for you is simulating a simple http post.

If you do a manual http post to the same action/controller that your swfupload is posting to and make sure the file field of your post is named the same as the swf parameter which swfupload passes (params[:Filedata]) you should get the same effect.

Also to answer Swanand's comment above you need to hack CGI::Session. Try http://blog.isshen.com/2008/10/5/making-swfupload-and-rails-2-1-sessions-work-together

め七分饶幸 2024-08-05 07:54:50

我最近偶然发现这个插件它可能可以帮助你你需要做什么。 您可以在此处阅读更多内容。

I recently stumbled upon this plugin which may be able to help you with what yo need to do. You can read more here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文