PlayWithMagic / PlayWithMagic.org

PlayWithMagic.org is a web application that catalogs magic tricks and helps magicians build shows.
http://playwithmagic.github.io/PlayWithMagic.org/
Apache License 2.0
2 stars 1 forks source link

How do we test image uploads with Chromium? Use an image in the file structure? #195

Open davidkneely opened 9 years ago

davidkneely commented 9 years ago

I will be researching this starting at 11am. Wanted to post it as an issue to get feedback if you have any suggestions on how this should be accomplished.

marknelsonengineer commented 9 years ago

This might not be as onerous as it sounds... Chrome's going to do all of the work. What we need to do is: 1) Render a page with an image upload field (the single line edit box and an upload button)... 2) Figure out what Chrome's 'home' directory is. With any luck, it's somewhere in the PlayWithMagic source tree. 3) If it is, we put an image file in some subdirectory of that tree... 4) Finally, we put that relative directory in the single line edit box and click() the button through a PageObject.

That should get the file into the database.

Testing the upload

Next, we need to figure out how to check it. We can't easily get the URL of the upload without accessing the database (which is totally doable)... One thing we could do is test for the absence of the default image. So when we render ViewMagician, we make sure that the default image is not there. Maybe look for the leading edge of the Image URL (except for the ID, which is sometimes hard for a test to get).

Anyway... just thinking about how we'd approach this.