Those test methods use the FacebookDom helper class (an extension of my DomHelper class) for finding and manipulating the Facebook window and DOM. Test the Facebook Popupįor my integration tests, I use Selenium with its Python API and Python's unittest module.įor my FacebookTests test case, I extend my BaseTests class and add two test methods, one for testing authorization and the other for testing login. Visit their profile, take note of their email address, and change any desired fields (depending on what your app uses - I gave mine a profile pic and location). Click 'Login' in the users table so that you're logged into Facebook as them.Now paste this URL in the browser, replacing the ID with your test user ID, access_token with the string you just got, and password with your desired test password:.First, get an access token for your app by putting this URL in the browser and replacing the client_id and client_secret with your app key and app secret: Now you need to find out the user's password, so you can enter that with Selenium.You'll see a table with information about the test user, like their name (which you can change to something snappier, like "Sharky Shark" :) and ID. Once created, click 'Modify' in the 'Test Users' section.Select '1' and don't select 'Authorize this app' (if your purpose is to test authorization). Click 'Edit app' and then 'Roles' on the left-hand side. For the purpose of my tests, I only need one test user, so I created him semi-manually with these steps: Thankfully, Facebook introduced a way earlier this year to create multiple test users, both programmatically and from the developer dashboard. That kind of sucked, since you only have so many old email addresses, and it wasn't exactly Facebook TOU-friendly. In the land of old, creating a test Facebook user meant digging up an old email address and signing up with your cat's details. Good thing I did, because testing Facebook login turned out to be pretty easy. As I was making some changes that affected Facebook users today, I decided it was time to face my fears. All I have to do for email login testing is enter a few text fields, but for Facebook testing, I would need to navigate to the Facebook popup window and manipulate *their* DOM, and I would need a test user account that was really and a truly a test user (and not my cat, who actually is surprisingly active on Facebook). Until today, however, I only had integration tests for email signup and login, because, well, I was afraid. I see about 50/50 usage for these options, so they are both equally important - which means testing both of them are equally important. On EatDifferent, I give users two options for signing up: Facebook, for people that like the convenience of using FB to sign in everywhere, and email+password, for people that hate Facebook.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |